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

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

Issue 11421006: Desktop aura: Break aura::Window::SetParent in two. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ash_unittests Created 8 years 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
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 ash::Shell::GetPrimaryRootWindow()->PostNativeEvent(ui::CreateNoopEvent()); 100 ash::Shell::GetPrimaryRootWindow()->PostNativeEvent(ui::CreateNoopEvent());
101 } 101 }
102 102
103 } // namespace 103 } // namespace
104 104
105 typedef AshTestBase NestedDispatcherTest; 105 typedef AshTestBase NestedDispatcherTest;
106 106
107 // Aura window below lock screen in z order. 107 // Aura window below lock screen in z order.
108 TEST_F(NestedDispatcherTest, AssociatedWindowBelowLockScreen) { 108 TEST_F(NestedDispatcherTest, AssociatedWindowBelowLockScreen) {
109 MockDispatcher inner_dispatcher; 109 MockDispatcher inner_dispatcher;
110 scoped_ptr<aura::Window> associated_window(aura::test::CreateTestWindowWithId( 110 scoped_ptr<aura::Window> associated_window(CreateTestWindowInShellWithId(0));
111 0, NULL));
112 111
113 Shell::GetInstance()->delegate()->LockScreen(); 112 Shell::GetInstance()->delegate()->LockScreen();
114 DispatchKeyReleaseA(); 113 DispatchKeyReleaseA();
115 aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow(); 114 aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow();
116 aura::client::GetDispatcherClient(root_window)->RunWithDispatcher( 115 aura::client::GetDispatcherClient(root_window)->RunWithDispatcher(
117 &inner_dispatcher, 116 &inner_dispatcher,
118 associated_window.get(), 117 associated_window.get(),
119 true /* nestable_tasks_allowed */); 118 true /* nestable_tasks_allowed */);
120 EXPECT_EQ(0, inner_dispatcher.num_key_events_dispatched()); 119 EXPECT_EQ(0, inner_dispatcher.num_key_events_dispatched());
121 Shell::GetInstance()->delegate()->UnlockScreen(); 120 Shell::GetInstance()->delegate()->UnlockScreen();
122 } 121 }
123 122
124 // Aura window above lock screen in z order. 123 // Aura window above lock screen in z order.
125 TEST_F(NestedDispatcherTest, AssociatedWindowAboveLockScreen) { 124 TEST_F(NestedDispatcherTest, AssociatedWindowAboveLockScreen) {
126 MockDispatcher inner_dispatcher; 125 MockDispatcher inner_dispatcher;
127 126
128 scoped_ptr<aura::Window>mock_lock_container( 127 scoped_ptr<aura::Window>mock_lock_container(
129 aura::test::CreateTestWindowWithId(0, NULL)); 128 CreateTestWindowInShellWithId(0));
130 aura::test::CreateTestWindowWithId(0, mock_lock_container.get()); 129 aura::test::CreateTestWindowWithId(0, mock_lock_container.get());
131 scoped_ptr<aura::Window>associated_window(aura::test::CreateTestWindowWithId( 130 scoped_ptr<aura::Window> associated_window(CreateTestWindowInShellWithId(0));
132 0, NULL));
133 EXPECT_TRUE(aura::test::WindowIsAbove(associated_window.get(), 131 EXPECT_TRUE(aura::test::WindowIsAbove(associated_window.get(),
134 mock_lock_container.get())); 132 mock_lock_container.get()));
135 133
136 DispatchKeyReleaseA(); 134 DispatchKeyReleaseA();
137 aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow(); 135 aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow();
138 aura::client::GetDispatcherClient(root_window)->RunWithDispatcher( 136 aura::client::GetDispatcherClient(root_window)->RunWithDispatcher(
139 &inner_dispatcher, 137 &inner_dispatcher,
140 associated_window.get(), 138 associated_window.get(),
141 true /* nestable_tasks_allowed */); 139 true /* nestable_tasks_allowed */);
142 EXPECT_EQ(1, inner_dispatcher.num_key_events_dispatched()); 140 EXPECT_EQ(1, inner_dispatcher.num_key_events_dispatched());
(...skipping 14 matching lines...) Expand all
157 aura::client::GetDispatcherClient(root_window)->RunWithDispatcher( 155 aura::client::GetDispatcherClient(root_window)->RunWithDispatcher(
158 &inner_dispatcher, 156 &inner_dispatcher,
159 root_window, 157 root_window,
160 true /* nestable_tasks_allowed */); 158 true /* nestable_tasks_allowed */);
161 EXPECT_EQ(0, inner_dispatcher.num_key_events_dispatched()); 159 EXPECT_EQ(0, inner_dispatcher.num_key_events_dispatched());
162 EXPECT_EQ(1, target.accelerator_pressed_count()); 160 EXPECT_EQ(1, target.accelerator_pressed_count());
163 } 161 }
164 162
165 } // namespace test 163 } // namespace test
166 } // namespace ash 164 } // namespace ash
OLDNEW
« no previous file with comments | « ash/accelerators/accelerator_filter_unittest.cc ('k') | ash/display/screen_position_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698