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

Unified Diff: ash/wm/shelf_layout_manager_unittest.cc

Issue 9699013: MonitorManager to manage multiple monitors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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 bfedd5a0ac6a011688a23c5c058a6e6fa3fd3594..47b6fae932cc2bebddfeb401c07df51492f84590 100644
--- a/ash/wm/shelf_layout_manager_unittest.cc
+++ b/ash/wm/shelf_layout_manager_unittest.cc
@@ -9,11 +9,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/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,12 +54,14 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) {
// Force an initial layout.
shelf->LayoutShelf();
ASSERT_TRUE(shelf->visible());
-
- const ash::ScreenAsh* screen = Shell::GetInstance()->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() + ShelfLayoutManager::kWorkspaceAreaBottomInset,
- screen->work_area_insets().bottom());
+ monitor->work_area_insets().bottom());
// Hide the shelf.
shelf->SetVisible(false);
@@ -63,7 +69,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(),
@@ -78,7 +84,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) {
StepWidgetLayerAnimatorToEnd(shelf->status());
EXPECT_TRUE(shelf->visible());
EXPECT_EQ(shelf->max_height() + ShelfLayoutManager::kWorkspaceAreaBottomInset,
- screen->work_area_insets().bottom());
+ monitor->work_area_insets().bottom());
// Make sure the bounds of the two widgets changed.
gfx::Rect launcher_bounds(shelf->launcher()->GetNativeView()->bounds());
@@ -98,14 +104,17 @@ TEST_F(ShelfLayoutManagerTest, LayoutShelfWhileAnimating) {
shelf->LayoutShelf();
ASSERT_TRUE(shelf->visible());
- const ash::ScreenAsh* screen = Shell::GetInstance()->screen();
+ const aura::MonitorManager* manager =
+ aura::Env::GetInstance()->monitor_manager();
+ const aura::Monitor* monitor =
+ manager->GetMonitorNearestWindow(Shell::GetRootWindow());
Ben Goodger (Google) 2012/03/14 17:01:26 I suspect we'll want some convenience function tha
oshima 2012/03/14 17:19:43 I'm thinking of refacotring gfx::Screen to return
// 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