| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "ash/ash_switches.h" | 8 #include "ash/ash_switches.h" |
| 9 #include "ash/display/display_manager.h" | 9 #include "ash/display/display_manager.h" |
| 10 #include "ash/launcher/launcher.h" | 10 #include "ash/launcher/launcher.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "ui/views/widget/widget.h" | 28 #include "ui/views/widget/widget.h" |
| 29 | 29 |
| 30 namespace ash { | 30 namespace ash { |
| 31 | 31 |
| 32 typedef ash::test::AshTestBase DIPTest; | 32 typedef ash::test::AshTestBase DIPTest; |
| 33 | 33 |
| 34 // Test if the WM sets correct work area under different density. | 34 // Test if the WM sets correct work area under different density. |
| 35 TEST_F(DIPTest, WorkArea) { | 35 TEST_F(DIPTest, WorkArea) { |
| 36 UpdateDisplay("1000x900*1.0f"); | 36 UpdateDisplay("1000x900*1.0f"); |
| 37 | 37 |
| 38 aura::RootWindow* root = Shell::GetPrimaryRootWindow(); | 38 aura::Window* root = Shell::GetPrimaryRootWindow(); |
| 39 const gfx::Display display = | 39 const gfx::Display display = |
| 40 Shell::GetScreen()->GetDisplayNearestWindow(root); | 40 Shell::GetScreen()->GetDisplayNearestWindow(root); |
| 41 | 41 |
| 42 EXPECT_EQ("0,0 1000x900", display.bounds().ToString()); | 42 EXPECT_EQ("0,0 1000x900", display.bounds().ToString()); |
| 43 gfx::Rect work_area = display.work_area(); | 43 gfx::Rect work_area = display.work_area(); |
| 44 EXPECT_EQ("0,0 1000x853", work_area.ToString()); | 44 EXPECT_EQ("0,0 1000x853", work_area.ToString()); |
| 45 EXPECT_EQ("0,0,47,0", display.bounds().InsetsFrom(work_area).ToString()); | 45 EXPECT_EQ("0,0,47,0", display.bounds().InsetsFrom(work_area).ToString()); |
| 46 | 46 |
| 47 UpdateDisplay("2000x1800*2.0f"); | 47 UpdateDisplay("2000x1800*2.0f"); |
| 48 gfx::Screen* screen = Shell::GetScreen(); | 48 gfx::Screen* screen = Shell::GetScreen(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 67 EXPECT_EQ( | 67 EXPECT_EQ( |
| 68 display_2x.bounds().InsetsFrom(work_area).height(), | 68 display_2x.bounds().InsetsFrom(work_area).height(), |
| 69 launcher->shelf_widget()->GetNativeView()->layer()->bounds().height()); | 69 launcher->shelf_widget()->GetNativeView()->layer()->bounds().height()); |
| 70 } | 70 } |
| 71 | 71 |
| 72 TEST_F(DIPTest, WorkAreaForLegacyShelfLayout) { | 72 TEST_F(DIPTest, WorkAreaForLegacyShelfLayout) { |
| 73 CommandLine::ForCurrentProcess()->AppendSwitch( | 73 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 74 ash::switches::kAshDisableAlternateShelfLayout); | 74 ash::switches::kAshDisableAlternateShelfLayout); |
| 75 UpdateDisplay("1000x900*1.0f"); | 75 UpdateDisplay("1000x900*1.0f"); |
| 76 | 76 |
| 77 aura::RootWindow* root = Shell::GetPrimaryRootWindow(); | 77 aura::Window* root = Shell::GetPrimaryRootWindow(); |
| 78 const gfx::Display display = | 78 const gfx::Display display = |
| 79 Shell::GetScreen()->GetDisplayNearestWindow(root); | 79 Shell::GetScreen()->GetDisplayNearestWindow(root); |
| 80 | 80 |
| 81 EXPECT_EQ("0,0 1000x900", display.bounds().ToString()); | 81 EXPECT_EQ("0,0 1000x900", display.bounds().ToString()); |
| 82 gfx::Rect work_area = display.work_area(); | 82 gfx::Rect work_area = display.work_area(); |
| 83 EXPECT_EQ("0,0 1000x852", work_area.ToString()); | 83 EXPECT_EQ("0,0 1000x852", work_area.ToString()); |
| 84 EXPECT_EQ("0,0,48,0", display.bounds().InsetsFrom(work_area).ToString()); | 84 EXPECT_EQ("0,0,48,0", display.bounds().InsetsFrom(work_area).ToString()); |
| 85 | 85 |
| 86 UpdateDisplay("2000x1800*2.0f"); | 86 UpdateDisplay("2000x1800*2.0f"); |
| 87 gfx::Screen* screen = Shell::GetScreen(); | 87 gfx::Screen* screen = Shell::GetScreen(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 102 | 102 |
| 103 // Sanity check if the workarea's inset hight is same as | 103 // Sanity check if the workarea's inset hight is same as |
| 104 // the launcher's height. | 104 // the launcher's height. |
| 105 Launcher* launcher = Launcher::ForPrimaryDisplay(); | 105 Launcher* launcher = Launcher::ForPrimaryDisplay(); |
| 106 EXPECT_EQ( | 106 EXPECT_EQ( |
| 107 display_2x.bounds().InsetsFrom(work_area).height(), | 107 display_2x.bounds().InsetsFrom(work_area).height(), |
| 108 launcher->shelf_widget()->GetNativeView()->layer()->bounds().height()); | 108 launcher->shelf_widget()->GetNativeView()->layer()->bounds().height()); |
| 109 } | 109 } |
| 110 | 110 |
| 111 } // namespace ash | 111 } // namespace ash |
| OLD | NEW |