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

Side by Side Diff: ash/screen_util_unittest.cc

Issue 1116313002: Layout login/lock screen, shelf and app list inside the first display in Unified Desktop mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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/screen_util.cc ('k') | ash/shelf/shelf_layout_manager.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/root_window_controller.h" 8 #include "ash/root_window_controller.h"
8 #include "ash/shelf/shelf_layout_manager.h" 9 #include "ash/shelf/shelf_layout_manager.h"
9 #include "ash/shelf/shelf_widget.h" 10 #include "ash/shelf/shelf_widget.h"
10 #include "ash/shell.h" 11 #include "ash/shell.h"
11 #include "ash/test/ash_test_base.h" 12 #include "ash/test/ash_test_base.h"
13 #include "ash/test/display_manager_test_api.h"
12 #include "ash/wm/window_util.h" 14 #include "ash/wm/window_util.h"
13 #include "ui/aura/env.h" 15 #include "ui/aura/env.h"
14 #include "ui/aura/window.h" 16 #include "ui/aura/window.h"
15 #include "ui/aura/window_event_dispatcher.h" 17 #include "ui/aura/window_event_dispatcher.h"
16 #include "ui/views/widget/widget.h" 18 #include "ui/views/widget/widget.h"
17 #include "ui/views/widget/widget_delegate.h" 19 #include "ui/views/widget/widget_delegate.h"
18 20
19 namespace ash { 21 namespace ash {
20 namespace test { 22 namespace test {
21 23
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 EXPECT_EQ( 107 EXPECT_EQ(
106 "40,40 100x100", 108 "40,40 100x100",
107 ScreenUtil::ConvertRectToScreen( 109 ScreenUtil::ConvertRectToScreen(
108 primary->GetNativeView(), gfx::Rect(30, 30, 100, 100)).ToString()); 110 primary->GetNativeView(), gfx::Rect(30, 30, 100, 100)).ToString());
109 EXPECT_EQ( 111 EXPECT_EQ(
110 "650,50 100x100", 112 "650,50 100x100",
111 ScreenUtil::ConvertRectToScreen( 113 ScreenUtil::ConvertRectToScreen(
112 secondary->GetNativeView(), gfx::Rect(40, 40, 100, 100)).ToString()); 114 secondary->GetNativeView(), gfx::Rect(40, 40, 100, 100)).ToString());
113 } 115 }
114 116
117 TEST_F(ScreenUtilTest, ShelfDisplayBoundsInUnifiedDesktop) {
118 if (!SupportsMultipleDisplays())
119 return;
120 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
121 DisplayManagerTestApi test_api(display_manager);
122 test_api.SetDefaultMultiDisplayMode(DisplayManager::UNIFIED);
123 display_manager->SetMultiDisplayMode(DisplayManager::UNIFIED);
124
125 views::Widget* widget = views::Widget::CreateWindowWithContextAndBounds(
126 NULL, CurrentContext(), gfx::Rect(10, 10, 100, 100));
127
128 UpdateDisplay("500x400");
129 EXPECT_EQ("0,0 500x400", ScreenUtil::GetShelfDisplayBoundsInScreen(
130 widget->GetNativeWindow()).ToString());
131
132 UpdateDisplay("500x400,600x400");
133 EXPECT_EQ("0,0 500x400", ScreenUtil::GetShelfDisplayBoundsInScreen(
134 widget->GetNativeWindow()).ToString());
135
136 // Move to the 2nd physical display. Shelf's display still should be
137 // the first.
138 widget->SetBounds(gfx::Rect(800, 0, 100, 100));
139 ASSERT_EQ("800,0 100x100", widget->GetWindowBoundsInScreen().ToString());
140
141 EXPECT_EQ("0,0 500x400", ScreenUtil::GetShelfDisplayBoundsInScreen(
142 widget->GetNativeWindow()).ToString());
143
144 UpdateDisplay("600x500");
145 EXPECT_EQ("0,0 600x500", ScreenUtil::GetShelfDisplayBoundsInScreen(
146 widget->GetNativeWindow()).ToString());
147 }
148
115 } // namespace test 149 } // namespace test
116 } // namespace ash 150 } // namespace ash
OLDNEW
« no previous file with comments | « ash/screen_util.cc ('k') | ash/shelf/shelf_layout_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698