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

Side by Side Diff: ash/accelerators/nested_dispatcher_controller_unittest.cc

Issue 184903003: Window ownership -> WindowTreeHost (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « ash/accelerators/key_hold_detector.cc ('k') | ash/autoclick/autoclick_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ash/accelerators/accelerator_controller.h" 5 #include "ash/accelerators/accelerator_controller.h"
6 #include "ash/session_state_delegate.h" 6 #include "ash/session_state_delegate.h"
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_window_ids.h" 8 #include "ash/shell_window_ids.h"
9 #include "ash/test/ash_test_base.h" 9 #include "ash/test/ash_test_base.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // ShouldHandle() in ui/base/accelerators/accelerator_manager.cc for details. 77 // ShouldHandle() in ui/base/accelerators/accelerator_manager.cc for details.
78 #if defined(OS_WIN) 78 #if defined(OS_WIN)
79 MSG native_event_down = { NULL, WM_KEYDOWN, ui::VKEY_A, 0 }; 79 MSG native_event_down = { NULL, WM_KEYDOWN, ui::VKEY_A, 0 };
80 ash::Shell::GetPrimaryRootWindow()->host()->PostNativeEvent( 80 ash::Shell::GetPrimaryRootWindow()->host()->PostNativeEvent(
81 native_event_down); 81 native_event_down);
82 MSG native_event_up = { NULL, WM_KEYUP, ui::VKEY_A, 0 }; 82 MSG native_event_up = { NULL, WM_KEYUP, ui::VKEY_A, 0 };
83 ash::Shell::GetPrimaryRootWindow()->host()->PostNativeEvent(native_event_up); 83 ash::Shell::GetPrimaryRootWindow()->host()->PostNativeEvent(native_event_up);
84 #elif defined(USE_X11) 84 #elif defined(USE_X11)
85 ui::ScopedXI2Event native_event; 85 ui::ScopedXI2Event native_event;
86 native_event.InitKeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_A, 0); 86 native_event.InitKeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_A, 0);
87 aura::WindowEventDispatcher* dispatcher = 87 aura::WindowTreeHost* host = ash::Shell::GetPrimaryRootWindow()->GetHost();
88 ash::Shell::GetPrimaryRootWindow()->GetDispatcher(); 88 host->PostNativeEvent(native_event);
89 dispatcher->host()->PostNativeEvent(native_event);
90 native_event.InitKeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_A, 0); 89 native_event.InitKeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_A, 0);
91 dispatcher->host()->PostNativeEvent(native_event); 90 host->PostNativeEvent(native_event);
92 #endif 91 #endif
93 // Make sure the inner message-loop terminates after dispatching the events. 92 // Make sure the inner message-loop terminates after dispatching the events.
94 base::MessageLoop::current()->PostTask(FROM_HERE, 93 base::MessageLoop::current()->PostTask(FROM_HERE,
95 base::MessageLoop::current()->QuitClosure()); 94 base::MessageLoop::current()->QuitClosure());
96 } 95 }
97 96
98 } // namespace 97 } // namespace
99 98
100 typedef AshTestBase NestedDispatcherTest; 99 typedef AshTestBase NestedDispatcherTest;
101 100
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 DispatchKeyReleaseA(); 146 DispatchKeyReleaseA();
148 aura::client::GetDispatcherClient(root_window)->RunWithDispatcher( 147 aura::client::GetDispatcherClient(root_window)->RunWithDispatcher(
149 &inner_dispatcher, 148 &inner_dispatcher,
150 root_window); 149 root_window);
151 EXPECT_EQ(0, inner_dispatcher.num_key_events_dispatched()); 150 EXPECT_EQ(0, inner_dispatcher.num_key_events_dispatched());
152 EXPECT_EQ(1, target.accelerator_pressed_count()); 151 EXPECT_EQ(1, target.accelerator_pressed_count());
153 } 152 }
154 153
155 } // namespace test 154 } // namespace test
156 } // namespace ash 155 } // namespace ash
OLDNEW
« no previous file with comments | « ash/accelerators/key_hold_detector.cc ('k') | ash/autoclick/autoclick_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698