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/ash_switches.h" |
7 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
8 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
9 #include "ash/shelf/shelf_widget.h" | 10 #include "ash/shelf/shelf_widget.h" |
10 #include "ash/shell.h" | 11 #include "ash/shell.h" |
11 #include "ash/test/ash_test_base.h" | 12 #include "ash/test/ash_test_base.h" |
12 #include "ash/wm/window_util.h" | 13 #include "ash/wm/window_util.h" |
| 14 #include "base/command_line.h" |
13 #include "ui/aura/env.h" | 15 #include "ui/aura/env.h" |
14 #include "ui/aura/root_window.h" | 16 #include "ui/aura/root_window.h" |
15 #include "ui/aura/window.h" | 17 #include "ui/aura/window.h" |
16 #include "ui/views/widget/widget.h" | 18 #include "ui/views/widget/widget.h" |
17 #include "ui/views/widget/widget_delegate.h" | 19 #include "ui/views/widget/widget_delegate.h" |
18 | 20 |
19 namespace ash { | 21 namespace ash { |
20 namespace test { | 22 namespace test { |
21 | 23 |
22 typedef test::AshTestBase ScreenAshTest; | 24 typedef test::AshTestBase ScreenAshTest; |
(...skipping 10 matching lines...) Expand all Loading... |
33 NULL, CurrentContext(), gfx::Rect(10, 10, 100, 100)); | 35 NULL, CurrentContext(), gfx::Rect(10, 10, 100, 100)); |
34 primary->Show(); | 36 primary->Show(); |
35 views::Widget* secondary = views::Widget::CreateWindowWithContextAndBounds( | 37 views::Widget* secondary = views::Widget::CreateWindowWithContextAndBounds( |
36 NULL, CurrentContext(), gfx::Rect(610, 10, 100, 100)); | 38 NULL, CurrentContext(), gfx::Rect(610, 10, 100, 100)); |
37 secondary->Show(); | 39 secondary->Show(); |
38 | 40 |
39 // Maximized bounds | 41 // Maximized bounds |
40 EXPECT_EQ("0,0 600x597", | 42 EXPECT_EQ("0,0 600x597", |
41 ScreenAsh::GetMaximizedWindowBoundsInParent( | 43 ScreenAsh::GetMaximizedWindowBoundsInParent( |
42 primary->GetNativeView()).ToString()); | 44 primary->GetNativeView()).ToString()); |
43 EXPECT_EQ("0,0 500x452", | 45 EXPECT_EQ("0,0 500x453", |
44 ScreenAsh::GetMaximizedWindowBoundsInParent( | 46 ScreenAsh::GetMaximizedWindowBoundsInParent( |
45 secondary->GetNativeView()).ToString()); | 47 secondary->GetNativeView()).ToString()); |
46 | 48 |
47 // Display bounds | 49 // Display bounds |
48 EXPECT_EQ("0,0 600x600", | 50 EXPECT_EQ("0,0 600x600", |
49 ScreenAsh::GetDisplayBoundsInParent( | 51 ScreenAsh::GetDisplayBoundsInParent( |
50 primary->GetNativeView()).ToString()); | 52 primary->GetNativeView()).ToString()); |
51 EXPECT_EQ("0,0 500x500", | 53 EXPECT_EQ("0,0 500x500", |
52 ScreenAsh::GetDisplayBoundsInParent( | 54 ScreenAsh::GetDisplayBoundsInParent( |
53 secondary->GetNativeView()).ToString()); | 55 secondary->GetNativeView()).ToString()); |
54 | 56 |
55 // Work area bounds | 57 // Work area bounds |
56 EXPECT_EQ("0,0 600x597", | 58 EXPECT_EQ("0,0 600x597", |
57 ScreenAsh::GetDisplayWorkAreaBoundsInParent( | 59 ScreenAsh::GetDisplayWorkAreaBoundsInParent( |
58 primary->GetNativeView()).ToString()); | 60 primary->GetNativeView()).ToString()); |
59 EXPECT_EQ("0,0 500x452", | 61 EXPECT_EQ("0,0 500x453", |
60 ScreenAsh::GetDisplayWorkAreaBoundsInParent( | 62 ScreenAsh::GetDisplayWorkAreaBoundsInParent( |
61 secondary->GetNativeView()).ToString()); | 63 secondary->GetNativeView()).ToString()); |
62 } | 64 } |
63 | 65 |
64 // Test verifies a stable handling of secondary screen widget changes | 66 // Test verifies a stable handling of secondary screen widget changes |
65 // (crbug.com/226132). | 67 // (crbug.com/226132). |
66 TEST_F(ScreenAshTest, StabilityTest) { | 68 TEST_F(ScreenAshTest, StabilityTest) { |
67 if (!SupportsMultipleDisplays()) | 69 if (!SupportsMultipleDisplays()) |
68 return; | 70 return; |
69 | 71 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 ScreenAsh::ConvertRectToScreen( | 109 ScreenAsh::ConvertRectToScreen( |
108 primary->GetNativeView(), gfx::Rect(30, 30, 100, 100)).ToString()); | 110 primary->GetNativeView(), gfx::Rect(30, 30, 100, 100)).ToString()); |
109 EXPECT_EQ( | 111 EXPECT_EQ( |
110 "650,50 100x100", | 112 "650,50 100x100", |
111 ScreenAsh::ConvertRectToScreen( | 113 ScreenAsh::ConvertRectToScreen( |
112 secondary->GetNativeView(), gfx::Rect(40, 40, 100, 100)).ToString()); | 114 secondary->GetNativeView(), gfx::Rect(40, 40, 100, 100)).ToString()); |
113 } | 115 } |
114 | 116 |
115 } // namespace test | 117 } // namespace test |
116 } // namespace ash | 118 } // namespace ash |
OLD | NEW |