Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/ui/ash/system_tray_client.h" | |
| 6 | |
| 7 #include "ash/common/system/tray/system_tray.h" | |
| 8 #include "ash/common/system/update/tray_update.h" | |
| 9 #include "ash/common/wm_root_window_controller.h" | |
| 10 #include "ash/common/wm_shell.h" | |
| 11 #include "chrome/browser/upgrade_detector.h" | |
| 12 #include "chrome/test/base/in_process_browser_test.h" | |
| 13 #include "content/public/test/test_utils.h" | |
| 14 | |
| 15 ash::TrayUpdate* GetTrayUpdate() { | |
| 16 return ash::WmShell::Get() | |
| 17 ->GetPrimaryRootWindowController() | |
| 18 ->GetSystemTray() | |
| 19 ->GetTrayUpdateForTesting(); | |
| 20 } | |
| 21 | |
| 22 using SystemTrayClientTest = InProcessBrowserTest; | |
| 23 | |
| 24 // Test that a chrome update shows the update icon in the system menu. | |
| 25 IN_PROC_BROWSER_TEST_F(SystemTrayClientTest, UpdateTrayIcon) { | |
| 26 ash::TrayUpdate* tray_update = GetTrayUpdate(); | |
| 27 | |
| 28 // When no update is pending, the icon isn't visible. | |
| 29 EXPECT_FALSE(tray_update->tray_view()->visible()); | |
| 30 | |
| 31 // Simulate an upgrade. This sends a mojo message to ash. | |
| 32 UpgradeDetector::GetInstance()->NotifyUpgradeRecommended(); | |
| 33 content::RunAllPendingInMessageLoop(); | |
| 34 | |
| 35 // Tray icon is now visible. | |
| 36 EXPECT_TRUE(tray_update->tray_view()->visible()); | |
| 37 } | |
| 38 | |
| 39 // Test that a flash update causes the update UI to show in the system menu. | |
| 40 IN_PROC_BROWSER_TEST_F(SystemTrayClientTest, FlashUpdateTrayIcon) { | |
| 41 ash::TrayUpdate* tray_update = GetTrayUpdate(); | |
| 42 | |
| 43 // When no update is pending, the icon isn't visible. | |
| 44 EXPECT_FALSE(tray_update->tray_view()->visible()); | |
| 45 | |
| 46 // Simualte a Flash update. This sends a mojo message to ash. | |
|
msw
2016/12/09 23:41:51
nit: Simulate
James Cook
2016/12/12 18:15:12
Done.
| |
| 47 SystemTrayClient::Get()->SetFlashUpdateAvailable(); | |
| 48 content::RunAllPendingInMessageLoop(); | |
| 49 | |
| 50 // Tray icon is now visible. | |
| 51 EXPECT_TRUE(tray_update->tray_view()->visible()); | |
| 52 } | |
| OLD | NEW |