DETROIT — The chief executive of General Motors, an automaker synonymous with Detroit, saw the future of driving not in the Motor City but on the streets of San Francisco.

Mary T. Barra, a G.M. lifer who had worked her way from engineer to the top, was in the back seat of a prototype self-driving electric car as it wound its way through the city’s downtown a year ago.

She wanted to see for herself whether automation was ready to take over from a driver — safely, and on a mass scale. How would it react, for example, when it reached an intersection as a light turned yellow?

Driving in a situation like that, “you have to make a decision,” she recalled in a recent interview. “Generally if you decide to go, you decide to speed up. Or you stop.” If the technology works, she said, it will make the right decision: “The car knows.”