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/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
10 #include "ash/shelf/shelf_widget.h" | 10 #include "ash/shelf/shelf_widget.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 NULL, CurrentContext(), gfx::Rect(10, 10, 100, 100)); | 31 NULL, CurrentContext(), gfx::Rect(10, 10, 100, 100)); |
32 primary->Show(); | 32 primary->Show(); |
33 views::Widget* secondary = views::Widget::CreateWindowWithContextAndBounds( | 33 views::Widget* secondary = views::Widget::CreateWindowWithContextAndBounds( |
34 NULL, CurrentContext(), gfx::Rect(610, 10, 100, 100)); | 34 NULL, CurrentContext(), gfx::Rect(610, 10, 100, 100)); |
35 secondary->Show(); | 35 secondary->Show(); |
36 | 36 |
37 // Maximized bounds | 37 // Maximized bounds |
38 EXPECT_EQ("0,0 600x597", | 38 EXPECT_EQ("0,0 600x597", |
39 ScreenAsh::GetMaximizedWindowBoundsInParent( | 39 ScreenAsh::GetMaximizedWindowBoundsInParent( |
40 primary->GetNativeView()).ToString()); | 40 primary->GetNativeView()).ToString()); |
41 if (Shell::IsLauncherPerDisplayEnabled()) { | 41 EXPECT_EQ("0,0 500x452", |
42 EXPECT_EQ("0,0 500x452", | 42 ScreenAsh::GetMaximizedWindowBoundsInParent( |
43 ScreenAsh::GetMaximizedWindowBoundsInParent( | 43 secondary->GetNativeView()).ToString()); |
44 secondary->GetNativeView()).ToString()); | |
45 } else { | |
46 EXPECT_EQ("0,0 500x500", | |
47 ScreenAsh::GetMaximizedWindowBoundsInParent( | |
48 secondary->GetNativeView()).ToString()); | |
49 } | |
50 | 44 |
51 // Display bounds | 45 // Display bounds |
52 EXPECT_EQ("0,0 600x600", | 46 EXPECT_EQ("0,0 600x600", |
53 ScreenAsh::GetDisplayBoundsInParent( | 47 ScreenAsh::GetDisplayBoundsInParent( |
54 primary->GetNativeView()).ToString()); | 48 primary->GetNativeView()).ToString()); |
55 EXPECT_EQ("0,0 500x500", | 49 EXPECT_EQ("0,0 500x500", |
56 ScreenAsh::GetDisplayBoundsInParent( | 50 ScreenAsh::GetDisplayBoundsInParent( |
57 secondary->GetNativeView()).ToString()); | 51 secondary->GetNativeView()).ToString()); |
58 | 52 |
59 // Work area bounds | 53 // Work area bounds |
60 EXPECT_EQ("0,0 600x597", | 54 EXPECT_EQ("0,0 600x597", |
61 ScreenAsh::GetDisplayWorkAreaBoundsInParent( | 55 ScreenAsh::GetDisplayWorkAreaBoundsInParent( |
62 primary->GetNativeView()).ToString()); | 56 primary->GetNativeView()).ToString()); |
63 if (Shell::IsLauncherPerDisplayEnabled()) { | 57 EXPECT_EQ("0,0 500x452", |
64 EXPECT_EQ("0,0 500x452", | 58 ScreenAsh::GetDisplayWorkAreaBoundsInParent( |
65 ScreenAsh::GetDisplayWorkAreaBoundsInParent( | 59 secondary->GetNativeView()).ToString()); |
66 secondary->GetNativeView()).ToString()); | |
67 } else { | |
68 EXPECT_EQ("0,0 500x500", | |
69 ScreenAsh::GetDisplayWorkAreaBoundsInParent( | |
70 secondary->GetNativeView()).ToString()); | |
71 } | |
72 } | 60 } |
73 | 61 |
74 // Test verifies a stable handling of secondary screen widget changes | 62 // Test verifies a stable handling of secondary screen widget changes |
75 // (crbug.com/226132). | 63 // (crbug.com/226132). |
76 TEST_F(ScreenAshTest, StabilityTest) { | 64 TEST_F(ScreenAshTest, StabilityTest) { |
77 UpdateDisplay("600x600,500x500"); | 65 UpdateDisplay("600x600,500x500"); |
78 views::Widget* secondary = views::Widget::CreateWindowWithContextAndBounds( | 66 views::Widget* secondary = views::Widget::CreateWindowWithContextAndBounds( |
79 NULL, CurrentContext(), gfx::Rect(610, 10, 100, 100)); | 67 NULL, CurrentContext(), gfx::Rect(610, 10, 100, 100)); |
80 EXPECT_EQ(Shell::GetAllRootWindows()[1], | 68 EXPECT_EQ(Shell::GetAllRootWindows()[1], |
81 secondary->GetNativeView()->GetRootWindow()); | 69 secondary->GetNativeView()->GetRootWindow()); |
(...skipping 29 matching lines...) Expand all Loading... |
111 ScreenAsh::ConvertRectToScreen( | 99 ScreenAsh::ConvertRectToScreen( |
112 primary->GetNativeView(), gfx::Rect(30, 30, 100, 100)).ToString()); | 100 primary->GetNativeView(), gfx::Rect(30, 30, 100, 100)).ToString()); |
113 EXPECT_EQ( | 101 EXPECT_EQ( |
114 "650,50 100x100", | 102 "650,50 100x100", |
115 ScreenAsh::ConvertRectToScreen( | 103 ScreenAsh::ConvertRectToScreen( |
116 secondary->GetNativeView(), gfx::Rect(40, 40, 100, 100)).ToString()); | 104 secondary->GetNativeView(), gfx::Rect(40, 40, 100, 100)).ToString()); |
117 } | 105 } |
118 | 106 |
119 } // namespace test | 107 } // namespace test |
120 } // namespace ash | 108 } // namespace ash |
OLD | NEW |