| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/system/chromeos/network/network_state_notifier.h" | 5 #include "ash/system/chromeos/network/network_state_notifier.h" |
| 6 | 6 |
| 7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
| 8 #include "ash/shelf/shelf_widget.h" | 8 #include "ash/shelf/shelf_widget.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/system/chromeos/network/network_connect.h" | 10 #include "ash/system/chromeos/network/network_connect.h" |
| 11 #include "ash/system/status_area_widget.h" | 11 #include "ash/system/status_area_widget.h" |
| 12 #include "ash/system/tray/system_tray.h" | 12 #include "ash/system/tray/system_tray.h" |
| 13 #include "ash/test/ash_test_base.h" | 13 #include "ash/test/ash_test_base.h" |
| 14 #include "chromeos/dbus/dbus_thread_manager.h" | 14 #include "chromeos/dbus/dbus_thread_manager.h" |
| 15 #include "chromeos/dbus/shill_device_client.h" | 15 #include "chromeos/dbus/shill_device_client.h" |
| 16 #include "chromeos/dbus/shill_service_client.h" | 16 #include "chromeos/dbus/shill_service_client.h" |
| 17 #include "third_party/cros_system_api/dbus/service_constants.h" | 17 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 18 #include "ui/message_center/message_center.h" |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| 21 ash::SystemTray* GetSystemTray() { | 22 ash::SystemTray* GetSystemTray() { |
| 22 return ash::Shell::GetPrimaryRootWindowController()->shelf()-> | 23 return ash::Shell::GetPrimaryRootWindowController()->shelf()-> |
| 23 status_area_widget()->system_tray(); | 24 status_area_widget()->system_tray(); |
| 24 } | 25 } |
| 25 | 26 |
| 26 } // namespace | 27 } // namespace |
| 27 | 28 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 84 |
| 84 private: | 85 private: |
| 85 DISALLOW_COPY_AND_ASSIGN(NetworkStateNotifierTest); | 86 DISALLOW_COPY_AND_ASSIGN(NetworkStateNotifierTest); |
| 86 }; | 87 }; |
| 87 | 88 |
| 88 TEST_F(NetworkStateNotifierTest, ConnectionFailure) { | 89 TEST_F(NetworkStateNotifierTest, ConnectionFailure) { |
| 89 EXPECT_FALSE(GetSystemTray()->HasNotificationBubble()); | 90 EXPECT_FALSE(GetSystemTray()->HasNotificationBubble()); |
| 90 ash::network_connect::ConnectToNetwork("wifi1", NULL /* owning_window */); | 91 ash::network_connect::ConnectToNetwork("wifi1", NULL /* owning_window */); |
| 91 RunAllPendingInMessageLoop(); | 92 RunAllPendingInMessageLoop(); |
| 92 // Failure should spawn a notification. | 93 // Failure should spawn a notification. |
| 93 EXPECT_TRUE(GetSystemTray()->CloseNotificationBubbleForTest()); | 94 message_center::MessageCenter* message_center = |
| 95 message_center::MessageCenter::Get(); |
| 96 EXPECT_TRUE(message_center->HasNotification( |
| 97 network_connect::kNetworkConnectNotificationId)); |
| 94 } | 98 } |
| 95 | 99 |
| 96 } // namespace test | 100 } // namespace test |
| 97 } // namespace ash | 101 } // namespace ash |
| OLD | NEW |