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/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
11 #include "ui/aura/env.h" | 11 #include "ui/aura/env.h" |
12 #include "ui/aura/root_window.h" | 12 #include "ui/aura/root_window.h" |
13 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
14 #include "ui/views/widget/widget.h" | 14 #include "ui/views/widget/widget.h" |
15 #include "ui/views/widget/widget_delegate.h" | 15 #include "ui/views/widget/widget_delegate.h" |
16 | 16 |
17 namespace ash { | 17 namespace ash { |
18 namespace test { | 18 namespace test { |
19 | 19 |
20 typedef test::AshTestBase ScreenAshTest; | 20 typedef test::AshTestBase ScreenAshTest; |
21 | 21 |
22 #if !defined(OS_WIN) | 22 #if !defined(OS_WIN) |
23 TEST_F(ScreenAshTest, Bounds) { | 23 TEST_F(ScreenAshTest, Bounds) { |
24 UpdateDisplay("600x600,500x500"); | 24 UpdateDisplay("600x600,500x500"); |
| 25 Shell::GetInstance()->SetShelfAutoHideBehavior( |
| 26 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
25 | 27 |
26 views::Widget* primary = | 28 views::Widget* primary = |
27 views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(10, 10, 100, 100)); | 29 views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(10, 10, 100, 100)); |
28 primary->Show(); | 30 primary->Show(); |
29 views::Widget* secondary = | 31 views::Widget* secondary = |
30 views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(610, 10, 100, 100)); | 32 views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(610, 10, 100, 100)); |
31 secondary->Show(); | 33 secondary->Show(); |
32 | 34 |
33 // Maximized bounds | 35 // Maximized bounds |
34 EXPECT_EQ("0,0 600x597", | 36 EXPECT_EQ("0,0 600x597", |
35 ScreenAsh::GetMaximizedWindowBoundsInParent( | 37 ScreenAsh::GetMaximizedWindowBoundsInParent( |
36 primary->GetNativeView()).ToString()); | 38 primary->GetNativeView()).ToString()); |
37 EXPECT_EQ("0,0 500x500", | 39 EXPECT_EQ("0,0 500x500", |
38 ScreenAsh::GetMaximizedWindowBoundsInParent( | 40 ScreenAsh::GetMaximizedWindowBoundsInParent( |
39 secondary->GetNativeView()).ToString()); | 41 secondary->GetNativeView()).ToString()); |
40 | 42 |
41 // Unmaximized work area bounds | 43 // Unmaximized work area bounds |
42 EXPECT_EQ("0,0 600x552", | 44 EXPECT_EQ("0,0 600x597", |
43 ScreenAsh::GetUnmaximizedWorkAreaBoundsInParent( | 45 ScreenAsh::GetUnmaximizedWorkAreaBoundsInParent( |
44 primary->GetNativeView()).ToString()); | 46 primary->GetNativeView()).ToString()); |
45 EXPECT_EQ("0,0 500x500", | 47 EXPECT_EQ("0,0 500x500", |
46 ScreenAsh::GetUnmaximizedWorkAreaBoundsInParent( | 48 ScreenAsh::GetUnmaximizedWorkAreaBoundsInParent( |
47 secondary->GetNativeView()).ToString()); | 49 secondary->GetNativeView()).ToString()); |
48 | 50 |
49 // Display bounds | 51 // Display bounds |
50 EXPECT_EQ("0,0 600x600", | 52 EXPECT_EQ("0,0 600x600", |
51 ScreenAsh::GetDisplayBoundsInParent( | 53 ScreenAsh::GetDisplayBoundsInParent( |
52 primary->GetNativeView()).ToString()); | 54 primary->GetNativeView()).ToString()); |
53 EXPECT_EQ("0,0 500x500", | 55 EXPECT_EQ("0,0 500x500", |
54 ScreenAsh::GetDisplayBoundsInParent( | 56 ScreenAsh::GetDisplayBoundsInParent( |
55 secondary->GetNativeView()).ToString()); | 57 secondary->GetNativeView()).ToString()); |
56 | 58 |
57 // Work area bounds | 59 // Work area bounds |
58 EXPECT_EQ("0,0 600x552", | 60 EXPECT_EQ("0,0 600x597", |
59 ScreenAsh::GetDisplayWorkAreaBoundsInParent( | 61 ScreenAsh::GetDisplayWorkAreaBoundsInParent( |
60 primary->GetNativeView()).ToString()); | 62 primary->GetNativeView()).ToString()); |
61 EXPECT_EQ("0,0 500x500", | 63 EXPECT_EQ("0,0 500x500", |
62 ScreenAsh::GetDisplayWorkAreaBoundsInParent( | 64 ScreenAsh::GetDisplayWorkAreaBoundsInParent( |
63 secondary->GetNativeView()).ToString()); | 65 secondary->GetNativeView()).ToString()); |
64 } | 66 } |
65 #endif | 67 #endif |
66 | 68 |
67 TEST_F(ScreenAshTest, ConvertRect) { | 69 TEST_F(ScreenAshTest, ConvertRect) { |
68 UpdateDisplay("600x600,500x500"); | 70 UpdateDisplay("600x600,500x500"); |
(...skipping 19 matching lines...) Expand all Loading... |
88 ScreenAsh::ConvertRectToScreen( | 90 ScreenAsh::ConvertRectToScreen( |
89 primary->GetNativeView(), gfx::Rect(30, 30, 100, 100)).ToString()); | 91 primary->GetNativeView(), gfx::Rect(30, 30, 100, 100)).ToString()); |
90 EXPECT_EQ( | 92 EXPECT_EQ( |
91 "650,50 100x100", | 93 "650,50 100x100", |
92 ScreenAsh::ConvertRectToScreen( | 94 ScreenAsh::ConvertRectToScreen( |
93 secondary->GetNativeView(), gfx::Rect(40, 40, 100, 100)).ToString()); | 95 secondary->GetNativeView(), gfx::Rect(40, 40, 100, 100)).ToString()); |
94 } | 96 } |
95 | 97 |
96 } // namespace test | 98 } // namespace test |
97 } // namespace ash | 99 } // namespace ash |
OLD | NEW |