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