| 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/system/web_notification/ash_popup_alignment_delegate.h" | 5 #include "ash/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/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 EXPECT_FALSE(alignment_delegate()->IsFromLeft()); | 128 EXPECT_FALSE(alignment_delegate()->IsFromLeft()); |
| 129 | 129 |
| 130 Shell::GetInstance()->SetShelfAlignment( | 130 Shell::GetInstance()->SetShelfAlignment( |
| 131 SHELF_ALIGNMENT_LEFT, | 131 SHELF_ALIGNMENT_LEFT, |
| 132 Shell::GetPrimaryRootWindow()); | 132 Shell::GetPrimaryRootWindow()); |
| 133 toast_point.set_x(alignment_delegate()->GetToastOriginX(toast_size)); | 133 toast_point.set_x(alignment_delegate()->GetToastOriginX(toast_size)); |
| 134 toast_point.set_y(alignment_delegate()->GetBaseLine()); | 134 toast_point.set_y(alignment_delegate()->GetBaseLine()); |
| 135 EXPECT_EQ(BOTTOM_LEFT, GetPositionInDisplay(toast_point)); | 135 EXPECT_EQ(BOTTOM_LEFT, GetPositionInDisplay(toast_point)); |
| 136 EXPECT_FALSE(alignment_delegate()->IsTopDown()); | 136 EXPECT_FALSE(alignment_delegate()->IsTopDown()); |
| 137 EXPECT_TRUE(alignment_delegate()->IsFromLeft()); | 137 EXPECT_TRUE(alignment_delegate()->IsFromLeft()); |
| 138 | |
| 139 Shell::GetInstance()->SetShelfAlignment( | |
| 140 SHELF_ALIGNMENT_TOP, | |
| 141 Shell::GetPrimaryRootWindow()); | |
| 142 toast_point.set_x(alignment_delegate()->GetToastOriginX(toast_size)); | |
| 143 toast_point.set_y(alignment_delegate()->GetBaseLine()); | |
| 144 EXPECT_EQ(TOP_RIGHT, GetPositionInDisplay(toast_point)); | |
| 145 EXPECT_TRUE(alignment_delegate()->IsTopDown()); | |
| 146 EXPECT_FALSE(alignment_delegate()->IsFromLeft()); | |
| 147 } | 138 } |
| 148 | 139 |
| 149 TEST_F(AshPopupAlignmentDelegateTest, LockScreen) { | 140 TEST_F(AshPopupAlignmentDelegateTest, LockScreen) { |
| 150 if (!SupportsHostWindowResize()) | 141 if (!SupportsHostWindowResize()) |
| 151 return; | 142 return; |
| 152 | 143 |
| 153 const gfx::Rect toast_size(0, 0, 10, 10); | 144 const gfx::Rect toast_size(0, 0, 10, 10); |
| 154 | 145 |
| 155 Shell::GetInstance()->SetShelfAlignment( | 146 Shell::GetInstance()->SetShelfAlignment( |
| 156 SHELF_ALIGNMENT_LEFT, | 147 SHELF_ALIGNMENT_LEFT, |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 SetKeyboardBounds(keyboard_bounds); | 326 SetKeyboardBounds(keyboard_bounds); |
| 336 int keyboard_baseline = alignment_delegate()->GetBaseLine(); | 327 int keyboard_baseline = alignment_delegate()->GetBaseLine(); |
| 337 EXPECT_NE(baseline, keyboard_baseline); | 328 EXPECT_NE(baseline, keyboard_baseline); |
| 338 EXPECT_GT(keyboard_bounds.y(), keyboard_baseline); | 329 EXPECT_GT(keyboard_bounds.y(), keyboard_baseline); |
| 339 | 330 |
| 340 SetKeyboardBounds(gfx::Rect()); | 331 SetKeyboardBounds(gfx::Rect()); |
| 341 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine()); | 332 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine()); |
| 342 } | 333 } |
| 343 | 334 |
| 344 } // namespace ash | 335 } // namespace ash |
| OLD | NEW |