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 8024c294d3ccaa46061f3258de6a8b5d535b8196..5fcd7ca7f0599686f7e254d06213dda8ebcff07b 100644 |
--- a/ash/system/web_notification/ash_popup_alignment_delegate_unittest.cc |
+++ b/ash/system/web_notification/ash_popup_alignment_delegate_unittest.cc |
@@ -12,6 +12,7 @@ |
#include "ash/shell.h" |
#include "ash/shell_window_ids.h" |
#include "ash/test/ash_test_base.h" |
+#include "ash/test/display_manager_test_api.h" |
#include "ui/gfx/screen.h" |
#include "ui/message_center/message_center_style.h" |
@@ -24,9 +25,7 @@ class AshPopupAlignmentDelegateTest : public test::AshTestBase { |
void SetUp() override { |
test::AshTestBase::SetUp(); |
- alignment_delegate_.reset(new AshPopupAlignmentDelegate()); |
- alignment_delegate_->StartObserving( |
- Shell::GetScreen(), Shell::GetScreen()->GetPrimaryDisplay()); |
+ SetAlignmentDelegate(make_scoped_ptr(new AshPopupAlignmentDelegate())); |
} |
void TearDown() override { |
@@ -47,6 +46,18 @@ class AshPopupAlignmentDelegateTest : public test::AshTestBase { |
return alignment_delegate_.get(); |
} |
+ void SetAlignmentDelegate(scoped_ptr<AshPopupAlignmentDelegate> delegate) { |
+ if (!delegate.get()) { |
+ alignment_delegate_.reset(); |
+ return; |
+ } |
+ alignment_delegate_ = delegate.Pass(); |
+ alignment_delegate_->StartObserving( |
+ Shell::GetScreen(), Shell::GetScreen()->GetPrimaryDisplay()); |
+ // Update the layout |
+ alignment_delegate_->OnDisplayWorkAreaInsetsChanged(); |
+ } |
+ |
Position GetPositionInDisplay(const gfx::Point& point) { |
const gfx::Rect& work_area = |
Shell::GetScreen()->GetPrimaryDisplay().work_area(); |
@@ -218,4 +229,23 @@ TEST_F(AshPopupAlignmentDelegateTest, TrayHeight) { |
alignment_delegate()->GetBaseLine()); |
} |
+TEST_F(AshPopupAlignmentDelegateTest, Unified) { |
+ if (!SupportsMultipleDisplays()) |
+ return; |
+ DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
+ test::DisplayManagerTestApi test_api(display_manager); |
+ test_api.SetDefaultMultiDisplayMode(DisplayManager::UNIFIED); |
+ display_manager->SetMultiDisplayMode(DisplayManager::UNIFIED); |
+ |
+ // Reset the delegate as the primary display's shelf will be destroyed during |
+ // transition. |
+ SetAlignmentDelegate(scoped_ptr<AshPopupAlignmentDelegate>()); |
+ |
+ UpdateDisplay("600x600,800x800"); |
+ SetAlignmentDelegate(make_scoped_ptr(new AshPopupAlignmentDelegate())); |
+ |
+ EXPECT_GT(600, |
+ alignment_delegate()->GetToastOriginX(gfx::Rect(0, 0, 10, 10))); |
+} |
+ |
} // namespace ash |