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/launcher/launcher.h" | 8 #include "ash/launcher/launcher.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 #define MAYBE_WorkArea DISABLED_WorkArea | 32 #define MAYBE_WorkArea DISABLED_WorkArea |
33 #else | 33 #else |
34 #define MAYBE_WorkArea WorkArea | 34 #define MAYBE_WorkArea WorkArea |
35 #endif | 35 #endif |
36 | 36 |
37 // Test if the WM sets correct work area under different density. | 37 // Test if the WM sets correct work area under different density. |
38 TEST_F(DIPTest, MAYBE_WorkArea) { | 38 TEST_F(DIPTest, MAYBE_WorkArea) { |
39 ChangeDisplayConfig(1.0f, gfx::Rect(0, 0, 1000, 900)); | 39 ChangeDisplayConfig(1.0f, gfx::Rect(0, 0, 1000, 900)); |
40 | 40 |
41 aura::RootWindow* root = Shell::GetPrimaryRootWindow(); | 41 aura::RootWindow* root = Shell::GetPrimaryRootWindow(); |
42 const gfx::Display display = gfx::Screen::GetDisplayNearestWindow(root); | 42 const gfx::Display display = |
| 43 Shell::GetScreen()->GetDisplayNearestWindow(root); |
43 | 44 |
44 EXPECT_EQ("0,0 1000x900", display.bounds().ToString()); | 45 EXPECT_EQ("0,0 1000x900", display.bounds().ToString()); |
45 gfx::Rect work_area = display.work_area(); | 46 gfx::Rect work_area = display.work_area(); |
46 EXPECT_EQ("0,0 1000x852", work_area.ToString()); | 47 EXPECT_EQ("0,0 1000x852", work_area.ToString()); |
47 EXPECT_EQ("0,0,48,0", display.bounds().InsetsFrom(work_area).ToString()); | 48 EXPECT_EQ("0,0,48,0", display.bounds().InsetsFrom(work_area).ToString()); |
48 | 49 |
49 ChangeDisplayConfig(2.0f, gfx::Rect(0, 0, 2000, 1800)); | 50 ChangeDisplayConfig(2.0f, gfx::Rect(0, 0, 2000, 1800)); |
50 | 51 |
51 const gfx::Display display_2x = gfx::Screen::GetDisplayNearestWindow(root); | 52 const gfx::Display display_2x = |
| 53 Shell::GetScreen()->GetDisplayNearestWindow(root); |
52 | 54 |
53 // The |bounds_in_pixel()| should report bounds in pixel coordinate. | 55 // The |bounds_in_pixel()| should report bounds in pixel coordinate. |
54 EXPECT_EQ("0,0 2000x1800", display_2x.bounds_in_pixel().ToString()); | 56 EXPECT_EQ("0,0 2000x1800", display_2x.bounds_in_pixel().ToString()); |
55 | 57 |
56 // Aura and views coordinates are in DIP, so they their bounds do not change. | 58 // Aura and views coordinates are in DIP, so they their bounds do not change. |
57 EXPECT_EQ("0,0 1000x900", display_2x.bounds().ToString()); | 59 EXPECT_EQ("0,0 1000x900", display_2x.bounds().ToString()); |
58 work_area = display_2x.work_area(); | 60 work_area = display_2x.work_area(); |
59 EXPECT_EQ("0,0 1000x852", work_area.ToString()); | 61 EXPECT_EQ("0,0 1000x852", work_area.ToString()); |
60 EXPECT_EQ("0,0,48,0", display_2x.bounds().InsetsFrom(work_area).ToString()); | 62 EXPECT_EQ("0,0,48,0", display_2x.bounds().InsetsFrom(work_area).ToString()); |
61 | 63 |
62 // Sanity check if the workarea's inset hight is same as | 64 // Sanity check if the workarea's inset hight is same as |
63 // the launcher's height. | 65 // the launcher's height. |
64 Launcher* launcher = Shell::GetInstance()->launcher(); | 66 Launcher* launcher = Shell::GetInstance()->launcher(); |
65 EXPECT_EQ( | 67 EXPECT_EQ( |
66 display_2x.bounds().InsetsFrom(work_area).height(), | 68 display_2x.bounds().InsetsFrom(work_area).height(), |
67 launcher->widget()->GetNativeView()->layer()->bounds().height()); | 69 launcher->widget()->GetNativeView()->layer()->bounds().height()); |
68 } | 70 } |
69 | 71 |
70 } // namespace ash | 72 } // namespace ash |
OLD | NEW |