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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 EXPECT_EQ("0,0 500x452", | 64 EXPECT_EQ("0,0 500x452", |
65 ScreenAsh::GetDisplayWorkAreaBoundsInParent( | 65 ScreenAsh::GetDisplayWorkAreaBoundsInParent( |
66 secondary->GetNativeView()).ToString()); | 66 secondary->GetNativeView()).ToString()); |
67 } else { | 67 } else { |
68 EXPECT_EQ("0,0 500x500", | 68 EXPECT_EQ("0,0 500x500", |
69 ScreenAsh::GetDisplayWorkAreaBoundsInParent( | 69 ScreenAsh::GetDisplayWorkAreaBoundsInParent( |
70 secondary->GetNativeView()).ToString()); | 70 secondary->GetNativeView()).ToString()); |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
| 74 // Test verifies a stable handling of secondary screen widget changes |
| 75 // (crbug.com/226132). |
| 76 TEST_F(ScreenAshTest, StabilityTest) { |
| 77 UpdateDisplay("600x600,500x500"); |
| 78 views::Widget* secondary = views::Widget::CreateWindowWithContextAndBounds( |
| 79 NULL, CurrentContext(), gfx::Rect(610, 10, 100, 100)); |
| 80 EXPECT_EQ(Shell::GetAllRootWindows()[1], |
| 81 secondary->GetNativeView()->GetRootWindow()); |
| 82 secondary->Show(); |
| 83 secondary->Maximize(); |
| 84 secondary->Show(); |
| 85 secondary->SetFullscreen(true); |
| 86 secondary->Hide(); |
| 87 secondary->Close(); |
| 88 } |
| 89 |
74 TEST_F(ScreenAshTest, ConvertRect) { | 90 TEST_F(ScreenAshTest, ConvertRect) { |
75 UpdateDisplay("600x600,500x500"); | 91 UpdateDisplay("600x600,500x500"); |
76 | 92 |
77 views::Widget* primary = views::Widget::CreateWindowWithContextAndBounds( | 93 views::Widget* primary = views::Widget::CreateWindowWithContextAndBounds( |
78 NULL, CurrentContext(), gfx::Rect(10, 10, 100, 100)); | 94 NULL, CurrentContext(), gfx::Rect(10, 10, 100, 100)); |
79 primary->Show(); | 95 primary->Show(); |
80 views::Widget* secondary = views::Widget::CreateWindowWithContextAndBounds( | 96 views::Widget* secondary = views::Widget::CreateWindowWithContextAndBounds( |
81 NULL, CurrentContext(), gfx::Rect(610, 10, 100, 100)); | 97 NULL, CurrentContext(), gfx::Rect(610, 10, 100, 100)); |
82 secondary->Show(); | 98 secondary->Show(); |
83 | 99 |
(...skipping 11 matching lines...) Expand all Loading... |
95 ScreenAsh::ConvertRectToScreen( | 111 ScreenAsh::ConvertRectToScreen( |
96 primary->GetNativeView(), gfx::Rect(30, 30, 100, 100)).ToString()); | 112 primary->GetNativeView(), gfx::Rect(30, 30, 100, 100)).ToString()); |
97 EXPECT_EQ( | 113 EXPECT_EQ( |
98 "650,50 100x100", | 114 "650,50 100x100", |
99 ScreenAsh::ConvertRectToScreen( | 115 ScreenAsh::ConvertRectToScreen( |
100 secondary->GetNativeView(), gfx::Rect(40, 40, 100, 100)).ToString()); | 116 secondary->GetNativeView(), gfx::Rect(40, 40, 100, 100)).ToString()); |
101 } | 117 } |
102 | 118 |
103 } // namespace test | 119 } // namespace test |
104 } // namespace ash | 120 } // namespace ash |
OLD | NEW |