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/public/cpp/config.h" | 7 #include "ash/public/cpp/config.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
11 #include "ash/wm/wm_screen_util.h" | |
12 #include "ash/wm_window.h" | |
13 #include "ui/aura/env.h" | 11 #include "ui/aura/env.h" |
14 #include "ui/aura/window.h" | 12 #include "ui/aura/window.h" |
15 #include "ui/aura/window_event_dispatcher.h" | 13 #include "ui/aura/window_event_dispatcher.h" |
16 #include "ui/display/manager/display_manager.h" | 14 #include "ui/display/manager/display_manager.h" |
17 #include "ui/views/widget/widget.h" | 15 #include "ui/views/widget/widget.h" |
18 #include "ui/views/widget/widget_delegate.h" | 16 #include "ui/views/widget/widget_delegate.h" |
19 #include "ui/wm/core/coordinate_conversion.h" | 17 #include "ui/wm/core/coordinate_conversion.h" |
20 | 18 |
21 namespace ash { | 19 namespace ash { |
22 namespace test { | 20 namespace test { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 104 |
107 TEST_F(ScreenUtilTest, ShelfDisplayBoundsInUnifiedDesktop) { | 105 TEST_F(ScreenUtilTest, ShelfDisplayBoundsInUnifiedDesktop) { |
108 // TODO: requires unified desktop mode. http://crbug.com/581462. | 106 // TODO: requires unified desktop mode. http://crbug.com/581462. |
109 if (Shell::GetAshConfig() == Config::MASH) | 107 if (Shell::GetAshConfig() == Config::MASH) |
110 return; | 108 return; |
111 | 109 |
112 display_manager()->SetUnifiedDesktopEnabled(true); | 110 display_manager()->SetUnifiedDesktopEnabled(true); |
113 | 111 |
114 views::Widget* widget = views::Widget::CreateWindowWithContextAndBounds( | 112 views::Widget* widget = views::Widget::CreateWindowWithContextAndBounds( |
115 NULL, CurrentContext(), gfx::Rect(10, 10, 100, 100)); | 113 NULL, CurrentContext(), gfx::Rect(10, 10, 100, 100)); |
116 WmWindow* window = WmWindow::Get(widget->GetNativeWindow()); | 114 aura::Window* window = widget->GetNativeWindow(); |
117 | 115 |
118 UpdateDisplay("500x400"); | 116 UpdateDisplay("500x400"); |
119 EXPECT_EQ("0,0 500x400", wm::GetDisplayBoundsWithShelf(window).ToString()); | 117 EXPECT_EQ("0,0 500x400", |
| 118 ScreenUtil::GetDisplayBoundsWithShelf(window).ToString()); |
120 | 119 |
121 UpdateDisplay("500x400,600x400"); | 120 UpdateDisplay("500x400,600x400"); |
122 EXPECT_EQ("0,0 500x400", wm::GetDisplayBoundsWithShelf(window).ToString()); | 121 EXPECT_EQ("0,0 500x400", |
| 122 ScreenUtil::GetDisplayBoundsWithShelf(window).ToString()); |
123 | 123 |
124 // Move to the 2nd physical display. Shelf's display still should be | 124 // Move to the 2nd physical display. Shelf's display still should be |
125 // the first. | 125 // the first. |
126 widget->SetBounds(gfx::Rect(800, 0, 100, 100)); | 126 widget->SetBounds(gfx::Rect(800, 0, 100, 100)); |
127 ASSERT_EQ("800,0 100x100", widget->GetWindowBoundsInScreen().ToString()); | 127 ASSERT_EQ("800,0 100x100", widget->GetWindowBoundsInScreen().ToString()); |
128 | 128 |
129 EXPECT_EQ("0,0 500x400", wm::GetDisplayBoundsWithShelf(window).ToString()); | 129 EXPECT_EQ("0,0 500x400", |
| 130 ScreenUtil::GetDisplayBoundsWithShelf(window).ToString()); |
130 | 131 |
131 UpdateDisplay("600x500"); | 132 UpdateDisplay("600x500"); |
132 EXPECT_EQ("0,0 600x500", wm::GetDisplayBoundsWithShelf(window).ToString()); | 133 EXPECT_EQ("0,0 600x500", |
| 134 ScreenUtil::GetDisplayBoundsWithShelf(window).ToString()); |
133 } | 135 } |
134 | 136 |
135 } // namespace test | 137 } // namespace test |
136 } // namespace ash | 138 } // namespace ash |
OLD | NEW |