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

Side by Side Diff: ash/system/web_notification/ash_popup_alignment_delegate_unittest.cc

Issue 1914093002: Refactors DockedWindowLayoutManager in terms of ash/wm/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@nuke_aura_window
Patch Set: comment Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/system/web_notification/ash_popup_alignment_delegate.h" 5 #include "ash/system/web_notification/ash_popup_alignment_delegate.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/display/display_manager.h" 10 #include "ash/display/display_manager.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 TEST_F(AshPopupAlignmentDelegateTest, MAYBE_ShelfAlignment) { 113 TEST_F(AshPopupAlignmentDelegateTest, MAYBE_ShelfAlignment) {
114 const gfx::Rect toast_size(0, 0, 10, 10); 114 const gfx::Rect toast_size(0, 0, 10, 10);
115 UpdateDisplay("600x600"); 115 UpdateDisplay("600x600");
116 gfx::Point toast_point; 116 gfx::Point toast_point;
117 toast_point.set_x(alignment_delegate()->GetToastOriginX(toast_size)); 117 toast_point.set_x(alignment_delegate()->GetToastOriginX(toast_size));
118 toast_point.set_y(alignment_delegate()->GetBaseLine()); 118 toast_point.set_y(alignment_delegate()->GetBaseLine());
119 EXPECT_EQ(BOTTOM_RIGHT, GetPositionInDisplay(toast_point)); 119 EXPECT_EQ(BOTTOM_RIGHT, GetPositionInDisplay(toast_point));
120 EXPECT_FALSE(alignment_delegate()->IsTopDown()); 120 EXPECT_FALSE(alignment_delegate()->IsTopDown());
121 EXPECT_FALSE(alignment_delegate()->IsFromLeft()); 121 EXPECT_FALSE(alignment_delegate()->IsFromLeft());
122 122
123 Shell::GetInstance()->SetShelfAlignment( 123 Shell::GetInstance()->SetShelfAlignment(wm::SHELF_ALIGNMENT_RIGHT,
124 SHELF_ALIGNMENT_RIGHT, 124 Shell::GetPrimaryRootWindow());
125 Shell::GetPrimaryRootWindow());
126 toast_point.set_x(alignment_delegate()->GetToastOriginX(toast_size)); 125 toast_point.set_x(alignment_delegate()->GetToastOriginX(toast_size));
127 toast_point.set_y(alignment_delegate()->GetBaseLine()); 126 toast_point.set_y(alignment_delegate()->GetBaseLine());
128 EXPECT_EQ(BOTTOM_RIGHT, GetPositionInDisplay(toast_point)); 127 EXPECT_EQ(BOTTOM_RIGHT, GetPositionInDisplay(toast_point));
129 EXPECT_FALSE(alignment_delegate()->IsTopDown()); 128 EXPECT_FALSE(alignment_delegate()->IsTopDown());
130 EXPECT_FALSE(alignment_delegate()->IsFromLeft()); 129 EXPECT_FALSE(alignment_delegate()->IsFromLeft());
131 130
132 Shell::GetInstance()->SetShelfAlignment( 131 Shell::GetInstance()->SetShelfAlignment(wm::SHELF_ALIGNMENT_LEFT,
133 SHELF_ALIGNMENT_LEFT, 132 Shell::GetPrimaryRootWindow());
134 Shell::GetPrimaryRootWindow());
135 toast_point.set_x(alignment_delegate()->GetToastOriginX(toast_size)); 133 toast_point.set_x(alignment_delegate()->GetToastOriginX(toast_size));
136 toast_point.set_y(alignment_delegate()->GetBaseLine()); 134 toast_point.set_y(alignment_delegate()->GetBaseLine());
137 EXPECT_EQ(BOTTOM_LEFT, GetPositionInDisplay(toast_point)); 135 EXPECT_EQ(BOTTOM_LEFT, GetPositionInDisplay(toast_point));
138 EXPECT_FALSE(alignment_delegate()->IsTopDown()); 136 EXPECT_FALSE(alignment_delegate()->IsTopDown());
139 EXPECT_TRUE(alignment_delegate()->IsFromLeft()); 137 EXPECT_TRUE(alignment_delegate()->IsFromLeft());
140 } 138 }
141 139
142 TEST_F(AshPopupAlignmentDelegateTest, LockScreen) { 140 TEST_F(AshPopupAlignmentDelegateTest, LockScreen) {
143 if (!SupportsHostWindowResize()) 141 if (!SupportsHostWindowResize())
144 return; 142 return;
145 143
146 const gfx::Rect toast_size(0, 0, 10, 10); 144 const gfx::Rect toast_size(0, 0, 10, 10);
147 145
148 Shell::GetInstance()->SetShelfAlignment( 146 Shell::GetInstance()->SetShelfAlignment(wm::SHELF_ALIGNMENT_LEFT,
149 SHELF_ALIGNMENT_LEFT, 147 Shell::GetPrimaryRootWindow());
150 Shell::GetPrimaryRootWindow());
151 gfx::Point toast_point; 148 gfx::Point toast_point;
152 toast_point.set_x(alignment_delegate()->GetToastOriginX(toast_size)); 149 toast_point.set_x(alignment_delegate()->GetToastOriginX(toast_size));
153 toast_point.set_y(alignment_delegate()->GetBaseLine()); 150 toast_point.set_y(alignment_delegate()->GetBaseLine());
154 EXPECT_EQ(BOTTOM_LEFT, GetPositionInDisplay(toast_point)); 151 EXPECT_EQ(BOTTOM_LEFT, GetPositionInDisplay(toast_point));
155 EXPECT_FALSE(alignment_delegate()->IsTopDown()); 152 EXPECT_FALSE(alignment_delegate()->IsTopDown());
156 EXPECT_TRUE(alignment_delegate()->IsFromLeft()); 153 EXPECT_TRUE(alignment_delegate()->IsFromLeft());
157 154
158 BlockUserSession(BLOCKED_BY_LOCK_SCREEN); 155 BlockUserSession(BLOCKED_BY_LOCK_SCREEN);
159 toast_point.set_x(alignment_delegate()->GetToastOriginX(toast_size)); 156 toast_point.set_x(alignment_delegate()->GetToastOriginX(toast_size));
160 toast_point.set_y(alignment_delegate()->GetBaseLine()); 157 toast_point.set_y(alignment_delegate()->GetBaseLine());
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 kShellWindowId_DockedContainer); 190 kShellWindowId_DockedContainer);
194 docked_container->AddChild(window.get()); 191 docked_container->AddChild(window.get());
195 192
196 // Left-side dock should not affect popup alignment 193 // Left-side dock should not affect popup alignment
197 EXPECT_EQ(origin_x, alignment_delegate()->GetToastOriginX(toast_size)); 194 EXPECT_EQ(origin_x, alignment_delegate()->GetToastOriginX(toast_size));
198 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine()); 195 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine());
199 EXPECT_FALSE(alignment_delegate()->IsTopDown()); 196 EXPECT_FALSE(alignment_delegate()->IsTopDown());
200 EXPECT_FALSE(alignment_delegate()->IsFromLeft()); 197 EXPECT_FALSE(alignment_delegate()->IsFromLeft());
201 198
202 // Force dock to right-side 199 // Force dock to right-side
203 Shell::GetInstance()->SetShelfAlignment(SHELF_ALIGNMENT_LEFT, 200 Shell::GetInstance()->SetShelfAlignment(wm::SHELF_ALIGNMENT_LEFT,
204 Shell::GetPrimaryRootWindow()); 201 Shell::GetPrimaryRootWindow());
205 Shell::GetInstance()->SetShelfAlignment(SHELF_ALIGNMENT_BOTTOM, 202 Shell::GetInstance()->SetShelfAlignment(wm::SHELF_ALIGNMENT_BOTTOM,
206 Shell::GetPrimaryRootWindow()); 203 Shell::GetPrimaryRootWindow());
207 204
208 // Right-side dock should not affect popup alignment 205 // Right-side dock should not affect popup alignment
209 EXPECT_EQ(origin_x, alignment_delegate()->GetToastOriginX(toast_size)); 206 EXPECT_EQ(origin_x, alignment_delegate()->GetToastOriginX(toast_size));
210 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine()); 207 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine());
211 EXPECT_FALSE(alignment_delegate()->IsTopDown()); 208 EXPECT_FALSE(alignment_delegate()->IsTopDown());
212 EXPECT_FALSE(alignment_delegate()->IsFromLeft()); 209 EXPECT_FALSE(alignment_delegate()->IsFromLeft());
213 } 210 }
214 211
215 #if defined(OS_WIN) && !defined(USE_ASH) 212 #if defined(OS_WIN) && !defined(USE_ASH)
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 SetKeyboardBounds(keyboard_bounds); 325 SetKeyboardBounds(keyboard_bounds);
329 int keyboard_baseline = alignment_delegate()->GetBaseLine(); 326 int keyboard_baseline = alignment_delegate()->GetBaseLine();
330 EXPECT_NE(baseline, keyboard_baseline); 327 EXPECT_NE(baseline, keyboard_baseline);
331 EXPECT_GT(keyboard_bounds.y(), keyboard_baseline); 328 EXPECT_GT(keyboard_bounds.y(), keyboard_baseline);
332 329
333 SetKeyboardBounds(gfx::Rect()); 330 SetKeyboardBounds(gfx::Rect());
334 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine()); 331 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine());
335 } 332 }
336 333
337 } // namespace ash 334 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/web_notification/ash_popup_alignment_delegate.cc ('k') | ash/system/web_notification/web_notification_tray.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698