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

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

Issue 14295008: Add ash SessionStateDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ready for review. Created 7 years, 8 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 (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/shell.h" 7 #include "ash/shell.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"
11 #include "base/event_types.h" 11 #include "base/event_types.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "ui/aura/client/dispatcher_client.h" 13 #include "ui/aura/client/dispatcher_client.h"
14 #include "ui/aura/root_window.h" 14 #include "ui/aura/root_window.h"
15 #include "ui/aura/test/test_windows.h" 15 #include "ui/aura/test/test_windows.h"
16 #include "ui/aura/window.h" 16 #include "ui/aura/window.h"
17 #include "ui/base/accelerators/accelerator.h" 17 #include "ui/base/accelerators/accelerator.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(CreateTestWindowInShellWithId(0)); 110 scoped_ptr<aura::Window> associated_window(CreateTestWindowInShellWithId(0));
111 111
112 Shell::GetInstance()->delegate()->LockScreen(); 112 Shell::GetInstance()->session_state_delegate()->LockScreen();
113 DispatchKeyReleaseA(); 113 DispatchKeyReleaseA();
114 aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow(); 114 aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow();
115 aura::client::GetDispatcherClient(root_window)->RunWithDispatcher( 115 aura::client::GetDispatcherClient(root_window)->RunWithDispatcher(
116 &inner_dispatcher, 116 &inner_dispatcher,
117 associated_window.get(), 117 associated_window.get(),
118 true /* nestable_tasks_allowed */); 118 true /* nestable_tasks_allowed */);
119 EXPECT_EQ(0, inner_dispatcher.num_key_events_dispatched()); 119 EXPECT_EQ(0, inner_dispatcher.num_key_events_dispatched());
120 Shell::GetInstance()->delegate()->UnlockScreen(); 120 Shell::GetInstance()->session_state_delegate()->UnlockScreen();
121 } 121 }
122 122
123 // Aura window above lock screen in z order. 123 // Aura window above lock screen in z order.
124 TEST_F(NestedDispatcherTest, AssociatedWindowAboveLockScreen) { 124 TEST_F(NestedDispatcherTest, AssociatedWindowAboveLockScreen) {
125 MockDispatcher inner_dispatcher; 125 MockDispatcher inner_dispatcher;
126 126
127 scoped_ptr<aura::Window>mock_lock_container( 127 scoped_ptr<aura::Window>mock_lock_container(
128 CreateTestWindowInShellWithId(0)); 128 CreateTestWindowInShellWithId(0));
129 aura::test::CreateTestWindowWithId(0, mock_lock_container.get()); 129 aura::test::CreateTestWindowWithId(0, mock_lock_container.get());
130 scoped_ptr<aura::Window> associated_window(CreateTestWindowInShellWithId(0)); 130 scoped_ptr<aura::Window> associated_window(CreateTestWindowInShellWithId(0));
(...skipping 24 matching lines...) Expand all
155 aura::client::GetDispatcherClient(root_window)->RunWithDispatcher( 155 aura::client::GetDispatcherClient(root_window)->RunWithDispatcher(
156 &inner_dispatcher, 156 &inner_dispatcher,
157 root_window, 157 root_window,
158 true /* nestable_tasks_allowed */); 158 true /* nestable_tasks_allowed */);
159 EXPECT_EQ(0, inner_dispatcher.num_key_events_dispatched()); 159 EXPECT_EQ(0, inner_dispatcher.num_key_events_dispatched());
160 EXPECT_EQ(1, target.accelerator_pressed_count()); 160 EXPECT_EQ(1, target.accelerator_pressed_count());
161 } 161 }
162 162
163 } // namespace test 163 } // namespace test
164 } // namespace ash 164 } // namespace ash
OLDNEW
« no previous file with comments | « ash/accelerators/accelerator_controller.cc ('k') | ash/ash.gyp » ('j') | ash/ash.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698