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" |
11 #include "ash/wm/window_properties.h" | 11 #include "ash/wm/window_properties.h" |
12 #include "ash/wm/window_util.h" | 12 #include "ash/wm/window_util.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "ui/aura/client/activation_client.h" | 14 #include "ui/aura/client/activation_client.h" |
15 #include "ui/aura/root_window.h" | 15 #include "ui/aura/root_window.h" |
16 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
17 #include "ui/compositor/layer.h" | 17 #include "ui/compositor/layer.h" |
18 #include "ui/gfx/display.h" | 18 #include "ui/gfx/display.h" |
19 #include "ui/gfx/insets.h" | 19 #include "ui/gfx/insets.h" |
20 #include "ui/gfx/screen.h" | 20 #include "ui/gfx/screen.h" |
21 #include "ui/views/corewm/shadow.h" | 21 #include "ui/views/corewm/shadow.h" |
22 #include "ui/views/corewm/shadow_controller.h" | 22 #include "ui/views/corewm/shadow_controller.h" |
23 #include "ui/views/corewm/shadow_types.h" | 23 #include "ui/views/corewm/shadow_types.h" |
24 #include "ui/views/widget/widget.h" | 24 #include "ui/views/widget/widget.h" |
25 | 25 |
26 namespace ash { | 26 namespace ash { |
27 | 27 |
28 typedef ash::test::AshTestBase DIPTest; | 28 typedef ash::test::AshTestBase DIPTest; |
29 | 29 |
30 #if defined(OS_WIN) | |
31 // Windows/Aura doesn't have DIP support in display yet. | |
32 #define MAYBE_WorkArea DISABLED_WorkArea | |
33 #else | |
34 #define MAYBE_WorkArea WorkArea | |
35 #endif | |
36 | |
37 // Test if the WM sets correct work area under different density. | 30 // Test if the WM sets correct work area under different density. |
38 TEST_F(DIPTest, MAYBE_WorkArea) { | 31 TEST_F(DIPTest, WorkArea) { |
39 ChangeDisplayConfig(1.0f, gfx::Rect(0, 0, 1000, 900)); | 32 ChangeDisplayConfig(1.0f, gfx::Rect(0, 0, 1000, 900)); |
40 | 33 |
41 aura::RootWindow* root = Shell::GetPrimaryRootWindow(); | 34 aura::RootWindow* root = Shell::GetPrimaryRootWindow(); |
42 const gfx::Display display = | 35 const gfx::Display display = |
43 Shell::GetScreen()->GetDisplayNearestWindow(root); | 36 Shell::GetScreen()->GetDisplayNearestWindow(root); |
44 | 37 |
45 EXPECT_EQ("0,0 1000x900", display.bounds().ToString()); | 38 EXPECT_EQ("0,0 1000x900", display.bounds().ToString()); |
46 gfx::Rect work_area = display.work_area(); | 39 gfx::Rect work_area = display.work_area(); |
47 EXPECT_EQ("0,0 1000x852", work_area.ToString()); | 40 EXPECT_EQ("0,0 1000x852", work_area.ToString()); |
48 EXPECT_EQ("0,0,48,0", display.bounds().InsetsFrom(work_area).ToString()); | 41 EXPECT_EQ("0,0,48,0", display.bounds().InsetsFrom(work_area).ToString()); |
(...skipping 14 matching lines...) Expand all Loading... |
63 | 56 |
64 // Sanity check if the workarea's inset hight is same as | 57 // Sanity check if the workarea's inset hight is same as |
65 // the launcher's height. | 58 // the launcher's height. |
66 Launcher* launcher = Launcher::ForPrimaryDisplay(); | 59 Launcher* launcher = Launcher::ForPrimaryDisplay(); |
67 EXPECT_EQ( | 60 EXPECT_EQ( |
68 display_2x.bounds().InsetsFrom(work_area).height(), | 61 display_2x.bounds().InsetsFrom(work_area).height(), |
69 launcher->widget()->GetNativeView()->layer()->bounds().height()); | 62 launcher->widget()->GetNativeView()->layer()->bounds().height()); |
70 } | 63 } |
71 | 64 |
72 } // namespace ash | 65 } // namespace ash |
OLD | NEW |