| 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 "ui/chromeos/network/network_state_notifier.h" | 5 #include "ui/chromeos/network/network_state_notifier.h" |
| 6 | 6 |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "chromeos/dbus/dbus_thread_manager.h" | 8 #include "chromeos/dbus/dbus_thread_manager.h" |
| 9 #include "chromeos/dbus/shill_device_client.h" | 9 #include "chromeos/dbus/shill_device_client.h" |
| 10 #include "chromeos/dbus/shill_service_client.h" | 10 #include "chromeos/dbus/shill_service_client.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 shill::kTypeCellular, "stub_cellular_device1"); | 80 shill::kTypeCellular, "stub_cellular_device1"); |
| 81 | 81 |
| 82 ShillServiceClient::TestInterface* service_test = | 82 ShillServiceClient::TestInterface* service_test = |
| 83 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); | 83 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); |
| 84 service_test->ClearServices(); | 84 service_test->ClearServices(); |
| 85 const bool add_to_visible = true; | 85 const bool add_to_visible = true; |
| 86 // Create a wifi network and set to online. | 86 // Create a wifi network and set to online. |
| 87 service_test->AddService("/service/wifi1", "wifi1_guid", "wifi1", | 87 service_test->AddService("/service/wifi1", "wifi1_guid", "wifi1", |
| 88 shill::kTypeWifi, shill::kStateIdle, | 88 shill::kTypeWifi, shill::kStateIdle, |
| 89 add_to_visible); | 89 add_to_visible); |
| 90 service_test->SetServiceProperty("wifi1", shill::kSecurityProperty, | 90 service_test->SetServiceProperty("wifi1", shill::kSecurityClassProperty, |
| 91 base::StringValue(shill::kSecurityWep)); | 91 base::StringValue(shill::kSecurityWep)); |
| 92 service_test->SetServiceProperty("wifi1", shill::kConnectableProperty, | 92 service_test->SetServiceProperty("wifi1", shill::kConnectableProperty, |
| 93 base::FundamentalValue(true)); | 93 base::FundamentalValue(true)); |
| 94 service_test->SetServiceProperty("wifi1", shill::kPassphraseProperty, | 94 service_test->SetServiceProperty("wifi1", shill::kPassphraseProperty, |
| 95 base::StringValue("failure")); | 95 base::StringValue("failure")); |
| 96 base::RunLoop().RunUntilIdle(); | 96 base::RunLoop().RunUntilIdle(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 scoped_ptr<NetworkConnectTestDelegate> network_connect_delegate_; | 99 scoped_ptr<NetworkConnectTestDelegate> network_connect_delegate_; |
| 100 base::MessageLoop message_loop_; | 100 base::MessageLoop message_loop_; |
| 101 | 101 |
| 102 private: | 102 private: |
| 103 DISALLOW_COPY_AND_ASSIGN(NetworkStateNotifierTest); | 103 DISALLOW_COPY_AND_ASSIGN(NetworkStateNotifierTest); |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 TEST_F(NetworkStateNotifierTest, ConnectionFailure) { | 106 TEST_F(NetworkStateNotifierTest, ConnectionFailure) { |
| 107 NetworkConnect::Get()->ConnectToNetwork("wifi1"); | 107 NetworkConnect::Get()->ConnectToNetwork("wifi1"); |
| 108 base::RunLoop().RunUntilIdle(); | 108 base::RunLoop().RunUntilIdle(); |
| 109 // Failure should spawn a notification. | 109 // Failure should spawn a notification. |
| 110 message_center::MessageCenter* message_center = | 110 message_center::MessageCenter* message_center = |
| 111 message_center::MessageCenter::Get(); | 111 message_center::MessageCenter::Get(); |
| 112 EXPECT_TRUE(message_center->FindVisibleNotificationById( | 112 EXPECT_TRUE(message_center->FindVisibleNotificationById( |
| 113 NetworkStateNotifier::kNetworkConnectNotificationId)); | 113 NetworkStateNotifier::kNetworkConnectNotificationId)); |
| 114 } | 114 } |
| 115 | 115 |
| 116 } // namespace test | 116 } // namespace test |
| 117 } // namespace ui | 117 } // namespace ui |
| OLD | NEW |