| OLD | NEW | 
|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "base/message_pump_glib.h" | 5 #include "base/message_pump_glib.h" | 
| 6 | 6 | 
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> | 
| 8 #include <math.h> | 8 #include <math.h> | 
| 9 | 9 | 
| 10 #include <algorithm> | 10 #include <algorithm> | 
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 178   EventInjector* injector_; | 178   EventInjector* injector_; | 
| 179   DISALLOW_COPY_AND_ASSIGN(MessagePumpGLibTest); | 179   DISALLOW_COPY_AND_ASSIGN(MessagePumpGLibTest); | 
| 180 }; | 180 }; | 
| 181 | 181 | 
| 182 }  // namespace | 182 }  // namespace | 
| 183 | 183 | 
| 184 // EventInjector is expected to always live longer than the runnable methods. | 184 // EventInjector is expected to always live longer than the runnable methods. | 
| 185 // This lets us call NewRunnableMethod on EventInjector instances. | 185 // This lets us call NewRunnableMethod on EventInjector instances. | 
| 186 template<> | 186 template<> | 
| 187 struct RunnableMethodTraits<EventInjector> { | 187 struct RunnableMethodTraits<EventInjector> { | 
| 188   static void RetainCallee(EventInjector* obj) { } | 188   void RetainCallee(EventInjector* obj) { } | 
| 189   static void ReleaseCallee(EventInjector* obj) { } | 189   void ReleaseCallee(EventInjector* obj) { } | 
| 190 }; | 190 }; | 
| 191 | 191 | 
| 192 TEST_F(MessagePumpGLibTest, TestQuit) { | 192 TEST_F(MessagePumpGLibTest, TestQuit) { | 
| 193   // Checks that Quit works and that the basic infrastructure is working. | 193   // Checks that Quit works and that the basic infrastructure is working. | 
| 194 | 194 | 
| 195   // Quit from a task | 195   // Quit from a task | 
| 196   loop()->PostTask(FROM_HERE, NewQuitTask()); | 196   loop()->PostTask(FROM_HERE, NewQuitTask()); | 
| 197   loop()->Run(); | 197   loop()->Run(); | 
| 198   EXPECT_EQ(0, injector()->processed_events()); | 198   EXPECT_EQ(0, injector()->processed_events()); | 
| 199 | 199 | 
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 534 | 534 | 
| 535 TEST_F(MessagePumpGLibTest, TestGtkLoop) { | 535 TEST_F(MessagePumpGLibTest, TestGtkLoop) { | 
| 536   // Tests that events and posted tasks are correctly exectuted if the message | 536   // Tests that events and posted tasks are correctly exectuted if the message | 
| 537   // loop is not run by MessageLoop::Run() but by a straight Gtk loop. | 537   // loop is not run by MessageLoop::Run() but by a straight Gtk loop. | 
| 538   // Note that in this case we don't make strong guarantees about niceness | 538   // Note that in this case we don't make strong guarantees about niceness | 
| 539   // between events and posted tasks. | 539   // between events and posted tasks. | 
| 540   loop()->PostTask(FROM_HERE, | 540   loop()->PostTask(FROM_HERE, | 
| 541                    NewRunnableFunction(TestGtkLoopInternal, injector())); | 541                    NewRunnableFunction(TestGtkLoopInternal, injector())); | 
| 542   loop()->Run(); | 542   loop()->Run(); | 
| 543 } | 543 } | 
| OLD | NEW | 
|---|