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

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

Issue 2093283002: mash: Convert all of //ash/system to use WmShelf (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 9aed9db5c007f6207e0307015f78122f944212a7..495ba6a2d8ea21887d7dcafb1bc64216a82790ba 100644
--- a/ash/system/web_notification/ash_popup_alignment_delegate_unittest.cc
+++ b/ash/system/web_notification/ash_popup_alignment_delegate_unittest.cc
@@ -16,8 +16,6 @@
#include "ash/common/wm_window.h"
#include "ash/display/display_manager.h"
#include "ash/screen_util.h"
-#include "ash/shelf/shelf.h"
-#include "ash/shelf/shelf_layout_manager.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
#include "base/command_line.h"
@@ -39,8 +37,8 @@ class AshPopupAlignmentDelegateTest : public test::AshTestBase {
base::CommandLine::ForCurrentProcess()->AppendSwitch(
keyboard::switches::kEnableVirtualKeyboard);
test::AshTestBase::SetUp();
- SetAlignmentDelegate(
- base::WrapUnique(new AshPopupAlignmentDelegate(GetPrimaryShelf())));
+ SetAlignmentDelegate(base::WrapUnique(
+ new AshPopupAlignmentDelegate(WmShelf::ForPrimaryDisplay())));
}
void TearDown() override {
@@ -48,12 +46,6 @@ class AshPopupAlignmentDelegateTest : public test::AshTestBase {
test::AshTestBase::TearDown();
}
- void SetKeyboardBounds(const gfx::Rect& new_bounds) {
- Shelf::ForPrimaryDisplay()
- ->shelf_layout_manager()
- ->OnKeyboardBoundsChanging(new_bounds);
- }
-
protected:
enum Position {
TOP_LEFT,
@@ -141,14 +133,14 @@ TEST_F(AshPopupAlignmentDelegateTest, MAYBE_ShelfAlignment) {
EXPECT_FALSE(alignment_delegate()->IsTopDown());
EXPECT_FALSE(alignment_delegate()->IsFromLeft());
- GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_RIGHT);
+ WmShelf::ForPrimaryDisplay()->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());
- GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_LEFT);
+ WmShelf::ForPrimaryDisplay()->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));
@@ -162,7 +154,7 @@ TEST_F(AshPopupAlignmentDelegateTest, LockScreen) {
const gfx::Rect toast_size(0, 0, 10, 10);
- GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_LEFT);
+ WmShelf::ForPrimaryDisplay()->SetAlignment(SHELF_ALIGNMENT_LEFT);
gfx::Point toast_point;
toast_point.set_x(alignment_delegate()->GetToastOriginX(toast_size));
toast_point.set_y(alignment_delegate()->GetBaseLine());
@@ -187,9 +179,9 @@ TEST_F(AshPopupAlignmentDelegateTest, AutoHide) {
// Create a window, otherwise autohide doesn't work.
std::unique_ptr<views::Widget> widget =
CreateTestWidget(kShellWindowId_DefaultContainer);
- Shelf* shelf = Shelf::ForPrimaryDisplay();
+ WmShelf* shelf = WmShelf::ForPrimaryDisplay();
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
- shelf->shelf_layout_manager()->UpdateAutoHideStateNow();
+ shelf->UpdateVisibilityState();
msw 2016/06/25 00:18:30 q: should this be UpdateAutoHideState?
James Cook 2016/06/25 01:20:58 Actually, it's not needed at all. Removed.
EXPECT_EQ(origin_x, alignment_delegate()->GetToastOriginX(toast_size));
EXPECT_LT(baseline, alignment_delegate()->GetBaseLine());
}
@@ -211,8 +203,9 @@ TEST_F(AshPopupAlignmentDelegateTest, DockedWindow) {
EXPECT_FALSE(alignment_delegate()->IsFromLeft());
// Force dock to right-side
- GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_LEFT);
- GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_BOTTOM);
+ WmShelf* shelf = WmShelf::ForPrimaryDisplay();
+ shelf->SetAlignment(SHELF_ALIGNMENT_LEFT);
+ shelf->SetAlignment(SHELF_ALIGNMENT_BOTTOM);
// Right-side dock should not affect popup alignment
EXPECT_EQ(origin_x, alignment_delegate()->GetToastOriginX(toast_size));
@@ -283,8 +276,8 @@ TEST_F(AshPopupAlignmentDelegateTest, Extended) {
if (!SupportsMultipleDisplays())
return;
UpdateDisplay("600x600,800x800");
- SetAlignmentDelegate(
- base::WrapUnique(new AshPopupAlignmentDelegate(GetPrimaryShelf())));
+ SetAlignmentDelegate(base::WrapUnique(
+ new AshPopupAlignmentDelegate(WmShelf::ForPrimaryDisplay())));
display::Display second_display = ScreenUtil::GetSecondaryDisplay();
WmShelf* second_shelf =
@@ -310,8 +303,8 @@ TEST_F(AshPopupAlignmentDelegateTest, Unified) {
SetAlignmentDelegate(nullptr);
UpdateDisplay("600x600,800x800");
- SetAlignmentDelegate(
- base::WrapUnique(new AshPopupAlignmentDelegate(GetPrimaryShelf())));
+ SetAlignmentDelegate(base::WrapUnique(
+ new AshPopupAlignmentDelegate(WmShelf::ForPrimaryDisplay())));
EXPECT_GT(600,
alignment_delegate()->GetToastOriginX(gfx::Rect(0, 0, 10, 10)));
@@ -332,13 +325,14 @@ TEST_F(AshPopupAlignmentDelegateTest, MAYBE_KeyboardShowing) {
UpdateDisplay("600x600");
int baseline = alignment_delegate()->GetBaseLine();
+ WmShelf* shelf = WmShelf::ForPrimaryDisplay();
gfx::Rect keyboard_bounds(0, 300, 600, 300);
- SetKeyboardBounds(keyboard_bounds);
+ shelf->SetKeyboardBoundsForTesting(keyboard_bounds);
int keyboard_baseline = alignment_delegate()->GetBaseLine();
EXPECT_NE(baseline, keyboard_baseline);
EXPECT_GT(keyboard_bounds.y(), keyboard_baseline);
- SetKeyboardBounds(gfx::Rect());
+ shelf->SetKeyboardBoundsForTesting(gfx::Rect());
EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine());
}

Powered by Google App Engine
This is Rietveld 408576698