| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
| 14 #include "base/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/threading/thread.h" | 15 #include "base/threading/thread.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 // This class injects dummy "events" into the GLib loop. When "handled" these | 20 // This class injects dummy "events" into the GLib loop. When "handled" these |
| 21 // events can run tasks. This is intended to mock gtk events (the corresponding | 21 // events can run tasks. This is intended to mock gtk events (the corresponding |
| 22 // GLib source runs at the same priority). | 22 // GLib source runs at the same priority). |
| 23 class EventInjector { | 23 class EventInjector { |
| 24 public: | 24 public: |
| (...skipping 509 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 |