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

Side by Side Diff: ash/system/web_notification/web_notification_tray_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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/web_notification_tray.h" 5 #include "ash/common/system/web_notification/web_notification_tray.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/common/shelf/shelf_layout_manager.h" 10 #include "ash/common/shelf/shelf_layout_manager.h"
11 #include "ash/common/shelf/wm_shelf.h" 11 #include "ash/common/shelf/wm_shelf.h"
12 #include "ash/common/system/status_area_widget.h" 12 #include "ash/common/system/status_area_widget.h"
13 #include "ash/common/system/tray/system_tray.h" 13 #include "ash/common/system/tray/system_tray.h"
14 #include "ash/common/system/tray/system_tray_item.h" 14 #include "ash/common/system/tray/system_tray_item.h"
15 #include "ash/common/system/web_notification/ash_popup_alignment_delegate.h" 15 #include "ash/common/system/web_notification/ash_popup_alignment_delegate.h"
16 #include "ash/common/test/test_system_tray_delegate.h" 16 #include "ash/common/test/test_system_tray_delegate.h"
17 #include "ash/common/wm/window_state.h" 17 #include "ash/common/wm/window_state.h"
18 #include "ash/common/wm_lookup.h" 18 #include "ash/common/wm_lookup.h"
19 #include "ash/common/wm_shell.h"
19 #include "ash/common/wm_window.h" 20 #include "ash/common/wm_window.h"
20 #include "ash/public/cpp/shell_window_ids.h" 21 #include "ash/public/cpp/shell_window_ids.h"
21 #include "ash/shell.h" 22 #include "ash/shell.h"
22 #include "ash/system/chromeos/screen_layout_observer.h" 23 #include "ash/system/chromeos/screen_layout_observer.h"
23 #include "ash/test/ash_test_base.h" 24 #include "ash/test/ash_test_base.h"
24 #include "ash/test/status_area_widget_test_helper.h" 25 #include "ash/test/status_area_widget_test_helper.h"
25 #include "base/memory/ptr_util.h" 26 #include "base/memory/ptr_util.h"
26 #include "base/strings/stringprintf.h" 27 #include "base/strings/stringprintf.h"
27 #include "base/strings/utf_string_conversions.h" 28 #include "base/strings/utf_string_conversions.h"
28 #include "ui/display/display.h" 29 #include "ui/display/display.h"
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 GetTray()->ShowPopups(); 248 GetTray()->ShowPopups();
248 EXPECT_TRUE(GetTray()->IsPopupVisible()); 249 EXPECT_TRUE(GetTray()->IsPopupVisible());
249 EXPECT_EQ(notifications_to_add, GetMessageCenter()->NotificationCount()); 250 EXPECT_EQ(notifications_to_add, GetMessageCenter()->NotificationCount());
250 NotificationList::PopupNotifications popups = 251 NotificationList::PopupNotifications popups =
251 GetMessageCenter()->GetPopupNotifications(); 252 GetMessageCenter()->GetPopupNotifications();
252 EXPECT_EQ(message_center::kMaxVisiblePopupNotifications, popups.size()); 253 EXPECT_EQ(message_center::kMaxVisiblePopupNotifications, popups.size());
253 } 254 }
254 255
255 // Verifies if the notification appears on both displays when extended mode. 256 // Verifies if the notification appears on both displays when extended mode.
256 TEST_F(WebNotificationTrayTest, PopupShownOnBothDisplays) { 257 TEST_F(WebNotificationTrayTest, PopupShownOnBothDisplays) {
258 // TODO: needs ScreenLayoutObserver, http://crbug.com/696752.
259 if (WmShell::Get()->IsRunningInMash())
260 return;
261
257 Shell::GetInstance() 262 Shell::GetInstance()
258 ->screen_layout_observer() 263 ->screen_layout_observer()
259 ->set_show_notifications_for_testing(true); 264 ->set_show_notifications_for_testing(true);
260 UpdateDisplay("400x400,200x200"); 265 UpdateDisplay("400x400,200x200");
261 // UpdateDisplay() creates the display notifications, so popup is visible. 266 // UpdateDisplay() creates the display notifications, so popup is visible.
262 EXPECT_TRUE(GetTray()->IsPopupVisible()); 267 EXPECT_TRUE(GetTray()->IsPopupVisible());
263 WebNotificationTray* secondary_tray = GetSecondaryTray(); 268 WebNotificationTray* secondary_tray = GetSecondaryTray();
264 ASSERT_TRUE(secondary_tray); 269 ASSERT_TRUE(secondary_tray);
265 EXPECT_TRUE(secondary_tray->IsPopupVisible()); 270 EXPECT_TRUE(secondary_tray->IsPopupVisible());
266 271
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 int bottom_second = GetPopupWorkAreaBottomForTray(GetSecondaryTray()); 393 int bottom_second = GetPopupWorkAreaBottomForTray(GetSecondaryTray());
389 394
390 // System tray is created on the primary display. The popups in the secondary 395 // System tray is created on the primary display. The popups in the secondary
391 // tray aren't affected. 396 // tray aren't affected.
392 GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW); 397 GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW);
393 EXPECT_GT(bottom, GetPopupWorkAreaBottom()); 398 EXPECT_GT(bottom, GetPopupWorkAreaBottom());
394 EXPECT_EQ(bottom_second, GetPopupWorkAreaBottomForTray(GetSecondaryTray())); 399 EXPECT_EQ(bottom_second, GetPopupWorkAreaBottomForTray(GetSecondaryTray()));
395 } 400 }
396 401
397 } // namespace ash 402 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698