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

Side by Side Diff: chrome/browser/chromeos/shutdown_policy_browsertest.cc

Issue 2931643002: chromeos: Introduce ash::SystemTrayTestApi (Closed)
Patch Set: review comments Created 3 years, 6 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <memory> 5 #include <memory>
6 #include <string> 6 #include <string>
7 7
8 #include "ash/login_status.h" 8 #include "ash/login_status.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/strings/grit/ash_strings.h" 10 #include "ash/strings/grit/ash_strings.h"
11 #include "ash/system/tiles/tiles_default_view.h" 11 #include "ash/system/tiles/tiles_default_view.h"
12 #include "ash/system/tiles/tray_tiles.h" 12 #include "ash/system/tiles/tray_tiles.h"
13 #include "ash/system/tray/system_tray.h" 13 #include "ash/system/tray/system_tray.h"
14 #include "ash/system/tray/system_tray_test_api.h"
14 #include "base/command_line.h" 15 #include "base/command_line.h"
15 #include "base/location.h" 16 #include "base/location.h"
16 #include "base/macros.h" 17 #include "base/macros.h"
17 #include "base/run_loop.h" 18 #include "base/run_loop.h"
18 #include "base/single_thread_task_runner.h" 19 #include "base/single_thread_task_runner.h"
19 #include "base/strings/stringprintf.h" 20 #include "base/strings/stringprintf.h"
20 #include "base/threading/thread_task_runner_handle.h" 21 #include "base/threading/thread_task_runner_handle.h"
21 #include "chrome/browser/chrome_notification_types.h" 22 #include "chrome/browser/chrome_notification_types.h"
22 #include "chrome/browser/chromeos/login/lock/screen_locker.h" 23 #include "chrome/browser/chromeos/login/lock/screen_locker.h"
23 #include "chrome/browser/chromeos/login/lock/screen_locker_tester.h" 24 #include "chrome/browser/chromeos/login/lock/screen_locker_tester.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } 151 }
151 152
152 // Closes the system tray menu. This deletes the tray views. 153 // Closes the system tray menu. This deletes the tray views.
153 void CloseSystemTrayMenu() { 154 void CloseSystemTrayMenu() {
154 ash::Shell::Get()->GetPrimarySystemTray()->CloseSystemBubble(); 155 ash::Shell::Get()->GetPrimarySystemTray()->CloseSystemBubble();
155 } 156 }
156 157
157 // Gets the shutdown button view. 158 // Gets the shutdown button view.
158 const views::View* GetShutdownButton() { 159 const views::View* GetShutdownButton() {
159 ash::SystemTray* tray = ash::Shell::Get()->GetPrimarySystemTray(); 160 ash::SystemTray* tray = ash::Shell::Get()->GetPrimarySystemTray();
160 return tray->GetTrayTilesForTesting() 161 return ash::SystemTrayTestApi(tray)
162 .tray_tiles()
161 ->GetDefaultViewForTesting() 163 ->GetDefaultViewForTesting()
162 ->GetShutdownButtonViewForTest(); 164 ->GetShutdownButtonViewForTest();
163 } 165 }
164 166
165 // Returns true if the shutdown button's tooltip matches the text of the 167 // Returns true if the shutdown button's tooltip matches the text of the
166 // resource |message_id|. 168 // resource |message_id|.
167 bool HasShutdownButtonTooltip(int message_id) { 169 bool HasShutdownButtonTooltip(int message_id) {
168 const views::View* button = GetShutdownButton(); 170 const views::View* button = GetShutdownButton();
169 base::string16 actual_tooltip; 171 base::string16 actual_tooltip;
170 button->GetTooltipText(gfx::Point(), &actual_tooltip); 172 button->GetTooltipText(gfx::Point(), &actual_tooltip);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 PrepareAndRunScript("restart-header-bar-item", false); 336 PrepareAndRunScript("restart-header-bar-item", false);
335 PrepareAndRunScript("shutdown-header-bar-item", true); 337 PrepareAndRunScript("shutdown-header-bar-item", true);
336 338
337 UpdateRebootOnShutdownPolicy(false); 339 UpdateRebootOnShutdownPolicy(false);
338 RefreshDevicePolicy(); 340 RefreshDevicePolicy();
339 PrepareAndRunScript("restart-header-bar-item", true); 341 PrepareAndRunScript("restart-header-bar-item", true);
340 PrepareAndRunScript("shutdown-header-bar-item", false); 342 PrepareAndRunScript("shutdown-header-bar-item", false);
341 } 343 }
342 344
343 } // namespace chromeos 345 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698