What do they mean with Dependency Injection (Inversion of Control) in this context (Google Mock):
Let's look at an example. Suppose you are developing a graphics program that relies on a LOGO-like API for drawing. How would you test that it does the right thing? Well, you can run it and compare the screen with a golden screen snapshot, but let's admit it: tests like this are expensive to run and fragile (What if you just upgraded to a shiny new graphics card that has better anti-aliasing? Suddenly you have to update all your golden images.). It would be too painful if all your tests are like this. Fortunately, you learned about Dependency Injection and know the right thing to do: instead of having your application talk to the drawing API directly, wrap the API in an interface (say, Turtle) and code to that interface:
class Turtle {
...
virtual ~Turtle() {}
virtual void PenUp() = 0;
virtual void PenDown() = 0;
virtual void Forward(int distance) = 0;
virtual void Turn(int degrees) = 0;
virtual void GoTo(int x, int y) = 0;
virtual int GetX() const = 0;
virtual int GetY() const = 0;
};
What does it have to do with DI when adding another layer between application code and drawing API by a class? In many Java example about Dependency Injection, usually an object should not be concretely created inside a class. Rather, it should be created elsewhere to separate the implementation coupling between two objects. For example (source from codeproject):

Solution:

As I searched through the answers about DI on Stackoverflow, usually it is asked in the context of Java. Some example used the Java GUI. Usually the examples is so simple and so obvious that I failed to see its significance, except for having better design with less coupling. However, what I want to learn is the meaning behind it. As defined in wiki, Inversion of Control (IoC) means you invert the flow of control of code. So, how does it apply to the Google case? How the actual flow is inverted compare to procedural style? I thought that code is executed sequentially line by line from top to bottom, not from bottom to top?