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..729fe326df82e3ce4d5b61cca0786218e73be9cd 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" |
@@ -27,6 +29,17 @@ |
#include "ui/message_center/message_center_style.h" |
namespace ash { |
+namespace { |
+ |
+// Returns the shelf for the primary display. |
+WmShelf* GetPrimaryShelf() { |
msw
2016/06/16 18:56:48
nit: Add to AshTestBase? We'll likely need this (o
James Cook
2016/06/16 21:08:14
Moved to AshTestBase.
|
+ return WmShell::Get() |
+ ->GetPrimaryRootWindow() |
+ ->GetRootWindowController() |
+ ->GetShelf(); |
+} |
+ |
+} // namespace |
class AshPopupAlignmentDelegateTest : public test::AshTestBase { |
public: |
@@ -37,8 +50,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 +132,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) |
@@ -279,12 +294,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 +321,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))); |