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

Unified Diff: ash/wm/shelf_layout_manager_unittest.cc

Issue 11017079: Remove Shell::shelf()|status_area_widget()|launcher() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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/wm/shelf_layout_manager_unittest.cc
diff --git a/ash/wm/shelf_layout_manager_unittest.cc b/ash/wm/shelf_layout_manager_unittest.cc
index aa2f44a8137615ca5ccfa9530d1d49cc3305114a..1f465e1436b6b274251e07dd28f17723338888c6 100644
--- a/ash/wm/shelf_layout_manager_unittest.cc
+++ b/ash/wm/shelf_layout_manager_unittest.cc
@@ -9,6 +9,7 @@
#include "ash/ash_switches.h"
#include "ash/focus_cycler.h"
#include "ash/launcher/launcher.h"
+#include "ash/root_window_controller.h"
#include "ash/screen_ash.h"
#include "ash/shell.h"
#include "ash/shell_delegate.h"
@@ -152,6 +153,10 @@ class ShelfLayoutManagerTest : public ash::test::AshTestBase {
public:
ShelfLayoutManagerTest() {}
+ ShelfLayoutManager* shelf_layout_manager() {
+ return Shell::GetPrimaryRootWindowController()->shelf();
+ }
+
void SetState(ShelfLayoutManager* shelf,
ShelfLayoutManager::VisibilityState state) {
shelf->SetState(state);
@@ -270,7 +275,7 @@ TEST_F(ShelfLayoutManagerTest, LayoutShelfWhileAnimating) {
// Makes sure the launcher is initially sized correctly.
TEST_F(ShelfLayoutManagerTest, LauncherInitiallySized) {
- Launcher* launcher = Shell::GetInstance()->launcher();
+ Launcher* launcher = Launcher::ForPrimaryDisplay();
ASSERT_TRUE(launcher);
ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManager();
ASSERT_TRUE(shelf_layout_manager);
@@ -284,7 +289,7 @@ TEST_F(ShelfLayoutManagerTest, LauncherInitiallySized) {
// Makes sure the launcher is sized when the status area changes size.
TEST_F(ShelfLayoutManagerTest, LauncherUpdatedWhenStatusAreaChangesSize) {
- Launcher* launcher = Shell::GetInstance()->launcher();
+ Launcher* launcher = Launcher::ForPrimaryDisplay();
ASSERT_TRUE(launcher);
ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManager();
ASSERT_TRUE(shelf_layout_manager);
@@ -508,7 +513,7 @@ TEST_F(ShelfLayoutManagerTest, VisibleWhenStatusOrLauncherFocused) {
// state,and toggling app list won't change shelf visibility state.
TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfVisibleState) {
Shell* shell = Shell::GetInstance();
- ShelfLayoutManager* shelf = Shell::GetInstance()->shelf();
+ ShelfLayoutManager* shelf = shelf_layout_manager();
shelf->LayoutShelf();
shell->SetShelfAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
@@ -535,7 +540,7 @@ TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfVisibleState) {
// visibility state.
TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfAutoHideState) {
Shell* shell = Shell::GetInstance();
- ShelfLayoutManager* shelf = Shell::GetInstance()->shelf();
+ ShelfLayoutManager* shelf = shelf_layout_manager();
shelf->LayoutShelf();
shell->SetShelfAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
@@ -569,7 +574,7 @@ TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfAutoHideState) {
// state, and toggling app list won't change shelf visibility state.
TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfHiddenState) {
Shell* shell = Shell::GetInstance();
- ShelfLayoutManager* shelf = Shell::GetInstance()->shelf();
+ ShelfLayoutManager* shelf = shelf_layout_manager();
// For shelf to be visible, app list is not open in initial state.
shelf->LayoutShelf();
@@ -597,7 +602,7 @@ TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfHiddenState) {
// Tests SHELF_ALIGNMENT_LEFT and SHELF_ALIGNMENT_RIGHT.
TEST_F(ShelfLayoutManagerTest, SetAlignment) {
- ShelfLayoutManager* shelf = GetShelfLayoutManager();
+ ShelfLayoutManager* shelf = shelf_layout_manager();
// Force an initial layout.
shelf->LayoutShelf();
EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
@@ -883,39 +888,39 @@ TEST_F(ShelfLayoutManagerTest, WorkAreaChangeWorkspace) {
// Confirm that the shelf is dimmed only when content is maximized and
// shelf is not autohidden.
TEST_F(ShelfLayoutManagerTest, Dimming) {
- Shell::GetInstance()->shelf()->SetAutoHideBehavior(
- SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
+ shelf_layout_manager()->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
scoped_ptr<aura::Window> w1(CreateTestWindow());
w1->Show();
wm::ActivateWindow(w1.get());
// Normal window doesn't dim shelf.
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
- EXPECT_FALSE(Shell::GetInstance()->launcher()->GetDimsShelf());
+ Launcher* launcher = Launcher::ForPrimaryDisplay();
+ EXPECT_FALSE(launcher->GetDimsShelf());
// Maximized window does.
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
- EXPECT_TRUE(Shell::GetInstance()->launcher()->GetDimsShelf());
+ EXPECT_TRUE(launcher->GetDimsShelf());
// Change back to normal stops dimming.
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
- EXPECT_FALSE(Shell::GetInstance()->launcher()->GetDimsShelf());
+ EXPECT_FALSE(launcher->GetDimsShelf());
// Changing back to maximized dims again.
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
- EXPECT_TRUE(Shell::GetInstance()->launcher()->GetDimsShelf());
+ EXPECT_TRUE(launcher->GetDimsShelf());
// Changing shelf to autohide stops dimming.
- Shell::GetInstance()->shelf()->SetAutoHideBehavior(
- SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
- EXPECT_FALSE(Shell::GetInstance()->launcher()->GetDimsShelf());
+ shelf_layout_manager()->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
+ EXPECT_FALSE(launcher->GetDimsShelf());
}
// Make sure that the shelf will not hide if the mouse is between a bubble and
// the shelf.
TEST_F(ShelfLayoutManagerTest, BubbleEnlargesShelfMouseHitArea) {
ShelfLayoutManager* shelf = GetShelfLayoutManager();
- StatusAreaWidget* status_area = Shell::GetInstance()->status_area_widget();
+ StatusAreaWidget* status_area =
+ Shell::GetPrimaryRootWindowController()->status_area_widget();
SystemTray* tray = Shell::GetInstance()->system_tray();
shelf->LayoutShelf();

Powered by Google App Engine
This is Rietveld 408576698