| 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/shelf/shelf.h" |
| 11 #include "ash/shelf/shelf_widget.h" | 11 #include "ash/shelf/shelf_widget.h" |
| 12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 13 #include "ash/test/ash_test_base.h" | 13 #include "ash/test/ash_test_base.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/command_line.h" | 16 #include "base/command_line.h" |
| 17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 18 #include "ui/aura/client/activation_client.h" | 18 #include "ui/aura/client/activation_client.h" |
| 19 #include "ui/aura/root_window.h" | 19 #include "ui/aura/root_window.h" |
| 20 #include "ui/aura/window.h" | 20 #include "ui/aura/window.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 EXPECT_EQ("1,1 2000x1800", | 55 EXPECT_EQ("1,1 2000x1800", |
| 56 display_info_2x.bounds_in_native().ToString()); | 56 display_info_2x.bounds_in_native().ToString()); |
| 57 | 57 |
| 58 // 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. |
| 59 EXPECT_EQ("0,0 1000x900", display_2x.bounds().ToString()); | 59 EXPECT_EQ("0,0 1000x900", display_2x.bounds().ToString()); |
| 60 work_area = display_2x.work_area(); | 60 work_area = display_2x.work_area(); |
| 61 EXPECT_EQ("0,0 1000x853", work_area.ToString()); | 61 EXPECT_EQ("0,0 1000x853", work_area.ToString()); |
| 62 EXPECT_EQ("0,0,47,0", display_2x.bounds().InsetsFrom(work_area).ToString()); | 62 EXPECT_EQ("0,0,47,0", display_2x.bounds().InsetsFrom(work_area).ToString()); |
| 63 | 63 |
| 64 // Sanity check if the workarea's inset hight is same as | 64 // Sanity check if the workarea's inset hight is same as |
| 65 // the launcher's height. | 65 // the shelf's height. |
| 66 Launcher* launcher = Launcher::ForPrimaryDisplay(); | 66 Shelf* shelf = Shelf::ForPrimaryDisplay(); |
| 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 shelf->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::Window* 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); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 94 EXPECT_EQ("1,1 2000x1800", | 94 EXPECT_EQ("1,1 2000x1800", |
| 95 display_info_2x.bounds_in_native().ToString()); | 95 display_info_2x.bounds_in_native().ToString()); |
| 96 | 96 |
| 97 // Aura and views coordinates are in DIP, so they their bounds do not change. | 97 // Aura and views coordinates are in DIP, so they their bounds do not change. |
| 98 EXPECT_EQ("0,0 1000x900", display_2x.bounds().ToString()); | 98 EXPECT_EQ("0,0 1000x900", display_2x.bounds().ToString()); |
| 99 work_area = display_2x.work_area(); | 99 work_area = display_2x.work_area(); |
| 100 EXPECT_EQ("0,0 1000x852", work_area.ToString()); | 100 EXPECT_EQ("0,0 1000x852", work_area.ToString()); |
| 101 EXPECT_EQ("0,0,48,0", display_2x.bounds().InsetsFrom(work_area).ToString()); | 101 EXPECT_EQ("0,0,48,0", display_2x.bounds().InsetsFrom(work_area).ToString()); |
| 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 shelf's height. |
| 105 Launcher* launcher = Launcher::ForPrimaryDisplay(); | 105 Shelf* shelf = Shelf::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 shelf->shelf_widget()->GetNativeView()->layer()->bounds().height()); |
| 109 } | 109 } |
| 110 | 110 |
| 111 } // namespace ash | 111 } // namespace ash |
| OLD | NEW |