| 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_shell.h" | 11 #include "ash/common/wm_shell.h" |
| 13 #include "ash/common/wm_window.h" | 12 #include "ash/common/wm_window.h" |
| 14 #include "ash/public/cpp/shelf_types.h" | 13 #include "ash/public/cpp/shelf_types.h" |
| 15 #include "ash/public/cpp/shell_window_ids.h" | 14 #include "ash/public/cpp/shell_window_ids.h" |
| 16 #include "ash/root_window_controller.h" | 15 #include "ash/root_window_controller.h" |
| 17 #include "ash/shell.h" | 16 #include "ash/shell.h" |
| 18 #include "ash/test/ash_test_base.h" | 17 #include "ash/test/ash_test_base.h" |
| 19 #include "base/command_line.h" | 18 #include "base/command_line.h" |
| 20 #include "base/memory/ptr_util.h" | 19 #include "base/memory/ptr_util.h" |
| 21 #include "ui/display/manager/display_manager.h" | 20 #include "ui/display/manager/display_manager.h" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 alignment_delegate()->GetBaseLine()); | 232 alignment_delegate()->GetBaseLine()); |
| 234 } | 233 } |
| 235 | 234 |
| 236 TEST_F(AshPopupAlignmentDelegateTest, Extended) { | 235 TEST_F(AshPopupAlignmentDelegateTest, Extended) { |
| 237 UpdateDisplay("600x600,800x800"); | 236 UpdateDisplay("600x600,800x800"); |
| 238 SetAlignmentDelegate( | 237 SetAlignmentDelegate( |
| 239 base::MakeUnique<AshPopupAlignmentDelegate>(GetPrimaryShelf())); | 238 base::MakeUnique<AshPopupAlignmentDelegate>(GetPrimaryShelf())); |
| 240 | 239 |
| 241 display::Display second_display = GetSecondaryDisplay(); | 240 display::Display second_display = GetSecondaryDisplay(); |
| 242 WmShelf* second_shelf = | 241 WmShelf* second_shelf = |
| 243 WmLookup::Get() | 242 Shell::GetRootWindowControllerWithDisplayId(second_display.id()) |
| 244 ->GetRootWindowControllerWithDisplayId(second_display.id()) | |
| 245 ->GetShelf(); | 243 ->GetShelf(); |
| 246 AshPopupAlignmentDelegate for_2nd_display(second_shelf); | 244 AshPopupAlignmentDelegate for_2nd_display(second_shelf); |
| 247 UpdateWorkArea(&for_2nd_display, second_display); | 245 UpdateWorkArea(&for_2nd_display, second_display); |
| 248 // Make sure that the toast position on the secondary display is | 246 // Make sure that the toast position on the secondary display is |
| 249 // positioned correctly. | 247 // positioned correctly. |
| 250 EXPECT_LT(1300, for_2nd_display.GetToastOriginX(gfx::Rect(0, 0, 10, 10))); | 248 EXPECT_LT(1300, for_2nd_display.GetToastOriginX(gfx::Rect(0, 0, 10, 10))); |
| 251 EXPECT_LT(700, for_2nd_display.GetBaseLine()); | 249 EXPECT_LT(700, for_2nd_display.GetBaseLine()); |
| 252 } | 250 } |
| 253 | 251 |
| 254 TEST_F(AshPopupAlignmentDelegateTest, Unified) { | 252 TEST_F(AshPopupAlignmentDelegateTest, Unified) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 284 shelf->SetVirtualKeyboardBoundsForTesting(keyboard_bounds); | 282 shelf->SetVirtualKeyboardBoundsForTesting(keyboard_bounds); |
| 285 int keyboard_baseline = alignment_delegate()->GetBaseLine(); | 283 int keyboard_baseline = alignment_delegate()->GetBaseLine(); |
| 286 EXPECT_NE(baseline, keyboard_baseline); | 284 EXPECT_NE(baseline, keyboard_baseline); |
| 287 EXPECT_GT(keyboard_bounds.y(), keyboard_baseline); | 285 EXPECT_GT(keyboard_bounds.y(), keyboard_baseline); |
| 288 | 286 |
| 289 shelf->SetVirtualKeyboardBoundsForTesting(gfx::Rect()); | 287 shelf->SetVirtualKeyboardBoundsForTesting(gfx::Rect()); |
| 290 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine()); | 288 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine()); |
| 291 } | 289 } |
| 292 | 290 |
| 293 } // namespace ash | 291 } // namespace ash |
| OLD | NEW |