Oil companies have no reason to switch to alternative energy production. Even if the gasoline market dries up, they'll still have plenty of money to make in the diesel and natural gas industry.
Plus, I'm sure if something like electric or hydrogen powered vehicles become popular that there will be plenty of revenue left over from oil for ExxonMobil to just buyout a hydrogen or lithium battery company and join that market.
Which is, of course, the whole problem: The realities of the market clash with the realities of, well, reality. The market continues to provide pressure for more oil production and for investment in oil (and natural gas and diesel and whatnot) over alternative fuels. But that doesn't mean that these are the correct solution. The real question is how to make the market align with reality; by the time the market comes around naturally, things will be a lot further into crisis than they are right now.