| 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/common/wm/wm_screen_util.h" |
| 8 #include "ash/common/wm_lookup.h" |
| 9 #include "ash/common/wm_window.h" |
| 7 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
| 8 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 9 #include "ash/test/ash_md_test_base.h" | 12 #include "ash/test/ash_md_test_base.h" |
| 10 #include "ash/test/display_manager_test_api.h" | 13 #include "ash/test/display_manager_test_api.h" |
| 11 #include "ash/wm/window_util.h" | 14 #include "ash/wm/window_util.h" |
| 12 #include "ui/aura/env.h" | 15 #include "ui/aura/env.h" |
| 13 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
| 14 #include "ui/aura/window_event_dispatcher.h" | 17 #include "ui/aura/window_event_dispatcher.h" |
| 15 #include "ui/views/widget/widget.h" | 18 #include "ui/views/widget/widget.h" |
| 16 #include "ui/views/widget/widget_delegate.h" | 19 #include "ui/views/widget/widget_delegate.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 125 |
| 123 TEST_P(ScreenUtilTest, ShelfDisplayBoundsInUnifiedDesktop) { | 126 TEST_P(ScreenUtilTest, ShelfDisplayBoundsInUnifiedDesktop) { |
| 124 if (!SupportsMultipleDisplays()) | 127 if (!SupportsMultipleDisplays()) |
| 125 return; | 128 return; |
| 126 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 129 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 127 | 130 |
| 128 display_manager->SetUnifiedDesktopEnabled(true); | 131 display_manager->SetUnifiedDesktopEnabled(true); |
| 129 | 132 |
| 130 views::Widget* widget = views::Widget::CreateWindowWithContextAndBounds( | 133 views::Widget* widget = views::Widget::CreateWindowWithContextAndBounds( |
| 131 NULL, CurrentContext(), gfx::Rect(10, 10, 100, 100)); | 134 NULL, CurrentContext(), gfx::Rect(10, 10, 100, 100)); |
| 135 WmWindow* window = WmLookup::Get()->GetWindowForWidget(widget); |
| 132 | 136 |
| 133 UpdateDisplay("500x400"); | 137 UpdateDisplay("500x400"); |
| 134 EXPECT_EQ("0,0 500x400", | 138 EXPECT_EQ("0,0 500x400", wm::GetDisplayBoundsWithShelf(window).ToString()); |
| 135 ScreenUtil::GetShelfDisplayBoundsInRoot(widget->GetNativeWindow()) | |
| 136 .ToString()); | |
| 137 | 139 |
| 138 UpdateDisplay("500x400,600x400"); | 140 UpdateDisplay("500x400,600x400"); |
| 139 EXPECT_EQ("0,0 500x400", | 141 EXPECT_EQ("0,0 500x400", wm::GetDisplayBoundsWithShelf(window).ToString()); |
| 140 ScreenUtil::GetShelfDisplayBoundsInRoot(widget->GetNativeWindow()) | |
| 141 .ToString()); | |
| 142 | 142 |
| 143 // Move to the 2nd physical display. Shelf's display still should be | 143 // Move to the 2nd physical display. Shelf's display still should be |
| 144 // the first. | 144 // the first. |
| 145 widget->SetBounds(gfx::Rect(800, 0, 100, 100)); | 145 widget->SetBounds(gfx::Rect(800, 0, 100, 100)); |
| 146 ASSERT_EQ("800,0 100x100", widget->GetWindowBoundsInScreen().ToString()); | 146 ASSERT_EQ("800,0 100x100", widget->GetWindowBoundsInScreen().ToString()); |
| 147 | 147 |
| 148 EXPECT_EQ("0,0 500x400", | 148 EXPECT_EQ("0,0 500x400", wm::GetDisplayBoundsWithShelf(window).ToString()); |
| 149 ScreenUtil::GetShelfDisplayBoundsInRoot(widget->GetNativeWindow()) | |
| 150 .ToString()); | |
| 151 | 149 |
| 152 UpdateDisplay("600x500"); | 150 UpdateDisplay("600x500"); |
| 153 EXPECT_EQ("0,0 600x500", | 151 EXPECT_EQ("0,0 600x500", wm::GetDisplayBoundsWithShelf(window).ToString()); |
| 154 ScreenUtil::GetShelfDisplayBoundsInRoot(widget->GetNativeWindow()) | |
| 155 .ToString()); | |
| 156 } | 152 } |
| 157 | 153 |
| 158 } // namespace test | 154 } // namespace test |
| 159 } // namespace ash | 155 } // namespace ash |
| OLD | NEW |