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

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

Issue 2103603002: mash: Remove StatusAreaWidget references from system tray classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweak 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 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/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/shelf_types.h" 10 #include "ash/common/shelf/shelf_types.h"
11 #include "ash/common/shelf/wm_shelf.h" 11 #include "ash/common/shelf/wm_shelf.h"
12 #include "ash/common/shell_window_ids.h" 12 #include "ash/common/shell_window_ids.h"
13 #include "ash/common/wm_lookup.h" 13 #include "ash/common/wm_lookup.h"
14 #include "ash/common/wm_root_window_controller.h" 14 #include "ash/common/wm_root_window_controller.h"
15 #include "ash/common/wm_shell.h" 15 #include "ash/common/wm_shell.h"
16 #include "ash/common/wm_window.h" 16 #include "ash/common/wm_window.h"
17 #include "ash/display/display_manager.h" 17 #include "ash/display/display_manager.h"
18 #include "ash/screen_util.h"
19 #include "ash/shell.h" 18 #include "ash/shell.h"
20 #include "ash/test/ash_test_base.h" 19 #include "ash/test/ash_test_base.h"
21 #include "base/command_line.h" 20 #include "base/command_line.h"
22 #include "base/memory/ptr_util.h" 21 #include "base/memory/ptr_util.h"
23 #include "ui/display/screen.h" 22 #include "ui/display/screen.h"
24 #include "ui/gfx/geometry/rect.h" 23 #include "ui/gfx/geometry/rect.h"
25 #include "ui/keyboard/keyboard_switches.h" 24 #include "ui/keyboard/keyboard_switches.h"
26 #include "ui/keyboard/keyboard_util.h" 25 #include "ui/keyboard/keyboard_util.h"
27 #include "ui/message_center/message_center_style.h" 26 #include "ui/message_center/message_center_style.h"
28 27
29 namespace ash { 28 namespace ash {
30 29
30 // TODO(jamescook): Move this to //ash/common. http://crbug.com/620955
31 class AshPopupAlignmentDelegateTest : public test::AshTestBase { 31 class AshPopupAlignmentDelegateTest : public test::AshTestBase {
32 public: 32 public:
33 AshPopupAlignmentDelegateTest() {} 33 AshPopupAlignmentDelegateTest() {}
34 ~AshPopupAlignmentDelegateTest() override {} 34 ~AshPopupAlignmentDelegateTest() override {}
35 35
36 void SetUp() override { 36 void SetUp() override {
37 base::CommandLine::ForCurrentProcess()->AppendSwitch( 37 base::CommandLine::ForCurrentProcess()->AppendSwitch(
38 keyboard::switches::kEnableVirtualKeyboard); 38 keyboard::switches::kEnableVirtualKeyboard);
39 test::AshTestBase::SetUp(); 39 test::AshTestBase::SetUp();
40 SetAlignmentDelegate( 40 SetAlignmentDelegate(
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 alignment_delegate()->GetBaseLine()); 263 alignment_delegate()->GetBaseLine());
264 } 264 }
265 265
266 TEST_F(AshPopupAlignmentDelegateTest, Extended) { 266 TEST_F(AshPopupAlignmentDelegateTest, Extended) {
267 if (!SupportsMultipleDisplays()) 267 if (!SupportsMultipleDisplays())
268 return; 268 return;
269 UpdateDisplay("600x600,800x800"); 269 UpdateDisplay("600x600,800x800");
270 SetAlignmentDelegate( 270 SetAlignmentDelegate(
271 base::WrapUnique(new AshPopupAlignmentDelegate(GetPrimaryShelf()))); 271 base::WrapUnique(new AshPopupAlignmentDelegate(GetPrimaryShelf())));
272 272
273 display::Display second_display = ScreenUtil::GetSecondaryDisplay(); 273 display::Display second_display =
274 Shell::GetInstance()->display_manager()->GetDisplayAt(1u);
274 WmShelf* second_shelf = 275 WmShelf* second_shelf =
275 WmLookup::Get() 276 WmLookup::Get()
276 ->GetRootWindowControllerWithDisplayId(second_display.id()) 277 ->GetRootWindowControllerWithDisplayId(second_display.id())
277 ->GetShelf(); 278 ->GetShelf();
278 AshPopupAlignmentDelegate for_2nd_display(second_shelf); 279 AshPopupAlignmentDelegate for_2nd_display(second_shelf);
279 UpdateWorkArea(&for_2nd_display, second_display); 280 UpdateWorkArea(&for_2nd_display, second_display);
280 // Make sure that the toast position on the secondary display is 281 // Make sure that the toast position on the secondary display is
281 // positioned correctly. 282 // positioned correctly.
282 EXPECT_LT(1300, for_2nd_display.GetToastOriginX(gfx::Rect(0, 0, 10, 10))); 283 EXPECT_LT(1300, for_2nd_display.GetToastOriginX(gfx::Rect(0, 0, 10, 10)));
283 EXPECT_LT(700, for_2nd_display.GetBaseLine()); 284 EXPECT_LT(700, for_2nd_display.GetBaseLine());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 shelf->SetKeyboardBoundsForTesting(keyboard_bounds); 322 shelf->SetKeyboardBoundsForTesting(keyboard_bounds);
322 int keyboard_baseline = alignment_delegate()->GetBaseLine(); 323 int keyboard_baseline = alignment_delegate()->GetBaseLine();
323 EXPECT_NE(baseline, keyboard_baseline); 324 EXPECT_NE(baseline, keyboard_baseline);
324 EXPECT_GT(keyboard_bounds.y(), keyboard_baseline); 325 EXPECT_GT(keyboard_bounds.y(), keyboard_baseline);
325 326
326 shelf->SetKeyboardBoundsForTesting(gfx::Rect()); 327 shelf->SetKeyboardBoundsForTesting(gfx::Rect());
327 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine()); 328 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine());
328 } 329 }
329 330
330 } // namespace ash 331 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698