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

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

Issue 2815043002: Removes ShellPort::IsRunningInMash() (Closed)
Patch Set: dont set instance_ in constructor Created 3 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/public/cpp/config.h"
10 #include "ash/public/cpp/shelf_types.h" 11 #include "ash/public/cpp/shelf_types.h"
11 #include "ash/public/cpp/shell_window_ids.h" 12 #include "ash/public/cpp/shell_window_ids.h"
12 #include "ash/root_window_controller.h" 13 #include "ash/root_window_controller.h"
13 #include "ash/shelf/wm_shelf.h" 14 #include "ash/shelf/wm_shelf.h"
14 #include "ash/shell.h" 15 #include "ash/shell.h"
15 #include "ash/shell_port.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"
25 #include "ui/message_center/message_center_style.h" 25 #include "ui/message_center/message_center_style.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 EXPECT_LT(origin_x, alignment_delegate()->GetToastOriginX(toast_size)); 161 EXPECT_LT(origin_x, alignment_delegate()->GetToastOriginX(toast_size));
162 EXPECT_LT(baseline, alignment_delegate()->GetBaseLine()); 162 EXPECT_LT(baseline, alignment_delegate()->GetBaseLine());
163 163
164 UpdateDisplay("400x400"); 164 UpdateDisplay("400x400");
165 EXPECT_GT(origin_x, alignment_delegate()->GetToastOriginX(toast_size)); 165 EXPECT_GT(origin_x, alignment_delegate()->GetToastOriginX(toast_size));
166 EXPECT_GT(baseline, alignment_delegate()->GetBaseLine()); 166 EXPECT_GT(baseline, alignment_delegate()->GetBaseLine());
167 } 167 }
168 168
169 TEST_F(AshPopupAlignmentDelegateTest, DockedMode) { 169 TEST_F(AshPopupAlignmentDelegateTest, DockedMode) {
170 // TODO: needs unified mode. http://crbug.com/698024. 170 // TODO: needs unified mode. http://crbug.com/698024.
171 if (ShellPort::Get()->IsRunningInMash()) 171 if (Shell::GetAshConfig() == Config::MASH)
172 return; 172 return;
173 173
174 const gfx::Rect toast_size(0, 0, 10, 10); 174 const gfx::Rect toast_size(0, 0, 10, 10);
175 UpdateDisplay("600x600"); 175 UpdateDisplay("600x600");
176 int origin_x = alignment_delegate()->GetToastOriginX(toast_size); 176 int origin_x = alignment_delegate()->GetToastOriginX(toast_size);
177 int baseline = alignment_delegate()->GetBaseLine(); 177 int baseline = alignment_delegate()->GetBaseLine();
178 178
179 // Emulate the docked mode; enter to an extended mode, then invoke 179 // Emulate the docked mode; enter to an extended mode, then invoke
180 // OnNativeDisplaysChanged() with the info for the secondary display only. 180 // OnNativeDisplaysChanged() with the info for the secondary display only.
181 UpdateDisplay("600x600,800x800"); 181 UpdateDisplay("600x600,800x800");
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
224 TEST_F(AshPopupAlignmentDelegateTest, Unified) { 224 TEST_F(AshPopupAlignmentDelegateTest, Unified) {
225 // TODO: needs unified mode. http://crbug.com/698024. 225 // TODO: needs unified mode. http://crbug.com/698024.
226 if (ShellPort::Get()->IsRunningInMash()) 226 if (Shell::GetAshConfig() == Config::MASH)
227 return; 227 return;
228 228
229 display_manager()->SetUnifiedDesktopEnabled(true); 229 display_manager()->SetUnifiedDesktopEnabled(true);
230 230
231 // Reset the delegate as the primary display's shelf will be destroyed during 231 // Reset the delegate as the primary display's shelf will be destroyed during
232 // transition. 232 // transition.
233 SetAlignmentDelegate(nullptr); 233 SetAlignmentDelegate(nullptr);
234 234
235 UpdateDisplay("600x600,800x800"); 235 UpdateDisplay("600x600,800x800");
236 SetAlignmentDelegate( 236 SetAlignmentDelegate(
(...skipping 17 matching lines...) Expand all
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/toast/toast_manager_unittest.cc ('k') | ash/system/web_notification/web_notification_tray_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698