| 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 "ash/screen_ash.h" | 5 #include "ash/screen_ash.h" |
| 6 | 6 |
| 7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.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_util.h" | 11 #include "ash/wm/window_util.h" |
| 12 #include "ui/aura/env.h" | 12 #include "ui/aura/env.h" |
| 13 #include "ui/aura/root_window.h" | 13 #include "ui/aura/root_window.h" |
| 14 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
| 15 #include "ui/views/widget/widget.h" | 15 #include "ui/views/widget/widget.h" |
| 16 #include "ui/views/widget/widget_delegate.h" | 16 #include "ui/views/widget/widget_delegate.h" |
| 17 | 17 |
| 18 namespace ash { | 18 namespace ash { |
| 19 namespace test { | 19 namespace test { |
| 20 | 20 |
| 21 typedef test::AshTestBase ScreenAshTest; | 21 typedef test::AshTestBase ScreenAshTest; |
| 22 | 22 |
| 23 #if !defined(OS_WIN) | |
| 24 TEST_F(ScreenAshTest, Bounds) { | 23 TEST_F(ScreenAshTest, Bounds) { |
| 25 UpdateDisplay("600x600,500x500"); | 24 UpdateDisplay("600x600,500x500"); |
| 26 Shell::GetPrimaryRootWindowController()->SetShelfAutoHideBehavior( | 25 Shell::GetPrimaryRootWindowController()->SetShelfAutoHideBehavior( |
| 27 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 26 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| 28 | 27 |
| 29 views::Widget* primary = | 28 views::Widget* primary = |
| 30 views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(10, 10, 100, 100)); | 29 views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(10, 10, 100, 100)); |
| 31 primary->Show(); | 30 primary->Show(); |
| 32 views::Widget* secondary = | 31 views::Widget* secondary = |
| 33 views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(610, 10, 100, 100)); | 32 views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(610, 10, 100, 100)); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 50 secondary->GetNativeView()).ToString()); | 49 secondary->GetNativeView()).ToString()); |
| 51 | 50 |
| 52 // Work area bounds | 51 // Work area bounds |
| 53 EXPECT_EQ("0,0 600x597", | 52 EXPECT_EQ("0,0 600x597", |
| 54 ScreenAsh::GetDisplayWorkAreaBoundsInParent( | 53 ScreenAsh::GetDisplayWorkAreaBoundsInParent( |
| 55 primary->GetNativeView()).ToString()); | 54 primary->GetNativeView()).ToString()); |
| 56 EXPECT_EQ("0,0 500x500", | 55 EXPECT_EQ("0,0 500x500", |
| 57 ScreenAsh::GetDisplayWorkAreaBoundsInParent( | 56 ScreenAsh::GetDisplayWorkAreaBoundsInParent( |
| 58 secondary->GetNativeView()).ToString()); | 57 secondary->GetNativeView()).ToString()); |
| 59 } | 58 } |
| 60 #endif | |
| 61 | 59 |
| 62 TEST_F(ScreenAshTest, ConvertRect) { | 60 TEST_F(ScreenAshTest, ConvertRect) { |
| 63 UpdateDisplay("600x600,500x500"); | 61 UpdateDisplay("600x600,500x500"); |
| 64 | 62 |
| 65 views::Widget* primary = | 63 views::Widget* primary = |
| 66 views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(10, 10, 100, 100)); | 64 views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(10, 10, 100, 100)); |
| 67 primary->Show(); | 65 primary->Show(); |
| 68 views::Widget* secondary = | 66 views::Widget* secondary = |
| 69 views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(610, 10, 100, 100)); | 67 views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(610, 10, 100, 100)); |
| 70 secondary->Show(); | 68 secondary->Show(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 83 ScreenAsh::ConvertRectToScreen( | 81 ScreenAsh::ConvertRectToScreen( |
| 84 primary->GetNativeView(), gfx::Rect(30, 30, 100, 100)).ToString()); | 82 primary->GetNativeView(), gfx::Rect(30, 30, 100, 100)).ToString()); |
| 85 EXPECT_EQ( | 83 EXPECT_EQ( |
| 86 "650,50 100x100", | 84 "650,50 100x100", |
| 87 ScreenAsh::ConvertRectToScreen( | 85 ScreenAsh::ConvertRectToScreen( |
| 88 secondary->GetNativeView(), gfx::Rect(40, 40, 100, 100)).ToString()); | 86 secondary->GetNativeView(), gfx::Rect(40, 40, 100, 100)).ToString()); |
| 89 } | 87 } |
| 90 | 88 |
| 91 } // namespace test | 89 } // namespace test |
| 92 } // namespace ash | 90 } // namespace ash |
| OLD | NEW |