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

Unified Diff: chrome/browser/ui/ash/system_tray_client_browsertest.cc

Issue 2839043004: chromeos: Refactor ash SystemTrayDelegate enterprise methods to mojo (Closed)
Patch Set: review comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/ash/system_tray_client.cc ('k') | chrome/browser/ui/ash/system_tray_delegate_chromeos.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/ash/system_tray_client_browsertest.cc
diff --git a/chrome/browser/ui/ash/system_tray_client_browsertest.cc b/chrome/browser/ui/ash/system_tray_client_browsertest.cc
index c19187a7d1054d88a80a25b4b1bbc7be8689ca93..7a8c023f9c3ac8bf912bcae931e4efd0f178fe74 100644
--- a/chrome/browser/ui/ash/system_tray_client_browsertest.cc
+++ b/chrome/browser/ui/ash/system_tray_client_browsertest.cc
@@ -6,24 +6,31 @@
#include "ash/root_window_controller.h"
#include "ash/shell_port.h"
+#include "ash/system/enterprise/tray_enterprise.h"
+#include "ash/system/tray/label_tray_view.h"
#include "ash/system/tray/system_tray.h"
#include "ash/system/update/tray_update.h"
+#include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h"
#include "chrome/browser/upgrade_detector.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "content/public/test/test_utils.h"
-ash::TrayUpdate* GetTrayUpdate() {
+namespace {
+
+// TODO(jamescook): Add a test-only mojo API to get system tray details.
+ash::SystemTray* GetSystemTray() {
return ash::ShellPort::Get()
->GetPrimaryRootWindowController()
- ->GetSystemTray()
- ->tray_update();
+ ->GetSystemTray();
}
+} // namespace
+
using SystemTrayClientTest = InProcessBrowserTest;
// Test that a chrome update shows the update icon in the system menu.
IN_PROC_BROWSER_TEST_F(SystemTrayClientTest, UpdateTrayIcon) {
- ash::TrayUpdate* tray_update = GetTrayUpdate();
+ ash::TrayUpdate* tray_update = GetSystemTray()->tray_update();
// When no update is pending, the icon isn't visible.
EXPECT_FALSE(tray_update->tray_view()->visible());
@@ -38,7 +45,7 @@ IN_PROC_BROWSER_TEST_F(SystemTrayClientTest, UpdateTrayIcon) {
// Test that a flash update causes the update UI to show in the system menu.
IN_PROC_BROWSER_TEST_F(SystemTrayClientTest, FlashUpdateTrayIcon) {
- ash::TrayUpdate* tray_update = GetTrayUpdate();
+ ash::TrayUpdate* tray_update = GetSystemTray()->tray_update();
// When no update is pending, the icon isn't visible.
EXPECT_FALSE(tray_update->tray_view()->visible());
@@ -50,3 +57,23 @@ IN_PROC_BROWSER_TEST_F(SystemTrayClientTest, FlashUpdateTrayIcon) {
// Tray icon is now visible.
EXPECT_TRUE(tray_update->tray_view()->visible());
}
+
+using SystemTrayClientEnterpriseTest = policy::DevicePolicyCrosBrowserTest;
+
+IN_PROC_BROWSER_TEST_F(SystemTrayClientEnterpriseTest, TrayEnterprise) {
+ // Mark the device as enterprise managed.
+ policy::DevicePolicyCrosTestHelper::MarkAsEnterpriseOwnedBy("example.com");
+ content::RunAllPendingInMessageLoop();
+
+ // Open the system tray menu.
+ ash::SystemTray* system_tray = GetSystemTray();
+ system_tray->ShowDefaultView(ash::BUBBLE_CREATE_NEW);
+
+ // Managed devices show an item in the menu.
+ ash::TrayEnterprise* tray_enterprise =
+ system_tray->GetTrayEnterpriseForTesting();
+ ASSERT_TRUE(tray_enterprise->tray_view());
+ EXPECT_TRUE(tray_enterprise->tray_view()->visible());
+
+ system_tray->CloseSystemBubble();
+}
« no previous file with comments | « chrome/browser/ui/ash/system_tray_client.cc ('k') | chrome/browser/ui/ash/system_tray_delegate_chromeos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698