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

Side by Side Diff: chromeos/network/network_connect_unittest.cc

Issue 2664753002: Remove base::StringValue (Closed)
Patch Set: Rebase Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "chromeos/network/network_connect.h" 5 #include "chromeos/network/network_connect.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 protected: 99 protected:
100 void SetupDefaultShillState() { 100 void SetupDefaultShillState() {
101 base::RunLoop().RunUntilIdle(); 101 base::RunLoop().RunUntilIdle();
102 device_test_ = 102 device_test_ =
103 DBusThreadManager::Get()->GetShillDeviceClient()->GetTestInterface(); 103 DBusThreadManager::Get()->GetShillDeviceClient()->GetTestInterface();
104 device_test_->ClearDevices(); 104 device_test_->ClearDevices();
105 device_test_->AddDevice("/device/stub_wifi_device1", shill::kTypeWifi, 105 device_test_->AddDevice("/device/stub_wifi_device1", shill::kTypeWifi,
106 "stub_wifi_device1"); 106 "stub_wifi_device1");
107 device_test_->AddDevice(kCellular1DevicePath, shill::kTypeCellular, 107 device_test_->AddDevice(kCellular1DevicePath, shill::kTypeCellular,
108 "stub_cellular_device1"); 108 "stub_cellular_device1");
109 device_test_->SetDeviceProperty( 109 device_test_->SetDeviceProperty(kCellular1DevicePath,
110 kCellular1DevicePath, shill::kTechnologyFamilyProperty, 110 shill::kTechnologyFamilyProperty,
111 base::StringValue(shill::kNetworkTechnologyGsm)); 111 base::Value(shill::kNetworkTechnologyGsm));
112 112
113 service_test_ = 113 service_test_ =
114 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); 114 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface();
115 service_test_->ClearServices(); 115 service_test_->ClearServices();
116 const bool add_to_visible = true; 116 const bool add_to_visible = true;
117 117
118 // Create a wifi network and set to online. 118 // Create a wifi network and set to online.
119 service_test_->AddService(kWiFi1ServicePath, kWiFi1Guid, "wifi1", 119 service_test_->AddService(kWiFi1ServicePath, kWiFi1Guid, "wifi1",
120 shill::kTypeWifi, shill::kStateIdle, 120 shill::kTypeWifi, shill::kStateIdle,
121 add_to_visible); 121 add_to_visible);
122 service_test_->SetServiceProperty(kWiFi1ServicePath, 122 service_test_->SetServiceProperty(kWiFi1ServicePath,
123 shill::kSecurityClassProperty, 123 shill::kSecurityClassProperty,
124 base::StringValue(shill::kSecurityWep)); 124 base::Value(shill::kSecurityWep));
125 service_test_->SetServiceProperty( 125 service_test_->SetServiceProperty(
126 kWiFi1ServicePath, shill::kConnectableProperty, base::Value(true)); 126 kWiFi1ServicePath, shill::kConnectableProperty, base::Value(true));
127 service_test_->SetServiceProperty(kWiFi1ServicePath, 127 service_test_->SetServiceProperty(
128 shill::kPassphraseProperty, 128 kWiFi1ServicePath, shill::kPassphraseProperty, base::Value("password"));
129 base::StringValue("password"));
130 129
131 // Create a cellular network. 130 // Create a cellular network.
132 service_test_->AddService(kCellular1ServicePath, kCellular1Guid, 131 service_test_->AddService(kCellular1ServicePath, kCellular1Guid,
133 "cellular1", shill::kTypeCellular, 132 "cellular1", shill::kTypeCellular,
134 shill::kStateIdle, add_to_visible); 133 shill::kStateIdle, add_to_visible);
135 service_test_->SetServiceProperty( 134 service_test_->SetServiceProperty(
136 kCellular1ServicePath, shill::kConnectableProperty, base::Value(true)); 135 kCellular1ServicePath, shill::kConnectableProperty, base::Value(true));
137 service_test_->SetServiceProperty( 136 service_test_->SetServiceProperty(
138 kCellular1ServicePath, shill::kActivationStateProperty, 137 kCellular1ServicePath, shill::kActivationStateProperty,
139 base::StringValue(shill::kActivationStateActivated)); 138 base::Value(shill::kActivationStateActivated));
140 service_test_->SetServiceProperty(kCellular1ServicePath, 139 service_test_->SetServiceProperty(kCellular1ServicePath,
141 shill::kOutOfCreditsProperty, 140 shill::kOutOfCreditsProperty,
142 base::Value(false)); 141 base::Value(false));
143 142
144 base::RunLoop().RunUntilIdle(); 143 base::RunLoop().RunUntilIdle();
145 } 144 }
146 145
147 std::unique_ptr<MockDelegate> mock_delegate_; 146 std::unique_ptr<MockDelegate> mock_delegate_;
148 std::unique_ptr<MockTetherDelegate> mock_tether_delegate_; 147 std::unique_ptr<MockTetherDelegate> mock_tether_delegate_;
149 base::MessageLoop message_loop_; 148 base::MessageLoop message_loop_;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 241
243 NetworkConnect::Get()->MaybeShowConfigureUI( 242 NetworkConnect::Get()->MaybeShowConfigureUI(
244 kCellular1Guid, NetworkConnectionHandler::kErrorConnectFailed); 243 kCellular1Guid, NetworkConnectionHandler::kErrorConnectFailed);
245 } 244 }
246 245
247 TEST_F(NetworkConnectTest, ActivateCellular) { 246 TEST_F(NetworkConnectTest, ActivateCellular) {
248 EXPECT_CALL(*mock_delegate_, ShowMobileSetupDialog(kCellular1Guid)); 247 EXPECT_CALL(*mock_delegate_, ShowMobileSetupDialog(kCellular1Guid));
249 248
250 service_test_->SetServiceProperty( 249 service_test_->SetServiceProperty(
251 kCellular1ServicePath, shill::kActivationStateProperty, 250 kCellular1ServicePath, shill::kActivationStateProperty,
252 base::StringValue(shill::kActivationStateNotActivated)); 251 base::Value(shill::kActivationStateNotActivated));
253 base::RunLoop().RunUntilIdle(); 252 base::RunLoop().RunUntilIdle();
254 253
255 NetworkConnect::Get()->ConnectToNetworkId(kCellular1Guid); 254 NetworkConnect::Get()->ConnectToNetworkId(kCellular1Guid);
256 } 255 }
257 256
258 TEST_F(NetworkConnectTest, ActivateCellular_Error) { 257 TEST_F(NetworkConnectTest, ActivateCellular_Error) {
259 EXPECT_CALL(*mock_delegate_, ShowMobileActivationError(kCellular1Guid)); 258 EXPECT_CALL(*mock_delegate_, ShowMobileActivationError(kCellular1Guid));
260 259
261 service_test_->SetServiceProperty( 260 service_test_->SetServiceProperty(
262 kCellular1ServicePath, shill::kActivationStateProperty, 261 kCellular1ServicePath, shill::kActivationStateProperty,
263 base::StringValue(shill::kActivationStateNotActivated)); 262 base::Value(shill::kActivationStateNotActivated));
264 service_test_->SetServiceProperty( 263 service_test_->SetServiceProperty(
265 kCellular1ServicePath, shill::kActivationTypeProperty, 264 kCellular1ServicePath, shill::kActivationTypeProperty,
266 base::StringValue(shill::kActivationTypeNonCellular)); 265 base::Value(shill::kActivationTypeNonCellular));
267 base::RunLoop().RunUntilIdle(); 266 base::RunLoop().RunUntilIdle();
268 267
269 NetworkConnect::Get()->ConnectToNetworkId(kCellular1Guid); 268 NetworkConnect::Get()->ConnectToNetworkId(kCellular1Guid);
270 } 269 }
271 270
272 TEST_F(NetworkConnectTest, ShowMobileSimDialog) { 271 TEST_F(NetworkConnectTest, ShowMobileSimDialog) {
273 EXPECT_CALL(*mock_delegate_, ShowMobileSimDialog()); 272 EXPECT_CALL(*mock_delegate_, ShowMobileSimDialog());
274 273
275 NetworkConnect::Get()->SetTechnologyEnabled(NetworkTypePattern::Cellular(), 274 NetworkConnect::Get()->SetTechnologyEnabled(NetworkTypePattern::Cellular(),
276 false); 275 false);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 TEST_F(NetworkConnectTest, ConnectToTetherNetwork_TetherDelegateNotSet) { 336 TEST_F(NetworkConnectTest, ConnectToTetherNetwork_TetherDelegateNotSet) {
338 EXPECT_CALL(*mock_tether_delegate_, ConnectToNetwork(_)).Times(0); 337 EXPECT_CALL(*mock_tether_delegate_, ConnectToNetwork(_)).Times(0);
339 338
340 NetworkHandler::Get()->network_state_handler()->AddTetherNetworkState( 339 NetworkHandler::Get()->network_state_handler()->AddTetherNetworkState(
341 kTether1Guid, "TetherNetwork"); 340 kTether1Guid, "TetherNetwork");
342 341
343 NetworkConnect::Get()->ConnectToNetworkId(kTether1Guid); 342 NetworkConnect::Get()->ConnectToNetworkId(kTether1Guid);
344 } 343 }
345 344
346 } // namespace chromeos 345 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/network_configuration_handler_unittest.cc ('k') | chromeos/network/network_state_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698