| 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) |
| 23 TEST_F(ScreenAshTest, Bounds) { | 24 TEST_F(ScreenAshTest, Bounds) { |
| 24 UpdateDisplay("600x600,500x500"); | 25 UpdateDisplay("600x600,500x500"); |
| 25 Shell::GetPrimaryRootWindowController()->SetShelfAutoHideBehavior( | 26 Shell::GetPrimaryRootWindowController()->SetShelfAutoHideBehavior( |
| 26 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 27 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| 27 | 28 |
| 28 views::Widget* primary = | 29 views::Widget* primary = |
| 29 views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(10, 10, 100, 100)); | 30 views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(10, 10, 100, 100)); |
| 30 primary->Show(); | 31 primary->Show(); |
| 31 views::Widget* secondary = | 32 views::Widget* secondary = |
| 32 views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(610, 10, 100, 100)); | 33 views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(610, 10, 100, 100)); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 49 secondary->GetNativeView()).ToString()); | 50 secondary->GetNativeView()).ToString()); |
| 50 | 51 |
| 51 // Work area bounds | 52 // Work area bounds |
| 52 EXPECT_EQ("0,0 600x597", | 53 EXPECT_EQ("0,0 600x597", |
| 53 ScreenAsh::GetDisplayWorkAreaBoundsInParent( | 54 ScreenAsh::GetDisplayWorkAreaBoundsInParent( |
| 54 primary->GetNativeView()).ToString()); | 55 primary->GetNativeView()).ToString()); |
| 55 EXPECT_EQ("0,0 500x500", | 56 EXPECT_EQ("0,0 500x500", |
| 56 ScreenAsh::GetDisplayWorkAreaBoundsInParent( | 57 ScreenAsh::GetDisplayWorkAreaBoundsInParent( |
| 57 secondary->GetNativeView()).ToString()); | 58 secondary->GetNativeView()).ToString()); |
| 58 } | 59 } |
| 60 #endif |
| 59 | 61 |
| 60 TEST_F(ScreenAshTest, ConvertRect) { | 62 TEST_F(ScreenAshTest, ConvertRect) { |
| 61 UpdateDisplay("600x600,500x500"); | 63 UpdateDisplay("600x600,500x500"); |
| 62 | 64 |
| 63 views::Widget* primary = | 65 views::Widget* primary = |
| 64 views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(10, 10, 100, 100)); | 66 views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(10, 10, 100, 100)); |
| 65 primary->Show(); | 67 primary->Show(); |
| 66 views::Widget* secondary = | 68 views::Widget* secondary = |
| 67 views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(610, 10, 100, 100)); | 69 views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(610, 10, 100, 100)); |
| 68 secondary->Show(); | 70 secondary->Show(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 81 ScreenAsh::ConvertRectToScreen( | 83 ScreenAsh::ConvertRectToScreen( |
| 82 primary->GetNativeView(), gfx::Rect(30, 30, 100, 100)).ToString()); | 84 primary->GetNativeView(), gfx::Rect(30, 30, 100, 100)).ToString()); |
| 83 EXPECT_EQ( | 85 EXPECT_EQ( |
| 84 "650,50 100x100", | 86 "650,50 100x100", |
| 85 ScreenAsh::ConvertRectToScreen( | 87 ScreenAsh::ConvertRectToScreen( |
| 86 secondary->GetNativeView(), gfx::Rect(40, 40, 100, 100)).ToString()); | 88 secondary->GetNativeView(), gfx::Rect(40, 40, 100, 100)).ToString()); |
| 87 } | 89 } |
| 88 | 90 |
| 89 } // namespace test | 91 } // namespace test |
| 90 } // namespace ash | 92 } // namespace ash |
| OLD | NEW |