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

Side by Side Diff: ash/screen_util_unittest.cc

Issue 1261693004: Allow dynamic enabling/disabling of unified desktop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « ash/root_window_controller_unittest.cc ('k') | ash/shelf/shelf_layout_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/screen_util.h" 5 #include "ash/screen_util.h"
6 6
7 #include "ash/display/display_manager.h" 7 #include "ash/display/display_manager.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/shelf/shelf_layout_manager.h" 9 #include "ash/shelf/shelf_layout_manager.h"
10 #include "ash/shelf/shelf_widget.h" 10 #include "ash/shelf/shelf_widget.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 primary->GetNativeView(), gfx::Rect(30, 30, 100, 100)).ToString()); 110 primary->GetNativeView(), gfx::Rect(30, 30, 100, 100)).ToString());
111 EXPECT_EQ( 111 EXPECT_EQ(
112 "650,50 100x100", 112 "650,50 100x100",
113 ScreenUtil::ConvertRectToScreen( 113 ScreenUtil::ConvertRectToScreen(
114 secondary->GetNativeView(), gfx::Rect(40, 40, 100, 100)).ToString()); 114 secondary->GetNativeView(), gfx::Rect(40, 40, 100, 100)).ToString());
115 } 115 }
116 116
117 TEST_F(ScreenUtilTest, ShelfDisplayBoundsInUnifiedDesktop) { 117 TEST_F(ScreenUtilTest, ShelfDisplayBoundsInUnifiedDesktop) {
118 if (!SupportsMultipleDisplays()) 118 if (!SupportsMultipleDisplays())
119 return; 119 return;
120 test::DisplayManagerTestApi::EnableUnifiedDesktopForTest(); 120 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
121 121
122 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 122 display_manager->SetUnifiedDesktopEnabled(true);
123 display_manager->SetDefaultMultiDisplayMode(DisplayManager::UNIFIED);
124 display_manager->SetMultiDisplayMode(DisplayManager::UNIFIED);
125 123
126 views::Widget* widget = views::Widget::CreateWindowWithContextAndBounds( 124 views::Widget* widget = views::Widget::CreateWindowWithContextAndBounds(
127 NULL, CurrentContext(), gfx::Rect(10, 10, 100, 100)); 125 NULL, CurrentContext(), gfx::Rect(10, 10, 100, 100));
128 126
129 UpdateDisplay("500x400"); 127 UpdateDisplay("500x400");
130 EXPECT_EQ("0,0 500x400", ScreenUtil::GetShelfDisplayBoundsInScreen( 128 EXPECT_EQ("0,0 500x400", ScreenUtil::GetShelfDisplayBoundsInScreen(
131 widget->GetNativeWindow()).ToString()); 129 widget->GetNativeWindow()).ToString());
132 130
133 UpdateDisplay("500x400,600x400"); 131 UpdateDisplay("500x400,600x400");
134 EXPECT_EQ("0,0 500x400", ScreenUtil::GetShelfDisplayBoundsInScreen( 132 EXPECT_EQ("0,0 500x400", ScreenUtil::GetShelfDisplayBoundsInScreen(
135 widget->GetNativeWindow()).ToString()); 133 widget->GetNativeWindow()).ToString());
136 134
137 // Move to the 2nd physical display. Shelf's display still should be 135 // Move to the 2nd physical display. Shelf's display still should be
138 // the first. 136 // the first.
139 widget->SetBounds(gfx::Rect(800, 0, 100, 100)); 137 widget->SetBounds(gfx::Rect(800, 0, 100, 100));
140 ASSERT_EQ("800,0 100x100", widget->GetWindowBoundsInScreen().ToString()); 138 ASSERT_EQ("800,0 100x100", widget->GetWindowBoundsInScreen().ToString());
141 139
142 EXPECT_EQ("0,0 500x400", ScreenUtil::GetShelfDisplayBoundsInScreen( 140 EXPECT_EQ("0,0 500x400", ScreenUtil::GetShelfDisplayBoundsInScreen(
143 widget->GetNativeWindow()).ToString()); 141 widget->GetNativeWindow()).ToString());
144 142
145 UpdateDisplay("600x500"); 143 UpdateDisplay("600x500");
146 EXPECT_EQ("0,0 600x500", ScreenUtil::GetShelfDisplayBoundsInScreen( 144 EXPECT_EQ("0,0 600x500", ScreenUtil::GetShelfDisplayBoundsInScreen(
147 widget->GetNativeWindow()).ToString()); 145 widget->GetNativeWindow()).ToString());
148 } 146 }
149 147
150 } // namespace test 148 } // namespace test
151 } // namespace ash 149 } // namespace ash
OLDNEW
« no previous file with comments | « ash/root_window_controller_unittest.cc ('k') | ash/shelf/shelf_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698