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

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

Issue 2899253002: chromeos: Rename ash::WmShelf to Shelf (Closed)
Patch Set: rebase Created 3 years, 7 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/public/cpp/config.h" 10 #include "ash/public/cpp/config.h"
11 #include "ash/public/cpp/shelf_types.h" 11 #include "ash/public/cpp/shelf_types.h"
12 #include "ash/public/cpp/shell_window_ids.h" 12 #include "ash/public/cpp/shell_window_ids.h"
13 #include "ash/root_window_controller.h" 13 #include "ash/root_window_controller.h"
14 #include "ash/shelf/wm_shelf.h" 14 #include "ash/shelf/shelf.h"
15 #include "ash/shell.h" 15 #include "ash/shell.h"
16 #include "ash/test/ash_test_base.h" 16 #include "ash/test/ash_test_base.h"
17 #include "ash/wm_window.h" 17 #include "ash/wm_window.h"
18 #include "base/command_line.h" 18 #include "base/command_line.h"
19 #include "base/memory/ptr_util.h" 19 #include "base/memory/ptr_util.h"
20 #include "ui/display/manager/display_manager.h" 20 #include "ui/display/manager/display_manager.h"
21 #include "ui/display/screen.h" 21 #include "ui/display/screen.h"
22 #include "ui/gfx/geometry/rect.h" 22 #include "ui/gfx/geometry/rect.h"
23 #include "ui/keyboard/keyboard_switches.h" 23 #include "ui/keyboard/keyboard_switches.h"
24 #include "ui/keyboard/keyboard_util.h" 24 #include "ui/keyboard/keyboard_util.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 138
139 TEST_F(AshPopupAlignmentDelegateTest, AutoHide) { 139 TEST_F(AshPopupAlignmentDelegateTest, AutoHide) {
140 const gfx::Rect toast_size(0, 0, 10, 10); 140 const gfx::Rect toast_size(0, 0, 10, 10);
141 UpdateDisplay("600x600"); 141 UpdateDisplay("600x600");
142 int origin_x = alignment_delegate()->GetToastOriginX(toast_size); 142 int origin_x = alignment_delegate()->GetToastOriginX(toast_size);
143 int baseline = alignment_delegate()->GetBaseLine(); 143 int baseline = alignment_delegate()->GetBaseLine();
144 144
145 // Create a window, otherwise autohide doesn't work. 145 // Create a window, otherwise autohide doesn't work.
146 std::unique_ptr<views::Widget> widget = CreateTestWidget( 146 std::unique_ptr<views::Widget> widget = CreateTestWidget(
147 nullptr, kShellWindowId_DefaultContainer, gfx::Rect(0, 0, 50, 50)); 147 nullptr, kShellWindowId_DefaultContainer, gfx::Rect(0, 0, 50, 50));
148 WmShelf* shelf = GetPrimaryShelf(); 148 Shelf* shelf = GetPrimaryShelf();
149 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); 149 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
150 EXPECT_EQ(origin_x, alignment_delegate()->GetToastOriginX(toast_size)); 150 EXPECT_EQ(origin_x, alignment_delegate()->GetToastOriginX(toast_size));
151 EXPECT_LT(baseline, alignment_delegate()->GetBaseLine()); 151 EXPECT_LT(baseline, alignment_delegate()->GetBaseLine());
152 } 152 }
153 153
154 TEST_F(AshPopupAlignmentDelegateTest, DisplayResize) { 154 TEST_F(AshPopupAlignmentDelegateTest, DisplayResize) {
155 const gfx::Rect toast_size(0, 0, 10, 10); 155 const gfx::Rect toast_size(0, 0, 10, 10);
156 UpdateDisplay("600x600"); 156 UpdateDisplay("600x600");
157 int origin_x = alignment_delegate()->GetToastOriginX(toast_size); 157 int origin_x = alignment_delegate()->GetToastOriginX(toast_size);
158 int baseline = alignment_delegate()->GetBaseLine(); 158 int baseline = alignment_delegate()->GetBaseLine();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 EXPECT_EQ(baseline - kTrayHeight - message_center::kMarginBetweenItems, 203 EXPECT_EQ(baseline - kTrayHeight - message_center::kMarginBetweenItems,
204 alignment_delegate()->GetBaseLine()); 204 alignment_delegate()->GetBaseLine());
205 } 205 }
206 206
207 TEST_F(AshPopupAlignmentDelegateTest, Extended) { 207 TEST_F(AshPopupAlignmentDelegateTest, Extended) {
208 UpdateDisplay("600x600,800x800"); 208 UpdateDisplay("600x600,800x800");
209 SetAlignmentDelegate( 209 SetAlignmentDelegate(
210 base::MakeUnique<AshPopupAlignmentDelegate>(GetPrimaryShelf())); 210 base::MakeUnique<AshPopupAlignmentDelegate>(GetPrimaryShelf()));
211 211
212 display::Display second_display = GetSecondaryDisplay(); 212 display::Display second_display = GetSecondaryDisplay();
213 WmShelf* second_shelf = 213 Shelf* second_shelf =
214 Shell::GetRootWindowControllerWithDisplayId(second_display.id()) 214 Shell::GetRootWindowControllerWithDisplayId(second_display.id())
215 ->GetShelf(); 215 ->GetShelf();
216 AshPopupAlignmentDelegate for_2nd_display(second_shelf); 216 AshPopupAlignmentDelegate for_2nd_display(second_shelf);
217 UpdateWorkArea(&for_2nd_display, second_display); 217 UpdateWorkArea(&for_2nd_display, second_display);
218 // Make sure that the toast position on the secondary display is 218 // Make sure that the toast position on the secondary display is
219 // positioned correctly. 219 // positioned correctly.
220 EXPECT_LT(1300, for_2nd_display.GetToastOriginX(gfx::Rect(0, 0, 10, 10))); 220 EXPECT_LT(1300, for_2nd_display.GetToastOriginX(gfx::Rect(0, 0, 10, 10)));
221 EXPECT_LT(700, for_2nd_display.GetBaseLine()); 221 EXPECT_LT(700, for_2nd_display.GetBaseLine());
222 } 222 }
223 223
(...skipping 18 matching lines...) Expand all
242 242
243 // Tests that when the keyboard is showing that notifications appear above it, 243 // Tests that when the keyboard is showing that notifications appear above it,
244 // and that they return to normal once the keyboard is gone. 244 // and that they return to normal once the keyboard is gone.
245 TEST_F(AshPopupAlignmentDelegateTest, KeyboardShowing) { 245 TEST_F(AshPopupAlignmentDelegateTest, KeyboardShowing) {
246 ASSERT_TRUE(keyboard::IsKeyboardEnabled()); 246 ASSERT_TRUE(keyboard::IsKeyboardEnabled());
247 ASSERT_TRUE(keyboard::IsKeyboardOverscrollEnabled()); 247 ASSERT_TRUE(keyboard::IsKeyboardOverscrollEnabled());
248 248
249 UpdateDisplay("600x600"); 249 UpdateDisplay("600x600");
250 int baseline = alignment_delegate()->GetBaseLine(); 250 int baseline = alignment_delegate()->GetBaseLine();
251 251
252 WmShelf* shelf = GetPrimaryShelf(); 252 Shelf* shelf = GetPrimaryShelf();
253 gfx::Rect keyboard_bounds(0, 300, 600, 300); 253 gfx::Rect keyboard_bounds(0, 300, 600, 300);
254 shelf->SetVirtualKeyboardBoundsForTesting(keyboard_bounds); 254 shelf->SetVirtualKeyboardBoundsForTesting(keyboard_bounds);
255 int keyboard_baseline = alignment_delegate()->GetBaseLine(); 255 int keyboard_baseline = alignment_delegate()->GetBaseLine();
256 EXPECT_NE(baseline, keyboard_baseline); 256 EXPECT_NE(baseline, keyboard_baseline);
257 EXPECT_GT(keyboard_bounds.y(), keyboard_baseline); 257 EXPECT_GT(keyboard_bounds.y(), keyboard_baseline);
258 258
259 shelf->SetVirtualKeyboardBoundsForTesting(gfx::Rect()); 259 shelf->SetVirtualKeyboardBoundsForTesting(gfx::Rect());
260 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine()); 260 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine());
261 } 261 }
262 262
263 } // namespace ash 263 } // 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