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

Unified Diff: ash/shell_unittest.cc

Issue 2111443002: mash: Migrate SessionStateDelegate access to WmShell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: ash/shell_unittest.cc
diff --git a/ash/shell_unittest.cc b/ash/shell_unittest.cc
index 2be5b41753e5b5db3e47659ee52e33fc5c1ed247..f8419c9943745a547c878f4bbc5c9c4282fb9cb6 100644
--- a/ash/shell_unittest.cc
+++ b/ash/shell_unittest.cc
@@ -10,6 +10,7 @@
#include "ash/common/ash_switches.h"
#include "ash/common/session/session_state_delegate.h"
#include "ash/common/shell_window_ids.h"
+#include "ash/common/wm_shell.h"
#include "ash/desktop_background/desktop_background_widget_controller.h"
#include "ash/display/mouse_cursor_event_filter.h"
#include "ash/drag_drop/drag_drop_controller.h"
@@ -164,12 +165,11 @@ class ShellTest : public test::AshTestBase {
// Create a LockScreen window.
views::Widget::InitParams widget_params(
views::Widget::InitParams::TYPE_WINDOW);
- SessionStateDelegate* delegate =
- Shell::GetInstance()->session_state_delegate();
+ SessionStateDelegate* delegate = WmShell::Get()->GetSessionStateDelegate();
delegate->LockScreen();
views::Widget* lock_widget = CreateTestWindow(widget_params);
- ash::Shell::GetContainer(Shell::GetPrimaryRootWindow(),
- ash::kShellWindowId_LockScreenContainer)
+ Shell::GetContainer(Shell::GetPrimaryRootWindow(),
+ kShellWindowId_LockScreenContainer)
->AddChild(lock_widget->GetNativeView());
lock_widget->Show();
EXPECT_TRUE(delegate->IsScreenLocked());
@@ -283,18 +283,18 @@ TEST_F(ShellTest, CreateLockScreenModalWindow) {
EXPECT_TRUE(
GetDefaultContainer()->Contains(widget->GetNativeWindow()->parent()));
- Shell::GetInstance()->session_state_delegate()->LockScreen();
+ WmShell::Get()->GetSessionStateDelegate()->LockScreen();
// Create a LockScreen window.
views::Widget* lock_widget = CreateTestWindow(widget_params);
- ash::Shell::GetContainer(Shell::GetPrimaryRootWindow(),
- ash::kShellWindowId_LockScreenContainer)
+ Shell::GetContainer(Shell::GetPrimaryRootWindow(),
+ kShellWindowId_LockScreenContainer)
->AddChild(lock_widget->GetNativeView());
lock_widget->Show();
EXPECT_TRUE(lock_widget->GetNativeView()->HasFocus());
// It should be in LockScreen container.
aura::Window* lock_screen = Shell::GetContainer(
- Shell::GetPrimaryRootWindow(), ash::kShellWindowId_LockScreenContainer);
+ Shell::GetPrimaryRootWindow(), kShellWindowId_LockScreenContainer);
EXPECT_EQ(lock_screen, lock_widget->GetNativeWindow()->parent());
// Create a modal window with a lock window as parent.
@@ -306,7 +306,7 @@ TEST_F(ShellTest, CreateLockScreenModalWindow) {
// It should be in LockScreen modal container.
aura::Window* lock_modal_container =
Shell::GetContainer(Shell::GetPrimaryRootWindow(),
- ash::kShellWindowId_LockSystemModalContainer);
+ kShellWindowId_LockSystemModalContainer);
EXPECT_EQ(lock_modal_container,
lock_modal_widget->GetNativeWindow()->parent());
@@ -320,7 +320,7 @@ TEST_F(ShellTest, CreateLockScreenModalWindow) {
// It should be in non-LockScreen modal container.
aura::Window* modal_container = Shell::GetContainer(
- Shell::GetPrimaryRootWindow(), ash::kShellWindowId_SystemModalContainer);
+ Shell::GetPrimaryRootWindow(), kShellWindowId_SystemModalContainer);
EXPECT_EQ(modal_container, modal_widget->GetNativeWindow()->parent());
// Modal dialog without parent, caused crash see crbug.com/226141
@@ -340,8 +340,7 @@ TEST_F(ShellTest, CreateLockScreenModalWindow) {
}
TEST_F(ShellTest, IsScreenLocked) {
- SessionStateDelegate* delegate =
- Shell::GetInstance()->session_state_delegate();
+ SessionStateDelegate* delegate = WmShell::Get()->GetSessionStateDelegate();
delegate->LockScreen();
EXPECT_TRUE(delegate->IsScreenLocked());
delegate->UnlockScreen();
@@ -353,9 +352,8 @@ TEST_F(ShellTest, LockScreenClosesActiveMenu) {
std::unique_ptr<ui::SimpleMenuModel> menu_model(
new ui::SimpleMenuModel(&menu_delegate));
menu_model->AddItem(0, base::ASCIIToUTF16("Menu item"));
- views::Widget* widget = ash::Shell::GetPrimaryRootWindowController()
- ->wallpaper_controller()
- ->widget();
+ views::Widget* widget =
+ Shell::GetPrimaryRootWindowController()->wallpaper_controller()->widget();
std::unique_ptr<views::MenuRunner> menu_runner(
new views::MenuRunner(menu_model.get(), views::MenuRunner::CONTEXT_MENU));
@@ -450,19 +448,19 @@ TEST_F(ShellTest, ToggleAutoHide) {
wm::ActivateWindow(window.get());
Shelf* shelf = Shelf::ForPrimaryDisplay();
- shelf->SetAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
+ shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior());
- shelf->SetAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
+ shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior());
window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior());
- shelf->SetAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
+ shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior());
- shelf->SetAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
+ shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior());
}

Powered by Google App Engine
This is Rietveld 408576698