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

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

Issue 2144003003: Add CreateTestWidget() to AshTestBase, collapse duplicates (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@movetray
Patch Set: rebase Created 4 years, 5 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 dd32b3d1c862fa9acd9ece05bc36541e17134351..fe6ebf32dc6177cf3905a4ba01f15e59ded69d8e 100644
--- a/ash/system/web_notification/ash_popup_alignment_delegate_unittest.cc
+++ b/ash/system/web_notification/ash_popup_alignment_delegate_unittest.cc
@@ -12,7 +12,6 @@
#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"
#include "ash/display/display_manager.h"
#include "ash/shell.h"
@@ -88,21 +87,6 @@ class AshPopupAlignmentDelegateTest : public test::AshTestBase {
gfx::Rect GetWorkArea() { return alignment_delegate_->work_area_; }
- std::unique_ptr<views::Widget> CreateTestWidget(int container_id) {
- std::unique_ptr<views::Widget> widget(new views::Widget);
- views::Widget::InitParams params;
- params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
- params.bounds = gfx::Rect(0, 0, 50, 50);
- WmShell::Get()
- ->GetPrimaryRootWindow()
- ->GetRootWindowController()
- ->ConfigureWidgetInitParamsForContainer(widget.get(), container_id,
- &params);
- widget->Init(params);
- widget->Show();
- return widget;
- }
-
private:
std::unique_ptr<AshPopupAlignmentDelegate> alignment_delegate_;
@@ -169,8 +153,8 @@ TEST_F(AshPopupAlignmentDelegateTest, AutoHide) {
int baseline = alignment_delegate()->GetBaseLine();
// Create a window, otherwise autohide doesn't work.
- std::unique_ptr<views::Widget> widget =
- CreateTestWidget(kShellWindowId_DefaultContainer);
+ std::unique_ptr<views::Widget> widget = CreateTestWidget(
+ nullptr, kShellWindowId_DefaultContainer, gfx::Rect(0, 0, 50, 50));
WmShelf* shelf = GetPrimaryShelf();
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
EXPECT_EQ(origin_x, alignment_delegate()->GetToastOriginX(toast_size));
@@ -184,8 +168,8 @@ TEST_F(AshPopupAlignmentDelegateTest, DockedWindow) {
int origin_x = alignment_delegate()->GetToastOriginX(toast_size);
int baseline = alignment_delegate()->GetBaseLine();
- std::unique_ptr<views::Widget> widget =
- CreateTestWidget(kShellWindowId_DockedContainer);
+ std::unique_ptr<views::Widget> widget = CreateTestWidget(
+ nullptr, kShellWindowId_DockedContainer, gfx::Rect(0, 0, 50, 50));
// Left-side dock should not affect popup alignment
EXPECT_EQ(origin_x, alignment_delegate()->GetToastOriginX(toast_size));
« no previous file with comments | « ash/frame/default_header_painter_unittest.cc ('k') | ash/system/web_notification/web_notification_tray_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698