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

Unified Diff: ash/wm/shelf_layout_manager_unittest.cc

Issue 9689027: MonitorManager to manage multiple monitors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: crash fix Created 8 years, 9 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 8a83cb0915c7e29b8d68fe3cb81c5f9ffe3f3131..d54c170be210aed67a1d26c9aea87e97e131afdc 100644
--- a/ash/wm/shelf_layout_manager_unittest.cc
+++ b/ash/wm/shelf_layout_manager_unittest.cc
@@ -8,12 +8,15 @@
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "ash/test/ash_test_base.h"
+#include "ui/aura/env.h"
+#include "ui/aura/monitor.h"
+#include "ui/aura/monitor_manager.h"
#include "ui/aura/root_window.h"
-#include "ui/aura/screen_aura.h"
#include "ui/aura/window.h"
#include "ui/base/animation/animation_container_element.h"
#include "ui/gfx/compositor/layer_animator.h"
#include "ui/gfx/compositor/layer.h"
+#include "ui/gfx/screen.h"
#include "ui/views/widget/widget.h"
namespace ash {
@@ -50,11 +53,13 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) {
// Force an initial layout.
shelf->LayoutShelf();
ASSERT_TRUE(shelf->visible());
-
- const aura::ScreenAura* screen = Shell::GetRootWindow()->screen();
- ASSERT_TRUE(screen);
+ const aura::MonitorManager* manager =
+ aura::Env::GetInstance()->monitor_manager();
+ const aura::Monitor* monitor =
+ manager->GetMonitorNearestWindow(Shell::GetRootWindow());
+ ASSERT_TRUE(monitor);
// Bottom inset should be the max of widget heights.
- EXPECT_EQ(shelf->max_height(), screen->work_area_insets().bottom());
+ EXPECT_EQ(shelf->max_height(), monitor->work_area_insets().bottom());
// Hide the shelf.
shelf->SetVisible(false);
@@ -62,7 +67,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) {
StepWidgetLayerAnimatorToEnd(shelf->launcher());
StepWidgetLayerAnimatorToEnd(shelf->status());
EXPECT_FALSE(shelf->visible());
- EXPECT_EQ(0, screen->work_area_insets().bottom());
+ EXPECT_EQ(0, monitor->work_area_insets().bottom());
// Make sure the bounds of the two widgets changed.
EXPECT_GE(shelf->launcher()->GetNativeView()->bounds().y(),
@@ -76,7 +81,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) {
StepWidgetLayerAnimatorToEnd(shelf->launcher());
StepWidgetLayerAnimatorToEnd(shelf->status());
EXPECT_TRUE(shelf->visible());
- EXPECT_EQ(shelf->max_height(), screen->work_area_insets().bottom());
+ EXPECT_EQ(shelf->max_height(), monitor->work_area_insets().bottom());
// Make sure the bounds of the two widgets changed.
gfx::Rect launcher_bounds(shelf->launcher()->GetNativeView()->bounds());
@@ -96,14 +101,17 @@ TEST_F(ShelfLayoutManagerTest, LayoutShelfWhileAnimating) {
shelf->LayoutShelf();
ASSERT_TRUE(shelf->visible());
- const aura::ScreenAura* screen = Shell::GetRootWindow()->screen();
+ const aura::MonitorManager* manager =
+ aura::Env::GetInstance()->monitor_manager();
+ const aura::Monitor* monitor =
+ manager->GetMonitorNearestWindow(Shell::GetRootWindow());
// Hide the shelf.
shelf->SetVisible(false);
shelf->LayoutShelf();
EXPECT_FALSE(shelf->visible());
EXPECT_FALSE(shelf->visible());
- EXPECT_EQ(0, screen->work_area_insets().bottom());
+ EXPECT_EQ(0, monitor->work_area_insets().bottom());
// Make sure the bounds of the two widgets changed.
EXPECT_GE(shelf->launcher()->GetNativeView()->bounds().y(),
gfx::Screen::GetPrimaryMonitorBounds().bottom());

Powered by Google App Engine
This is Rietveld 408576698