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

Side by Side Diff: ash/shell_unittest.cc

Issue 2801333002: mash: Run pre-unlock animation via SessionController (Closed)
Patch Set: fix compile Created 3 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/shell.h" 5 #include "ash/shell.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/common/session/session_controller.h" 10 #include "ash/common/session/session_controller.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 void LockScreenAndVerifyMenuClosed() { 157 void LockScreenAndVerifyMenuClosed() {
158 // Verify a menu is open before locking. 158 // Verify a menu is open before locking.
159 views::MenuController* menu_controller = 159 views::MenuController* menu_controller =
160 views::MenuController::GetActiveInstance(); 160 views::MenuController::GetActiveInstance();
161 DCHECK(menu_controller); 161 DCHECK(menu_controller);
162 EXPECT_EQ(views::MenuController::EXIT_NONE, menu_controller->exit_type()); 162 EXPECT_EQ(views::MenuController::EXIT_NONE, menu_controller->exit_type());
163 163
164 // Create a LockScreen window. 164 // Create a LockScreen window.
165 views::Widget::InitParams widget_params( 165 views::Widget::InitParams widget_params(
166 views::Widget::InitParams::TYPE_WINDOW); 166 views::Widget::InitParams::TYPE_WINDOW);
167 SessionController* controller = Shell::Get()->session_controller();
168 controller->LockScreenAndFlushForTest();
169 views::Widget* lock_widget = CreateTestWindow(widget_params); 167 views::Widget* lock_widget = CreateTestWindow(widget_params);
170 Shell::GetContainer(Shell::GetPrimaryRootWindow(), 168 Shell::GetContainer(Shell::GetPrimaryRootWindow(),
171 kShellWindowId_LockScreenContainer) 169 kShellWindowId_LockScreenContainer)
172 ->AddChild(lock_widget->GetNativeView()); 170 ->AddChild(lock_widget->GetNativeView());
173 lock_widget->Show(); 171 lock_widget->Show();
172
173 // Simulate real screen locker to change session state to LOCKED
174 // when it is shown.
175 SessionController* controller = Shell::Get()->session_controller();
176 controller->LockScreenAndFlushForTest();
177
174 EXPECT_TRUE(controller->IsScreenLocked()); 178 EXPECT_TRUE(controller->IsScreenLocked());
175 EXPECT_TRUE(lock_widget->GetNativeView()->HasFocus()); 179 EXPECT_TRUE(lock_widget->GetNativeView()->HasFocus());
176 180
177 // Verify menu is closed. 181 // Verify menu is closed.
178 EXPECT_EQ(nullptr, views::MenuController::GetActiveInstance()); 182 EXPECT_EQ(nullptr, views::MenuController::GetActiveInstance());
179 lock_widget->Close(); 183 lock_widget->Close();
180 GetSessionControllerClient()->UnlockScreen(); 184 GetSessionControllerClient()->UnlockScreen();
181 } 185 }
182 }; 186 };
183 187
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 // the case with classic-ash where embedders can separately create 515 // the case with classic-ash where embedders can separately create
512 // aura::Windows. 516 // aura::Windows.
513 if (WmShell::Get()->IsRunningInMash()) 517 if (WmShell::Get()->IsRunningInMash())
514 return; 518 return;
515 519
516 window_.reset(new aura::Window(NULL)); 520 window_.reset(new aura::Window(NULL));
517 window_->Init(ui::LAYER_NOT_DRAWN); 521 window_->Init(ui::LAYER_NOT_DRAWN);
518 } 522 }
519 523
520 } // namespace ash 524 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698