OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/views/controls/menu/menu_controller.h" | 5 #include "ui/views/controls/menu/menu_controller.h" |
6 | 6 |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "ui/aura/scoped_window_targeter.h" | 8 #include "ui/aura/scoped_window_targeter.h" |
9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
10 #include "ui/events/event_targeter.h" | 10 #include "ui/events/event_targeter.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 public: | 68 public: |
69 TestDispatcherClient() : dispatcher_(NULL) {} | 69 TestDispatcherClient() : dispatcher_(NULL) {} |
70 virtual ~TestDispatcherClient() {} | 70 virtual ~TestDispatcherClient() {} |
71 | 71 |
72 base::MessagePumpDispatcher* dispatcher() { | 72 base::MessagePumpDispatcher* dispatcher() { |
73 return dispatcher_; | 73 return dispatcher_; |
74 } | 74 } |
75 | 75 |
76 // aura::client::DispatcherClient: | 76 // aura::client::DispatcherClient: |
77 virtual void RunWithDispatcher( | 77 virtual void RunWithDispatcher( |
78 base::MessagePumpDispatcher* dispatcher) OVERRIDE { | 78 base::MessagePumpDispatcher* dispatcher, |
| 79 base::Closure* quit_closure) OVERRIDE { |
79 base::AutoReset<base::MessagePumpDispatcher*> reset_dispatcher(&dispatcher_, | 80 base::AutoReset<base::MessagePumpDispatcher*> reset_dispatcher(&dispatcher_, |
80 dispatcher); | 81 dispatcher); |
81 base::MessageLoopForUI* loop = base::MessageLoopForUI::current(); | 82 base::MessageLoopForUI* loop = base::MessageLoopForUI::current(); |
82 base::MessageLoop::ScopedNestableTaskAllower allow(loop); | 83 base::MessageLoop::ScopedNestableTaskAllower allow(loop); |
83 base::RunLoop run_loop; | 84 base::RunLoop run_loop; |
84 quit_callback_ = run_loop.QuitClosure(); | 85 *quit_closure = run_loop.QuitClosure(); |
85 run_loop.Run(); | 86 run_loop.Run(); |
86 } | 87 } |
87 | 88 |
88 virtual void QuitNestedMessageLoop() OVERRIDE { quit_callback_.Run(); } | |
89 | |
90 private: | 89 private: |
91 base::MessagePumpDispatcher* dispatcher_; | 90 base::MessagePumpDispatcher* dispatcher_; |
92 base::Closure quit_callback_; | |
93 | 91 |
94 DISALLOW_COPY_AND_ASSIGN(TestDispatcherClient); | 92 DISALLOW_COPY_AND_ASSIGN(TestDispatcherClient); |
95 }; | 93 }; |
96 | 94 |
97 } // namespace | 95 } // namespace |
98 | 96 |
99 class MenuControllerTest : public ViewsTestBase { | 97 class MenuControllerTest : public ViewsTestBase { |
100 public: | 98 public: |
101 MenuControllerTest() : controller_(NULL) {} | 99 MenuControllerTest() : controller_(NULL) {} |
102 virtual ~MenuControllerTest() { | 100 virtual ~MenuControllerTest() { |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 FROM_HERE, | 249 FROM_HERE, |
252 base::Bind(&MenuControllerTest::DispatchEscapeAndExpect, | 250 base::Bind(&MenuControllerTest::DispatchEscapeAndExpect, |
253 base::Unretained(this), | 251 base::Unretained(this), |
254 MenuController::EXIT_NONE)); | 252 MenuController::EXIT_NONE)); |
255 RunMenu(owner.get()); | 253 RunMenu(owner.get()); |
256 } | 254 } |
257 } | 255 } |
258 #endif | 256 #endif |
259 | 257 |
260 } // namespace views | 258 } // namespace views |
OLD | NEW |