Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2203)

Unified Diff: ash/system/web_notification/ash_popup_alignment_delegate_unittest.cc

Issue 1659283002: ash: Explicitly teach various components about ShelfLayoutManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ozone-ui-event-platform-event
Patch Set: fix-test Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 29ade180a7c73d0c8637469507f69bc15686859e..4fcc693cab157e70d922feb2b5265bacc8a062fa 100644
--- a/ash/system/web_notification/ash_popup_alignment_delegate_unittest.cc
+++ b/ash/system/web_notification/ash_popup_alignment_delegate_unittest.cc
@@ -8,6 +8,7 @@
#include <vector>
#include "ash/display/display_manager.h"
+#include "ash/display/window_tree_host_manager.h"
#include "ash/screen_util.h"
#include "ash/shelf/shelf_layout_manager.h"
#include "ash/shelf/shelf_types.h"
@@ -32,7 +33,8 @@ class AshPopupAlignmentDelegateTest : public test::AshTestBase {
base::CommandLine::ForCurrentProcess()->AppendSwitch(
keyboard::switches::kEnableVirtualKeyboard);
test::AshTestBase::SetUp();
- SetAlignmentDelegate(make_scoped_ptr(new AshPopupAlignmentDelegate()));
+ SetAlignmentDelegate(make_scoped_ptr(new AshPopupAlignmentDelegate(
+ ShelfLayoutManager::ForShelf(Shell::GetPrimaryRootWindow()))));
}
void TearDown() override {
@@ -266,10 +268,17 @@ TEST_F(AshPopupAlignmentDelegateTest, Extended) {
if (!SupportsMultipleDisplays())
return;
UpdateDisplay("600x600,800x800");
- SetAlignmentDelegate(make_scoped_ptr(new AshPopupAlignmentDelegate()));
-
- AshPopupAlignmentDelegate for_2nd_display;
- UpdateWorkArea(&for_2nd_display, ScreenUtil::GetSecondaryDisplay());
+ SetAlignmentDelegate(make_scoped_ptr(new AshPopupAlignmentDelegate(
+ ShelfLayoutManager::ForShelf(Shell::GetPrimaryRootWindow()))));
+
+ gfx::Display second_display = ScreenUtil::GetSecondaryDisplay();
+ aura::Window* second_root =
+ Shell::GetInstance()
+ ->window_tree_host_manager()
+ ->GetRootWindowForDisplayId(second_display.id());
+ AshPopupAlignmentDelegate for_2nd_display(
+ ShelfLayoutManager::ForShelf(second_root));
+ UpdateWorkArea(&for_2nd_display, second_display);
// Make sure that the toast position on the secondary display is
// positioned correctly.
EXPECT_LT(1300, for_2nd_display.GetToastOriginX(gfx::Rect(0, 0, 10, 10)));
@@ -284,10 +293,11 @@ TEST_F(AshPopupAlignmentDelegateTest, Unified) {
// Reset the delegate as the primary display's shelf will be destroyed during
// transition.
- SetAlignmentDelegate(scoped_ptr<AshPopupAlignmentDelegate>());
+ SetAlignmentDelegate(nullptr);
UpdateDisplay("600x600,800x800");
- SetAlignmentDelegate(make_scoped_ptr(new AshPopupAlignmentDelegate()));
+ SetAlignmentDelegate(make_scoped_ptr(new AshPopupAlignmentDelegate(
+ ShelfLayoutManager::ForShelf(Shell::GetPrimaryRootWindow()))));
EXPECT_GT(600,
alignment_delegate()->GetToastOriginX(gfx::Rect(0, 0, 10, 10)));
« no previous file with comments | « ash/system/web_notification/ash_popup_alignment_delegate.cc ('k') | ash/system/web_notification/web_notification_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698