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

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

Issue 10857021: Prepare a bunch of ash tests for workspace2. With Workspace2 you can't (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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/accelerator_filter_unittest.cc ('k') | ash/focus_cycler_unittest.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/shell.h" 6 #include "ash/shell.h"
7 #include "ash/shell_delegate.h" 7 #include "ash/shell_delegate.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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 ash::Shell::GetPrimaryRootWindow()->PostNativeEvent(ui::CreateNoopEvent()); 99 ash::Shell::GetPrimaryRootWindow()->PostNativeEvent(ui::CreateNoopEvent());
100 } 100 }
101 101
102 } // namespace 102 } // namespace
103 103
104 typedef AshTestBase NestedDispatcherTest; 104 typedef AshTestBase NestedDispatcherTest;
105 105
106 // Aura window below lock screen in z order. 106 // Aura window below lock screen in z order.
107 TEST_F(NestedDispatcherTest, AssociatedWindowBelowLockScreen) { 107 TEST_F(NestedDispatcherTest, AssociatedWindowBelowLockScreen) {
108 MockDispatcher inner_dispatcher; 108 MockDispatcher inner_dispatcher;
109 aura::Window* default_container = Shell::GetContainer(
110 Shell::GetPrimaryRootWindow(),
111 internal::kShellWindowId_DefaultContainer);
112 scoped_ptr<aura::Window> associated_window(aura::test::CreateTestWindowWithId( 109 scoped_ptr<aura::Window> associated_window(aura::test::CreateTestWindowWithId(
113 0, default_container)); 110 0, NULL));
114 111
115 Shell::GetInstance()->delegate()->LockScreen(); 112 Shell::GetInstance()->delegate()->LockScreen();
116 DispatchKeyReleaseA(); 113 DispatchKeyReleaseA();
117 aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow(); 114 aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow();
118 aura::client::GetDispatcherClient(root_window)->RunWithDispatcher( 115 aura::client::GetDispatcherClient(root_window)->RunWithDispatcher(
119 &inner_dispatcher, 116 &inner_dispatcher,
120 associated_window.get(), 117 associated_window.get(),
121 true /* nestable_tasks_allowed */); 118 true /* nestable_tasks_allowed */);
122 EXPECT_EQ(0, inner_dispatcher.num_key_events_dispatched()); 119 EXPECT_EQ(0, inner_dispatcher.num_key_events_dispatched());
123 Shell::GetInstance()->delegate()->UnlockScreen(); 120 Shell::GetInstance()->delegate()->UnlockScreen();
124 } 121 }
125 122
126 // Aura window above lock screen in z order. 123 // Aura window above lock screen in z order.
127 TEST_F(NestedDispatcherTest, AssociatedWindowAboveLockScreen) { 124 TEST_F(NestedDispatcherTest, AssociatedWindowAboveLockScreen) {
128 MockDispatcher inner_dispatcher; 125 MockDispatcher inner_dispatcher;
129 126
130 aura::Window* default_container = Shell::GetContainer(
131 Shell::GetPrimaryRootWindow(),
132 internal::kShellWindowId_DefaultContainer);
133 scoped_ptr<aura::Window>mock_lock_container( 127 scoped_ptr<aura::Window>mock_lock_container(
134 aura::test::CreateTestWindowWithId(0, default_container)); 128 aura::test::CreateTestWindowWithId(0, NULL));
135 aura::test::CreateTestWindowWithId(0, mock_lock_container.get()); 129 aura::test::CreateTestWindowWithId(0, mock_lock_container.get());
136 scoped_ptr<aura::Window>associated_window(aura::test::CreateTestWindowWithId( 130 scoped_ptr<aura::Window>associated_window(aura::test::CreateTestWindowWithId(
137 0, default_container)); 131 0, NULL));
138 EXPECT_TRUE(aura::test::WindowIsAbove(associated_window.get(), 132 EXPECT_TRUE(aura::test::WindowIsAbove(associated_window.get(),
139 mock_lock_container.get())); 133 mock_lock_container.get()));
140 134
141 DispatchKeyReleaseA(); 135 DispatchKeyReleaseA();
142 aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow(); 136 aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow();
143 aura::client::GetDispatcherClient(root_window)->RunWithDispatcher( 137 aura::client::GetDispatcherClient(root_window)->RunWithDispatcher(
144 &inner_dispatcher, 138 &inner_dispatcher,
145 associated_window.get(), 139 associated_window.get(),
146 true /* nestable_tasks_allowed */); 140 true /* nestable_tasks_allowed */);
147 EXPECT_EQ(1, inner_dispatcher.num_key_events_dispatched()); 141 EXPECT_EQ(1, inner_dispatcher.num_key_events_dispatched());
(...skipping 14 matching lines...) Expand all
162 aura::client::GetDispatcherClient(root_window)->RunWithDispatcher( 156 aura::client::GetDispatcherClient(root_window)->RunWithDispatcher(
163 &inner_dispatcher, 157 &inner_dispatcher,
164 root_window, 158 root_window,
165 true /* nestable_tasks_allowed */); 159 true /* nestable_tasks_allowed */);
166 EXPECT_EQ(0, inner_dispatcher.num_key_events_dispatched()); 160 EXPECT_EQ(0, inner_dispatcher.num_key_events_dispatched());
167 EXPECT_EQ(1, target.accelerator_pressed_count()); 161 EXPECT_EQ(1, target.accelerator_pressed_count());
168 } 162 }
169 163
170 } // namespace test 164 } // namespace test
171 } // namespace ash 165 } // namespace ash
OLDNEW
« no previous file with comments | « ash/accelerators/accelerator_filter_unittest.cc ('k') | ash/focus_cycler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698