| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/browser/ui/ash/networking_config_delegate_chromeos.h" | 5 #include "chrome/browser/ui/ash/networking_config_delegate_chromeos.h" |
| 6 | 6 |
| 7 #include "ash/login_status.h" | 7 #include "ash/login_status.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.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/network/network_list.h" | 11 #include "ash/system/network/network_list.h" |
| 12 #include "ash/system/network/tray_network.h" | 12 #include "ash/system/network/tray_network.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/macros.h" | 15 #include "base/macros.h" |
| 15 #include "base/strings/string16.h" | 16 #include "base/strings/string16.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 17 #include "chrome/browser/extensions/extension_browsertest.h" | 18 #include "chrome/browser/extensions/extension_browsertest.h" |
| 18 #include "content/public/test/test_utils.h" | 19 #include "content/public/test/test_utils.h" |
| 19 #include "extensions/test/extension_test_message_listener.h" | 20 #include "extensions/test/extension_test_message_listener.h" |
| 20 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
| 21 #include "ui/views/view.h" | 22 #include "ui/views/view.h" |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 51 ASSERT_TRUE(listener.WaitUntilSatisfied()); | 52 ASSERT_TRUE(listener.WaitUntilSatisfied()); |
| 52 | 53 |
| 53 // Open the system tray menu. | 54 // Open the system tray menu. |
| 54 ash::SystemTray* system_tray = | 55 ash::SystemTray* system_tray = |
| 55 ash::Shell::GetPrimaryRootWindowController()->GetSystemTray(); | 56 ash::Shell::GetPrimaryRootWindowController()->GetSystemTray(); |
| 56 system_tray->ShowDefaultView(ash::BUBBLE_CREATE_NEW); | 57 system_tray->ShowDefaultView(ash::BUBBLE_CREATE_NEW); |
| 57 content::RunAllPendingInMessageLoop(); | 58 content::RunAllPendingInMessageLoop(); |
| 58 ASSERT_TRUE(system_tray->HasSystemBubble()); | 59 ASSERT_TRUE(system_tray->HasSystemBubble()); |
| 59 | 60 |
| 60 // Show the network detail view. | 61 // Show the network detail view. |
| 61 ash::TrayNetwork* tray_network = system_tray->GetTrayNetworkForTesting(); | 62 ash::TrayNetwork* tray_network = |
| 63 ash::SystemTrayTestApi(system_tray).tray_network(); |
| 62 system_tray->ShowDetailedView(tray_network, 0, false, ash::BUBBLE_CREATE_NEW); | 64 system_tray->ShowDetailedView(tray_network, 0, false, ash::BUBBLE_CREATE_NEW); |
| 63 content::RunAllPendingInMessageLoop(); | 65 content::RunAllPendingInMessageLoop(); |
| 64 ASSERT_TRUE(tray_network->detailed()); | 66 ASSERT_TRUE(tray_network->detailed()); |
| 65 | 67 |
| 66 // Look for an item with a tooltip saying it is an extension-controlled | 68 // Look for an item with a tooltip saying it is an extension-controlled |
| 67 // network. Searching all children allows this test to avoid knowing about the | 69 // network. Searching all children allows this test to avoid knowing about the |
| 68 // specifics of the view hierarchy. | 70 // specifics of the view hierarchy. |
| 69 base::string16 expected_tooltip = l10n_util::GetStringFUTF16( | 71 base::string16 expected_tooltip = l10n_util::GetStringFUTF16( |
| 70 IDS_ASH_STATUS_TRAY_EXTENSION_CONTROLLED_WIFI, | 72 IDS_ASH_STATUS_TRAY_EXTENSION_CONTROLLED_WIFI, |
| 71 base::UTF8ToUTF16("NetworkingConfigDelegate test extension")); | 73 base::UTF8ToUTF16("NetworkingConfigDelegate test extension")); |
| 72 EXPECT_TRUE(HasChildWithTooltip(tray_network->detailed(), expected_tooltip)); | 74 EXPECT_TRUE(HasChildWithTooltip(tray_network->detailed(), expected_tooltip)); |
| 73 | 75 |
| 74 // Close the system tray menu. | 76 // Close the system tray menu. |
| 75 system_tray->CloseSystemBubble(); | 77 system_tray->CloseSystemBubble(); |
| 76 content::RunAllPendingInMessageLoop(); | 78 content::RunAllPendingInMessageLoop(); |
| 77 } | 79 } |
| 78 | 80 |
| 79 } // namespace | 81 } // namespace |
| OLD | NEW |