OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/common/system/web_notification/ash_popup_alignment_delegate.h" | 5 #include "ash/common/system/web_notification/ash_popup_alignment_delegate.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/common/shelf/shelf_types.h" | 10 #include "ash/common/shelf/shelf_types.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 118 |
119 GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_LEFT); | 119 GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_LEFT); |
120 toast_point.set_x(alignment_delegate()->GetToastOriginX(toast_size)); | 120 toast_point.set_x(alignment_delegate()->GetToastOriginX(toast_size)); |
121 toast_point.set_y(alignment_delegate()->GetBaseLine()); | 121 toast_point.set_y(alignment_delegate()->GetBaseLine()); |
122 EXPECT_EQ(BOTTOM_LEFT, GetPositionInDisplay(toast_point)); | 122 EXPECT_EQ(BOTTOM_LEFT, GetPositionInDisplay(toast_point)); |
123 EXPECT_FALSE(alignment_delegate()->IsTopDown()); | 123 EXPECT_FALSE(alignment_delegate()->IsTopDown()); |
124 EXPECT_TRUE(alignment_delegate()->IsFromLeft()); | 124 EXPECT_TRUE(alignment_delegate()->IsFromLeft()); |
125 } | 125 } |
126 | 126 |
127 TEST_F(AshPopupAlignmentDelegateTest, LockScreen) { | 127 TEST_F(AshPopupAlignmentDelegateTest, LockScreen) { |
128 if (!SupportsHostWindowResize()) | |
129 return; | |
130 | |
131 const gfx::Rect toast_size(0, 0, 10, 10); | 128 const gfx::Rect toast_size(0, 0, 10, 10); |
132 | 129 |
133 GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_LEFT); | 130 GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_LEFT); |
134 gfx::Point toast_point; | 131 gfx::Point toast_point; |
135 toast_point.set_x(alignment_delegate()->GetToastOriginX(toast_size)); | 132 toast_point.set_x(alignment_delegate()->GetToastOriginX(toast_size)); |
136 toast_point.set_y(alignment_delegate()->GetBaseLine()); | 133 toast_point.set_y(alignment_delegate()->GetBaseLine()); |
137 EXPECT_EQ(BOTTOM_LEFT, GetPositionInDisplay(toast_point)); | 134 EXPECT_EQ(BOTTOM_LEFT, GetPositionInDisplay(toast_point)); |
138 EXPECT_FALSE(alignment_delegate()->IsTopDown()); | 135 EXPECT_FALSE(alignment_delegate()->IsTopDown()); |
139 EXPECT_TRUE(alignment_delegate()->IsFromLeft()); | 136 EXPECT_TRUE(alignment_delegate()->IsFromLeft()); |
140 | 137 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 shelf->SetVirtualKeyboardBoundsForTesting(keyboard_bounds); | 304 shelf->SetVirtualKeyboardBoundsForTesting(keyboard_bounds); |
308 int keyboard_baseline = alignment_delegate()->GetBaseLine(); | 305 int keyboard_baseline = alignment_delegate()->GetBaseLine(); |
309 EXPECT_NE(baseline, keyboard_baseline); | 306 EXPECT_NE(baseline, keyboard_baseline); |
310 EXPECT_GT(keyboard_bounds.y(), keyboard_baseline); | 307 EXPECT_GT(keyboard_bounds.y(), keyboard_baseline); |
311 | 308 |
312 shelf->SetVirtualKeyboardBoundsForTesting(gfx::Rect()); | 309 shelf->SetVirtualKeyboardBoundsForTesting(gfx::Rect()); |
313 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine()); | 310 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine()); |
314 } | 311 } |
315 | 312 |
316 } // namespace ash | 313 } // namespace ash |
OLD | NEW |