| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_loop/message_pump_glib.h" | 5 #include "base/message_loop/message_pump_glib.h" |
| 6 | 6 |
| 7 #include <glib.h> | 7 #include <glib.h> |
| 8 #include <math.h> | 8 #include <math.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 const Closure& task) { | 154 const Closure& task) { |
| 155 MessageLoop::current()->PostTask(from_here, task); | 155 MessageLoop::current()->PostTask(from_here, task); |
| 156 } | 156 } |
| 157 | 157 |
| 158 // Test fixture. | 158 // Test fixture. |
| 159 class MessagePumpGLibTest : public testing::Test { | 159 class MessagePumpGLibTest : public testing::Test { |
| 160 public: | 160 public: |
| 161 MessagePumpGLibTest() : loop_(NULL), injector_(NULL) { } | 161 MessagePumpGLibTest() : loop_(NULL), injector_(NULL) { } |
| 162 | 162 |
| 163 // Overridden from testing::Test: | 163 // Overridden from testing::Test: |
| 164 virtual void SetUp() OVERRIDE { | 164 void SetUp() override { |
| 165 loop_ = new MessageLoop(MessageLoop::TYPE_UI); | 165 loop_ = new MessageLoop(MessageLoop::TYPE_UI); |
| 166 injector_ = new EventInjector(); | 166 injector_ = new EventInjector(); |
| 167 } | 167 } |
| 168 virtual void TearDown() OVERRIDE { | 168 void TearDown() override { |
| 169 delete injector_; | 169 delete injector_; |
| 170 injector_ = NULL; | 170 injector_ = NULL; |
| 171 delete loop_; | 171 delete loop_; |
| 172 loop_ = NULL; | 172 loop_ = NULL; |
| 173 } | 173 } |
| 174 | 174 |
| 175 MessageLoop* loop() const { return loop_; } | 175 MessageLoop* loop() const { return loop_; } |
| 176 EventInjector* injector() const { return injector_; } | 176 EventInjector* injector() const { return injector_; } |
| 177 | 177 |
| 178 private: | 178 private: |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 // loop is not run by MessageLoop::Run() but by a straight Gtk loop. | 525 // loop is not run by MessageLoop::Run() but by a straight Gtk loop. |
| 526 // Note that in this case we don't make strong guarantees about niceness | 526 // Note that in this case we don't make strong guarantees about niceness |
| 527 // between events and posted tasks. | 527 // between events and posted tasks. |
| 528 loop()->PostTask( | 528 loop()->PostTask( |
| 529 FROM_HERE, | 529 FROM_HERE, |
| 530 Bind(&TestGtkLoopInternal, Unretained(injector()))); | 530 Bind(&TestGtkLoopInternal, Unretained(injector()))); |
| 531 loop()->Run(); | 531 loop()->Run(); |
| 532 } | 532 } |
| 533 | 533 |
| 534 } // namespace base | 534 } // namespace base |
| OLD | NEW |