| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 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 "ash/system/enterprise/tray_enterprise.h" |
| 6 |
| 7 #include "ash/shell.h" |
| 8 #include "ash/system/tray/label_tray_view.h" |
| 9 #include "ash/system/tray/system_tray.h" |
| 10 #include "ash/system/tray/system_tray_controller.h" |
| 11 #include "ash/test/ash_test_base.h" |
| 12 |
| 13 namespace ash { |
| 14 |
| 15 using TrayEnterpriseTest = test::AshTestBase; |
| 16 |
| 17 TEST_F(TrayEnterpriseTest, ItemVisible) { |
| 18 SystemTray* system_tray = GetPrimarySystemTray(); |
| 19 TrayEnterprise* tray_enterprise = system_tray->GetTrayEnterpriseForTesting(); |
| 20 |
| 21 // By default there is no enterprise item in the menu. |
| 22 system_tray->ShowDefaultView(BUBBLE_CREATE_NEW); |
| 23 EXPECT_FALSE(tray_enterprise->tray_view()->visible()); |
| 24 system_tray->CloseSystemBubble(); |
| 25 |
| 26 // Simulate enterprise information becoming available. |
| 27 const bool active_directory = false; |
| 28 Shell::Get()->system_tray_controller()->SetEnterpriseDomain("example.com", |
| 29 active_directory); |
| 30 |
| 31 // Enterprise managed devices show an item. |
| 32 system_tray->ShowDefaultView(BUBBLE_CREATE_NEW); |
| 33 EXPECT_TRUE(tray_enterprise->tray_view()->visible()); |
| 34 system_tray->CloseSystemBubble(); |
| 35 } |
| 36 |
| 37 TEST_F(TrayEnterpriseTest, ItemVisibleForActiveDirectory) { |
| 38 SystemTray* system_tray = GetPrimarySystemTray(); |
| 39 TrayEnterprise* tray_enterprise = system_tray->GetTrayEnterpriseForTesting(); |
| 40 |
| 41 // Simulate enterprise information becoming available. Active Directory |
| 42 // devices do not have a domain. |
| 43 const std::string empty_domain; |
| 44 const bool active_directory = true; |
| 45 Shell::Get()->system_tray_controller()->SetEnterpriseDomain(empty_domain, |
| 46 active_directory); |
| 47 |
| 48 // Active Directory managed devices show an item. |
| 49 system_tray->ShowDefaultView(BUBBLE_CREATE_NEW); |
| 50 EXPECT_TRUE(tray_enterprise->tray_view()->visible()); |
| 51 system_tray->CloseSystemBubble(); |
| 52 } |
| 53 |
| 54 } // namespace ash |
| OLD | NEW |