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

Side by Side Diff: ash/screen_util_unittest.cc

Issue 2445583002: Relocate display_manager from ash to ui (Closed)
Patch Set: Created 4 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 unified diff | Download patch
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/common/wm/wm_screen_util.h" 7 #include "ash/common/wm/wm_screen_util.h"
8 #include "ash/common/wm_lookup.h" 8 #include "ash/common/wm_lookup.h"
9 #include "ash/common/wm_window.h" 9 #include "ash/common/wm_window.h"
10 #include "ash/display/display_manager.h"
11 #include "ash/shell.h" 10 #include "ash/shell.h"
12 #include "ash/test/ash_md_test_base.h" 11 #include "ash/test/ash_md_test_base.h"
13 #include "ash/test/display_manager_test_api.h"
14 #include "ash/wm/window_util.h" 12 #include "ash/wm/window_util.h"
15 #include "ui/aura/env.h" 13 #include "ui/aura/env.h"
16 #include "ui/aura/window.h" 14 #include "ui/aura/window.h"
17 #include "ui/aura/window_event_dispatcher.h" 15 #include "ui/aura/window_event_dispatcher.h"
16 #include "ui/display/manager/display_manager.h"
17 #include "ui/display/test/display_manager_test_api.h"
oshima 2016/10/24 19:29:16 ditto
rjkroege 2016/10/25 23:30:26 Done.
18 #include "ui/views/widget/widget.h" 18 #include "ui/views/widget/widget.h"
19 #include "ui/views/widget/widget_delegate.h" 19 #include "ui/views/widget/widget_delegate.h"
20 20
21 namespace ash { 21 namespace ash {
22 namespace test { 22 namespace test {
23 23
24 using ScreenUtilTest = AshMDTestBase; 24 using ScreenUtilTest = AshMDTestBase;
25 25
26 INSTANTIATE_TEST_CASE_P( 26 INSTANTIATE_TEST_CASE_P(
27 /* prefix intentionally left blank due to only one parameterization */, 27 /* prefix intentionally left blank due to only one parameterization */,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 .ToString()); 119 .ToString());
120 EXPECT_EQ("650,50 100x100", 120 EXPECT_EQ("650,50 100x100",
121 ScreenUtil::ConvertRectToScreen(secondary->GetNativeView(), 121 ScreenUtil::ConvertRectToScreen(secondary->GetNativeView(),
122 gfx::Rect(40, 40, 100, 100)) 122 gfx::Rect(40, 40, 100, 100))
123 .ToString()); 123 .ToString());
124 } 124 }
125 125
126 TEST_P(ScreenUtilTest, ShelfDisplayBoundsInUnifiedDesktop) { 126 TEST_P(ScreenUtilTest, ShelfDisplayBoundsInUnifiedDesktop) {
127 if (!SupportsMultipleDisplays()) 127 if (!SupportsMultipleDisplays())
128 return; 128 return;
129 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
130 129
131 display_manager->SetUnifiedDesktopEnabled(true); 130 display_manager()->SetUnifiedDesktopEnabled(true);
132 131
133 views::Widget* widget = views::Widget::CreateWindowWithContextAndBounds( 132 views::Widget* widget = views::Widget::CreateWindowWithContextAndBounds(
134 NULL, CurrentContext(), gfx::Rect(10, 10, 100, 100)); 133 NULL, CurrentContext(), gfx::Rect(10, 10, 100, 100));
135 WmWindow* window = WmLookup::Get()->GetWindowForWidget(widget); 134 WmWindow* window = WmLookup::Get()->GetWindowForWidget(widget);
136 135
137 UpdateDisplay("500x400"); 136 UpdateDisplay("500x400");
138 EXPECT_EQ("0,0 500x400", wm::GetDisplayBoundsWithShelf(window).ToString()); 137 EXPECT_EQ("0,0 500x400", wm::GetDisplayBoundsWithShelf(window).ToString());
139 138
140 UpdateDisplay("500x400,600x400"); 139 UpdateDisplay("500x400,600x400");
141 EXPECT_EQ("0,0 500x400", wm::GetDisplayBoundsWithShelf(window).ToString()); 140 EXPECT_EQ("0,0 500x400", wm::GetDisplayBoundsWithShelf(window).ToString());
142 141
143 // Move to the 2nd physical display. Shelf's display still should be 142 // Move to the 2nd physical display. Shelf's display still should be
144 // the first. 143 // the first.
145 widget->SetBounds(gfx::Rect(800, 0, 100, 100)); 144 widget->SetBounds(gfx::Rect(800, 0, 100, 100));
146 ASSERT_EQ("800,0 100x100", widget->GetWindowBoundsInScreen().ToString()); 145 ASSERT_EQ("800,0 100x100", widget->GetWindowBoundsInScreen().ToString());
147 146
148 EXPECT_EQ("0,0 500x400", wm::GetDisplayBoundsWithShelf(window).ToString()); 147 EXPECT_EQ("0,0 500x400", wm::GetDisplayBoundsWithShelf(window).ToString());
149 148
150 UpdateDisplay("600x500"); 149 UpdateDisplay("600x500");
151 EXPECT_EQ("0,0 600x500", wm::GetDisplayBoundsWithShelf(window).ToString()); 150 EXPECT_EQ("0,0 600x500", wm::GetDisplayBoundsWithShelf(window).ToString());
152 } 151 }
153 152
154 } // namespace test 153 } // namespace test
155 } // namespace ash 154 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698