| 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/wm_shelf.h" | 10 #include "ash/common/shelf/wm_shelf.h" |
| 11 #include "ash/common/wm_lookup.h" | |
| 12 #include "ash/common/wm_window.h" | 11 #include "ash/common/wm_window.h" |
| 13 #include "ash/public/cpp/shelf_types.h" | 12 #include "ash/public/cpp/shelf_types.h" |
| 14 #include "ash/public/cpp/shell_window_ids.h" | 13 #include "ash/public/cpp/shell_window_ids.h" |
| 15 #include "ash/root_window_controller.h" | 14 #include "ash/root_window_controller.h" |
| 16 #include "ash/shell.h" | 15 #include "ash/shell.h" |
| 17 #include "ash/test/ash_test_base.h" | 16 #include "ash/test/ash_test_base.h" |
| 18 #include "base/command_line.h" | 17 #include "base/command_line.h" |
| 19 #include "base/memory/ptr_util.h" | 18 #include "base/memory/ptr_util.h" |
| 20 #include "ui/display/manager/display_manager.h" | 19 #include "ui/display/manager/display_manager.h" |
| 21 #include "ui/display/screen.h" | 20 #include "ui/display/screen.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 alignment_delegate()->GetBaseLine()); | 228 alignment_delegate()->GetBaseLine()); |
| 230 } | 229 } |
| 231 | 230 |
| 232 TEST_F(AshPopupAlignmentDelegateTest, Extended) { | 231 TEST_F(AshPopupAlignmentDelegateTest, Extended) { |
| 233 UpdateDisplay("600x600,800x800"); | 232 UpdateDisplay("600x600,800x800"); |
| 234 SetAlignmentDelegate( | 233 SetAlignmentDelegate( |
| 235 base::MakeUnique<AshPopupAlignmentDelegate>(GetPrimaryShelf())); | 234 base::MakeUnique<AshPopupAlignmentDelegate>(GetPrimaryShelf())); |
| 236 | 235 |
| 237 display::Display second_display = display_manager()->GetDisplayAt(1u); | 236 display::Display second_display = display_manager()->GetDisplayAt(1u); |
| 238 WmShelf* second_shelf = | 237 WmShelf* second_shelf = |
| 239 WmLookup::Get() | 238 Shell::GetRootWindowControllerWithDisplayId(second_display.id()) |
| 240 ->GetRootWindowControllerWithDisplayId(second_display.id()) | |
| 241 ->GetShelf(); | 239 ->GetShelf(); |
| 242 AshPopupAlignmentDelegate for_2nd_display(second_shelf); | 240 AshPopupAlignmentDelegate for_2nd_display(second_shelf); |
| 243 UpdateWorkArea(&for_2nd_display, second_display); | 241 UpdateWorkArea(&for_2nd_display, second_display); |
| 244 // Make sure that the toast position on the secondary display is | 242 // Make sure that the toast position on the secondary display is |
| 245 // positioned correctly. | 243 // positioned correctly. |
| 246 EXPECT_LT(1300, for_2nd_display.GetToastOriginX(gfx::Rect(0, 0, 10, 10))); | 244 EXPECT_LT(1300, for_2nd_display.GetToastOriginX(gfx::Rect(0, 0, 10, 10))); |
| 247 EXPECT_LT(700, for_2nd_display.GetBaseLine()); | 245 EXPECT_LT(700, for_2nd_display.GetBaseLine()); |
| 248 } | 246 } |
| 249 | 247 |
| 250 TEST_F(AshPopupAlignmentDelegateTest, Unified) { | 248 TEST_F(AshPopupAlignmentDelegateTest, Unified) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 276 shelf->SetVirtualKeyboardBoundsForTesting(keyboard_bounds); | 274 shelf->SetVirtualKeyboardBoundsForTesting(keyboard_bounds); |
| 277 int keyboard_baseline = alignment_delegate()->GetBaseLine(); | 275 int keyboard_baseline = alignment_delegate()->GetBaseLine(); |
| 278 EXPECT_NE(baseline, keyboard_baseline); | 276 EXPECT_NE(baseline, keyboard_baseline); |
| 279 EXPECT_GT(keyboard_bounds.y(), keyboard_baseline); | 277 EXPECT_GT(keyboard_bounds.y(), keyboard_baseline); |
| 280 | 278 |
| 281 shelf->SetVirtualKeyboardBoundsForTesting(gfx::Rect()); | 279 shelf->SetVirtualKeyboardBoundsForTesting(gfx::Rect()); |
| 282 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine()); | 280 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine()); |
| 283 } | 281 } |
| 284 | 282 |
| 285 } // namespace ash | 283 } // namespace ash |
| OLD | NEW |