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

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

Issue 2732573002: chromeos: moves more ash tests to run on mash (Closed)
Patch Set: Created 3 years, 9 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/common/system/web_notification/ash_popup_alignment_delegate.h" 5 #include "ash/common/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/common/shelf/wm_shelf.h" 10 #include "ash/common/shelf/wm_shelf.h"
11 #include "ash/common/wm_lookup.h" 11 #include "ash/common/wm_lookup.h"
12 #include "ash/common/wm_shell.h"
12 #include "ash/common/wm_window.h" 13 #include "ash/common/wm_window.h"
13 #include "ash/public/cpp/shelf_types.h" 14 #include "ash/public/cpp/shelf_types.h"
14 #include "ash/public/cpp/shell_window_ids.h" 15 #include "ash/public/cpp/shell_window_ids.h"
15 #include "ash/root_window_controller.h" 16 #include "ash/root_window_controller.h"
16 #include "ash/shell.h" 17 #include "ash/shell.h"
17 #include "ash/test/ash_test_base.h" 18 #include "ash/test/ash_test_base.h"
18 #include "base/command_line.h" 19 #include "base/command_line.h"
19 #include "base/memory/ptr_util.h" 20 #include "base/memory/ptr_util.h"
20 #include "ui/display/manager/display_manager.h" 21 #include "ui/display/manager/display_manager.h"
21 #include "ui/display/screen.h" 22 #include "ui/display/screen.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 UpdateDisplay("800x800"); 190 UpdateDisplay("800x800");
190 EXPECT_LT(origin_x, alignment_delegate()->GetToastOriginX(toast_size)); 191 EXPECT_LT(origin_x, alignment_delegate()->GetToastOriginX(toast_size));
191 EXPECT_LT(baseline, alignment_delegate()->GetBaseLine()); 192 EXPECT_LT(baseline, alignment_delegate()->GetBaseLine());
192 193
193 UpdateDisplay("400x400"); 194 UpdateDisplay("400x400");
194 EXPECT_GT(origin_x, alignment_delegate()->GetToastOriginX(toast_size)); 195 EXPECT_GT(origin_x, alignment_delegate()->GetToastOriginX(toast_size));
195 EXPECT_GT(baseline, alignment_delegate()->GetBaseLine()); 196 EXPECT_GT(baseline, alignment_delegate()->GetBaseLine());
196 } 197 }
197 198
198 TEST_F(AshPopupAlignmentDelegateTest, DockedMode) { 199 TEST_F(AshPopupAlignmentDelegateTest, DockedMode) {
200 // TODO: needs unified mode. http://crbug.com/698024.
201 if (WmShell::Get()->IsRunningInMash())
202 return;
203
199 const gfx::Rect toast_size(0, 0, 10, 10); 204 const gfx::Rect toast_size(0, 0, 10, 10);
200 UpdateDisplay("600x600"); 205 UpdateDisplay("600x600");
201 int origin_x = alignment_delegate()->GetToastOriginX(toast_size); 206 int origin_x = alignment_delegate()->GetToastOriginX(toast_size);
202 int baseline = alignment_delegate()->GetBaseLine(); 207 int baseline = alignment_delegate()->GetBaseLine();
203 208
204 // Emulate the docked mode; enter to an extended mode, then invoke 209 // Emulate the docked mode; enter to an extended mode, then invoke
205 // OnNativeDisplaysChanged() with the info for the secondary display only. 210 // OnNativeDisplaysChanged() with the info for the secondary display only.
206 UpdateDisplay("600x600,800x800"); 211 UpdateDisplay("600x600,800x800");
207 212
208 std::vector<display::ManagedDisplayInfo> new_info; 213 std::vector<display::ManagedDisplayInfo> new_info;
(...skipping 18 matching lines...) Expand all
227 EXPECT_EQ(origin_x, alignment_delegate()->GetToastOriginX(toast_size)); 232 EXPECT_EQ(origin_x, alignment_delegate()->GetToastOriginX(toast_size));
228 EXPECT_EQ(baseline - kTrayHeight - message_center::kMarginBetweenItems, 233 EXPECT_EQ(baseline - kTrayHeight - message_center::kMarginBetweenItems,
229 alignment_delegate()->GetBaseLine()); 234 alignment_delegate()->GetBaseLine());
230 } 235 }
231 236
232 TEST_F(AshPopupAlignmentDelegateTest, Extended) { 237 TEST_F(AshPopupAlignmentDelegateTest, Extended) {
233 UpdateDisplay("600x600,800x800"); 238 UpdateDisplay("600x600,800x800");
234 SetAlignmentDelegate( 239 SetAlignmentDelegate(
235 base::MakeUnique<AshPopupAlignmentDelegate>(GetPrimaryShelf())); 240 base::MakeUnique<AshPopupAlignmentDelegate>(GetPrimaryShelf()));
236 241
237 display::Display second_display = display_manager()->GetDisplayAt(1u); 242 display::Display second_display = GetSecondaryDisplay();
238 WmShelf* second_shelf = 243 WmShelf* second_shelf =
239 WmLookup::Get() 244 WmLookup::Get()
240 ->GetRootWindowControllerWithDisplayId(second_display.id()) 245 ->GetRootWindowControllerWithDisplayId(second_display.id())
241 ->GetShelf(); 246 ->GetShelf();
242 AshPopupAlignmentDelegate for_2nd_display(second_shelf); 247 AshPopupAlignmentDelegate for_2nd_display(second_shelf);
243 UpdateWorkArea(&for_2nd_display, second_display); 248 UpdateWorkArea(&for_2nd_display, second_display);
244 // Make sure that the toast position on the secondary display is 249 // Make sure that the toast position on the secondary display is
245 // positioned correctly. 250 // positioned correctly.
246 EXPECT_LT(1300, for_2nd_display.GetToastOriginX(gfx::Rect(0, 0, 10, 10))); 251 EXPECT_LT(1300, for_2nd_display.GetToastOriginX(gfx::Rect(0, 0, 10, 10)));
247 EXPECT_LT(700, for_2nd_display.GetBaseLine()); 252 EXPECT_LT(700, for_2nd_display.GetBaseLine());
248 } 253 }
249 254
250 TEST_F(AshPopupAlignmentDelegateTest, Unified) { 255 TEST_F(AshPopupAlignmentDelegateTest, Unified) {
256 // TODO: needs unified mode. http://crbug.com/698024.
257 if (WmShell::Get()->IsRunningInMash())
258 return;
259
251 display_manager()->SetUnifiedDesktopEnabled(true); 260 display_manager()->SetUnifiedDesktopEnabled(true);
252 261
253 // Reset the delegate as the primary display's shelf will be destroyed during 262 // Reset the delegate as the primary display's shelf will be destroyed during
254 // transition. 263 // transition.
255 SetAlignmentDelegate(nullptr); 264 SetAlignmentDelegate(nullptr);
256 265
257 UpdateDisplay("600x600,800x800"); 266 UpdateDisplay("600x600,800x800");
258 SetAlignmentDelegate( 267 SetAlignmentDelegate(
259 base::MakeUnique<AshPopupAlignmentDelegate>(GetPrimaryShelf())); 268 base::MakeUnique<AshPopupAlignmentDelegate>(GetPrimaryShelf()));
260 269
(...skipping 15 matching lines...) Expand all
276 shelf->SetVirtualKeyboardBoundsForTesting(keyboard_bounds); 285 shelf->SetVirtualKeyboardBoundsForTesting(keyboard_bounds);
277 int keyboard_baseline = alignment_delegate()->GetBaseLine(); 286 int keyboard_baseline = alignment_delegate()->GetBaseLine();
278 EXPECT_NE(baseline, keyboard_baseline); 287 EXPECT_NE(baseline, keyboard_baseline);
279 EXPECT_GT(keyboard_bounds.y(), keyboard_baseline); 288 EXPECT_GT(keyboard_bounds.y(), keyboard_baseline);
280 289
281 shelf->SetVirtualKeyboardBoundsForTesting(gfx::Rect()); 290 shelf->SetVirtualKeyboardBoundsForTesting(gfx::Rect());
282 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine()); 291 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine());
283 } 292 }
284 293
285 } // namespace ash 294 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698