Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1506)

Side by Side Diff: ui/wm/core/nested_accelerator_controller_unittest.cc

Issue 1402543002: Don't use base::MessageLoop::{Quit,QuitClosure} in ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/wm/core/nested_accelerator_controller.h" 5 #include "ui/wm/core/nested_accelerator_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/event_types.h" 8 #include "base/event_types.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "ui/aura/test/aura_test_base.h" 10 #include "ui/aura/test/aura_test_base.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 #elif defined(USE_X11) 87 #elif defined(USE_X11)
88 ui::ScopedXI2Event native_event; 88 ui::ScopedXI2Event native_event;
89 native_event.InitKeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_A, 0); 89 native_event.InitKeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_A, 0);
90 aura::WindowTreeHost* host = root_window->GetHost(); 90 aura::WindowTreeHost* host = root_window->GetHost();
91 aura::test::PostEventToWindowTreeHost(*native_event, host); 91 aura::test::PostEventToWindowTreeHost(*native_event, host);
92 native_event.InitKeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_A, 0); 92 native_event.InitKeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_A, 0);
93 aura::test::PostEventToWindowTreeHost(*native_event, host); 93 aura::test::PostEventToWindowTreeHost(*native_event, host);
94 #endif 94 #endif
95 // Make sure the inner message-loop terminates after dispatching the events. 95 // Make sure the inner message-loop terminates after dispatching the events.
96 base::MessageLoop::current()->PostTask( 96 base::MessageLoop::current()->PostTask(
97 FROM_HERE, base::MessageLoop::current()->QuitClosure()); 97 FROM_HERE, base::MessageLoop::current()->QuitWhenIdleClosure());
98 } 98 }
99 99
100 class MockNestedAcceleratorDelegate : public NestedAcceleratorDelegate { 100 class MockNestedAcceleratorDelegate : public NestedAcceleratorDelegate {
101 public: 101 public:
102 MockNestedAcceleratorDelegate() 102 MockNestedAcceleratorDelegate()
103 : accelerator_manager_(new ui::AcceleratorManager) {} 103 : accelerator_manager_(new ui::AcceleratorManager) {}
104 ~MockNestedAcceleratorDelegate() override {} 104 ~MockNestedAcceleratorDelegate() override {}
105 105
106 // NestedAcceleratorDelegate: 106 // NestedAcceleratorDelegate:
107 Result ProcessAccelerator(const ui::Accelerator& accelerator) override { 107 Result ProcessAccelerator(const ui::Accelerator& accelerator) override {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 &inner_dispatcher); 197 &inner_dispatcher);
198 aura::client::DispatcherRunLoop run_loop( 198 aura::client::DispatcherRunLoop run_loop(
199 aura::client::GetDispatcherClient(root_window()), NULL); 199 aura::client::GetDispatcherClient(root_window()), NULL);
200 run_loop.Run(); 200 run_loop.Run();
201 EXPECT_EQ(0, inner_dispatcher.num_key_events_dispatched()); 201 EXPECT_EQ(0, inner_dispatcher.num_key_events_dispatched());
202 EXPECT_EQ(1, target.accelerator_pressed_count()); 202 EXPECT_EQ(1, target.accelerator_pressed_count());
203 } 203 }
204 204
205 } // namespace test 205 } // namespace test
206 } // namespace wm 206 } // namespace wm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698