| Index: ash/system/web_notification/ash_popup_alignment_delegate_unittest.cc
|
| diff --git a/ash/system/web_notification/ash_popup_alignment_delegate_unittest.cc b/ash/system/web_notification/ash_popup_alignment_delegate_unittest.cc
|
| index dac435c99b43e8da7beb7606607defaa7f4b4e67..9aed9db5c007f6207e0307015f78122f944212a7 100644
|
| --- a/ash/system/web_notification/ash_popup_alignment_delegate_unittest.cc
|
| +++ b/ash/system/web_notification/ash_popup_alignment_delegate_unittest.cc
|
| @@ -8,7 +8,9 @@
|
| #include <vector>
|
|
|
| #include "ash/common/shelf/shelf_types.h"
|
| +#include "ash/common/shelf/wm_shelf.h"
|
| #include "ash/common/shell_window_ids.h"
|
| +#include "ash/common/wm_lookup.h"
|
| #include "ash/common/wm_root_window_controller.h"
|
| #include "ash/common/wm_shell.h"
|
| #include "ash/common/wm_window.h"
|
| @@ -37,8 +39,8 @@ class AshPopupAlignmentDelegateTest : public test::AshTestBase {
|
| base::CommandLine::ForCurrentProcess()->AppendSwitch(
|
| keyboard::switches::kEnableVirtualKeyboard);
|
| test::AshTestBase::SetUp();
|
| - SetAlignmentDelegate(base::WrapUnique(new AshPopupAlignmentDelegate(
|
| - Shelf::ForPrimaryDisplay()->shelf_layout_manager())));
|
| + SetAlignmentDelegate(
|
| + base::WrapUnique(new AshPopupAlignmentDelegate(GetPrimaryShelf())));
|
| }
|
|
|
| void TearDown() override {
|
| @@ -119,6 +121,8 @@ class AshPopupAlignmentDelegateTest : public test::AshTestBase {
|
|
|
| private:
|
| std::unique_ptr<AshPopupAlignmentDelegate> alignment_delegate_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(AshPopupAlignmentDelegateTest);
|
| };
|
|
|
| #if defined(OS_WIN) && !defined(USE_ASH)
|
| @@ -137,14 +141,14 @@ TEST_F(AshPopupAlignmentDelegateTest, MAYBE_ShelfAlignment) {
|
| EXPECT_FALSE(alignment_delegate()->IsTopDown());
|
| EXPECT_FALSE(alignment_delegate()->IsFromLeft());
|
|
|
| - Shelf::ForPrimaryDisplay()->SetAlignment(SHELF_ALIGNMENT_RIGHT);
|
| + GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_RIGHT);
|
| toast_point.set_x(alignment_delegate()->GetToastOriginX(toast_size));
|
| toast_point.set_y(alignment_delegate()->GetBaseLine());
|
| EXPECT_EQ(BOTTOM_RIGHT, GetPositionInDisplay(toast_point));
|
| EXPECT_FALSE(alignment_delegate()->IsTopDown());
|
| EXPECT_FALSE(alignment_delegate()->IsFromLeft());
|
|
|
| - Shelf::ForPrimaryDisplay()->SetAlignment(SHELF_ALIGNMENT_LEFT);
|
| + GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_LEFT);
|
| toast_point.set_x(alignment_delegate()->GetToastOriginX(toast_size));
|
| toast_point.set_y(alignment_delegate()->GetBaseLine());
|
| EXPECT_EQ(BOTTOM_LEFT, GetPositionInDisplay(toast_point));
|
| @@ -158,7 +162,7 @@ TEST_F(AshPopupAlignmentDelegateTest, LockScreen) {
|
|
|
| const gfx::Rect toast_size(0, 0, 10, 10);
|
|
|
| - Shelf::ForPrimaryDisplay()->SetAlignment(SHELF_ALIGNMENT_LEFT);
|
| + GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_LEFT);
|
| gfx::Point toast_point;
|
| toast_point.set_x(alignment_delegate()->GetToastOriginX(toast_size));
|
| toast_point.set_y(alignment_delegate()->GetBaseLine());
|
| @@ -207,8 +211,8 @@ TEST_F(AshPopupAlignmentDelegateTest, DockedWindow) {
|
| EXPECT_FALSE(alignment_delegate()->IsFromLeft());
|
|
|
| // Force dock to right-side
|
| - Shelf::ForPrimaryDisplay()->SetAlignment(SHELF_ALIGNMENT_LEFT);
|
| - Shelf::ForPrimaryDisplay()->SetAlignment(SHELF_ALIGNMENT_BOTTOM);
|
| + GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_LEFT);
|
| + GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_BOTTOM);
|
|
|
| // Right-side dock should not affect popup alignment
|
| EXPECT_EQ(origin_x, alignment_delegate()->GetToastOriginX(toast_size));
|
| @@ -279,12 +283,15 @@ TEST_F(AshPopupAlignmentDelegateTest, Extended) {
|
| if (!SupportsMultipleDisplays())
|
| return;
|
| UpdateDisplay("600x600,800x800");
|
| - SetAlignmentDelegate(base::WrapUnique(new AshPopupAlignmentDelegate(
|
| - Shelf::ForPrimaryDisplay()->shelf_layout_manager())));
|
| + SetAlignmentDelegate(
|
| + base::WrapUnique(new AshPopupAlignmentDelegate(GetPrimaryShelf())));
|
|
|
| display::Display second_display = ScreenUtil::GetSecondaryDisplay();
|
| - AshPopupAlignmentDelegate for_2nd_display(
|
| - Shelf::ForDisplayId(second_display.id())->shelf_layout_manager());
|
| + WmShelf* second_shelf =
|
| + WmLookup::Get()
|
| + ->GetRootWindowControllerWithDisplayId(second_display.id())
|
| + ->GetShelf();
|
| + AshPopupAlignmentDelegate for_2nd_display(second_shelf);
|
| UpdateWorkArea(&for_2nd_display, second_display);
|
| // Make sure that the toast position on the secondary display is
|
| // positioned correctly.
|
| @@ -303,8 +310,8 @@ TEST_F(AshPopupAlignmentDelegateTest, Unified) {
|
| SetAlignmentDelegate(nullptr);
|
|
|
| UpdateDisplay("600x600,800x800");
|
| - SetAlignmentDelegate(base::WrapUnique(new AshPopupAlignmentDelegate(
|
| - Shelf::ForPrimaryDisplay()->shelf_layout_manager())));
|
| + SetAlignmentDelegate(
|
| + base::WrapUnique(new AshPopupAlignmentDelegate(GetPrimaryShelf())));
|
|
|
| EXPECT_GT(600,
|
| alignment_delegate()->GetToastOriginX(gfx::Rect(0, 0, 10, 10)));
|
|
|