OLD | NEW |
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" |
11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
12 #include "ash/test/ash_test_base.h" | 12 #include "ash/test/ash_test_base.h" |
| 13 #include "ash/test/display_manager_test_api.h" |
13 #include "ash/wm/window_util.h" | 14 #include "ash/wm/window_util.h" |
14 #include "ui/aura/env.h" | 15 #include "ui/aura/env.h" |
15 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
16 #include "ui/aura/window_event_dispatcher.h" | 17 #include "ui/aura/window_event_dispatcher.h" |
17 #include "ui/views/widget/widget.h" | 18 #include "ui/views/widget/widget.h" |
18 #include "ui/views/widget/widget_delegate.h" | 19 #include "ui/views/widget/widget_delegate.h" |
19 | 20 |
20 namespace ash { | 21 namespace ash { |
21 namespace test { | 22 namespace test { |
22 | 23 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 primary->GetNativeView(), gfx::Rect(30, 30, 100, 100)).ToString()); | 110 primary->GetNativeView(), gfx::Rect(30, 30, 100, 100)).ToString()); |
110 EXPECT_EQ( | 111 EXPECT_EQ( |
111 "650,50 100x100", | 112 "650,50 100x100", |
112 ScreenUtil::ConvertRectToScreen( | 113 ScreenUtil::ConvertRectToScreen( |
113 secondary->GetNativeView(), gfx::Rect(40, 40, 100, 100)).ToString()); | 114 secondary->GetNativeView(), gfx::Rect(40, 40, 100, 100)).ToString()); |
114 } | 115 } |
115 | 116 |
116 TEST_F(ScreenUtilTest, ShelfDisplayBoundsInUnifiedDesktop) { | 117 TEST_F(ScreenUtilTest, ShelfDisplayBoundsInUnifiedDesktop) { |
117 if (!SupportsMultipleDisplays()) | 118 if (!SupportsMultipleDisplays()) |
118 return; | 119 return; |
| 120 test::DisplayManagerTestApi::EnableUnifiedDesktopForTest(); |
| 121 |
119 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 122 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
120 display_manager->SetDefaultMultiDisplayMode(DisplayManager::UNIFIED); | 123 display_manager->SetDefaultMultiDisplayMode(DisplayManager::UNIFIED); |
121 display_manager->SetMultiDisplayMode(DisplayManager::UNIFIED); | 124 display_manager->SetMultiDisplayMode(DisplayManager::UNIFIED); |
122 | 125 |
123 views::Widget* widget = views::Widget::CreateWindowWithContextAndBounds( | 126 views::Widget* widget = views::Widget::CreateWindowWithContextAndBounds( |
124 NULL, CurrentContext(), gfx::Rect(10, 10, 100, 100)); | 127 NULL, CurrentContext(), gfx::Rect(10, 10, 100, 100)); |
125 | 128 |
126 UpdateDisplay("500x400"); | 129 UpdateDisplay("500x400"); |
127 EXPECT_EQ("0,0 500x400", ScreenUtil::GetShelfDisplayBoundsInScreen( | 130 EXPECT_EQ("0,0 500x400", ScreenUtil::GetShelfDisplayBoundsInScreen( |
128 widget->GetNativeWindow()).ToString()); | 131 widget->GetNativeWindow()).ToString()); |
(...skipping 10 matching lines...) Expand all Loading... |
139 EXPECT_EQ("0,0 500x400", ScreenUtil::GetShelfDisplayBoundsInScreen( | 142 EXPECT_EQ("0,0 500x400", ScreenUtil::GetShelfDisplayBoundsInScreen( |
140 widget->GetNativeWindow()).ToString()); | 143 widget->GetNativeWindow()).ToString()); |
141 | 144 |
142 UpdateDisplay("600x500"); | 145 UpdateDisplay("600x500"); |
143 EXPECT_EQ("0,0 600x500", ScreenUtil::GetShelfDisplayBoundsInScreen( | 146 EXPECT_EQ("0,0 600x500", ScreenUtil::GetShelfDisplayBoundsInScreen( |
144 widget->GetNativeWindow()).ToString()); | 147 widget->GetNativeWindow()).ToString()); |
145 } | 148 } |
146 | 149 |
147 } // namespace test | 150 } // namespace test |
148 } // namespace ash | 151 } // namespace ash |
OLD | NEW |