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

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

Issue 2666093002: Remove base::FundamentalValue (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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::StringValue(shill::kSecurityWep));
125 service_test_->SetServiceProperty(kWiFi1ServicePath, 125 service_test_->SetServiceProperty(
126 shill::kConnectableProperty, 126 kWiFi1ServicePath, shill::kConnectableProperty, base::Value(true));
127 base::FundamentalValue(true));
128 service_test_->SetServiceProperty(kWiFi1ServicePath, 127 service_test_->SetServiceProperty(kWiFi1ServicePath,
129 shill::kPassphraseProperty, 128 shill::kPassphraseProperty,
130 base::StringValue("password")); 129 base::StringValue("password"));
131 130
132 // Create a cellular network. 131 // Create a cellular network.
133 service_test_->AddService(kCellular1ServicePath, kCellular1Guid, 132 service_test_->AddService(kCellular1ServicePath, kCellular1Guid,
134 "cellular1", shill::kTypeCellular, 133 "cellular1", shill::kTypeCellular,
135 shill::kStateIdle, add_to_visible); 134 shill::kStateIdle, add_to_visible);
136 service_test_->SetServiceProperty(kCellular1ServicePath, 135 service_test_->SetServiceProperty(
137 shill::kConnectableProperty, 136 kCellular1ServicePath, shill::kConnectableProperty, base::Value(true));
138 base::FundamentalValue(true));
139 service_test_->SetServiceProperty( 137 service_test_->SetServiceProperty(
140 kCellular1ServicePath, shill::kActivationStateProperty, 138 kCellular1ServicePath, shill::kActivationStateProperty,
141 base::StringValue(shill::kActivationStateActivated)); 139 base::StringValue(shill::kActivationStateActivated));
142 service_test_->SetServiceProperty(kCellular1ServicePath, 140 service_test_->SetServiceProperty(kCellular1ServicePath,
143 shill::kOutOfCreditsProperty, 141 shill::kOutOfCreditsProperty,
144 base::FundamentalValue(false)); 142 base::Value(false));
145 143
146 base::RunLoop().RunUntilIdle(); 144 base::RunLoop().RunUntilIdle();
147 } 145 }
148 146
149 std::unique_ptr<MockDelegate> mock_delegate_; 147 std::unique_ptr<MockDelegate> mock_delegate_;
150 std::unique_ptr<MockTetherDelegate> mock_tether_delegate_; 148 std::unique_ptr<MockTetherDelegate> mock_tether_delegate_;
151 base::MessageLoop message_loop_; 149 base::MessageLoop message_loop_;
152 ShillDeviceClient::TestInterface* device_test_; 150 ShillDeviceClient::TestInterface* device_test_;
153 ShillServiceClient::TestInterface* service_test_; 151 ShillServiceClient::TestInterface* service_test_;
154 152
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 EXPECT_CALL(*mock_delegate_, ShowNetworkSettings(kCellular1Guid)); 229 EXPECT_CALL(*mock_delegate_, ShowNetworkSettings(kCellular1Guid));
232 230
233 NetworkConnect::Get()->MaybeShowConfigureUI( 231 NetworkConnect::Get()->MaybeShowConfigureUI(
234 kCellular1Guid, NetworkConnectionHandler::kErrorConnectFailed); 232 kCellular1Guid, NetworkConnectionHandler::kErrorConnectFailed);
235 } 233 }
236 234
237 TEST_F(NetworkConnectTest, ShowNetworkSettings_CellOutOfCredits) { 235 TEST_F(NetworkConnectTest, ShowNetworkSettings_CellOutOfCredits) {
238 EXPECT_CALL(*mock_delegate_, ShowNetworkSettings(kCellular1Guid)).Times(0); 236 EXPECT_CALL(*mock_delegate_, ShowNetworkSettings(kCellular1Guid)).Times(0);
239 EXPECT_CALL(*mock_delegate_, ShowMobileSetupDialog(kCellular1Guid)); 237 EXPECT_CALL(*mock_delegate_, ShowMobileSetupDialog(kCellular1Guid));
240 238
241 service_test_->SetServiceProperty(kCellular1ServicePath, 239 service_test_->SetServiceProperty(
242 shill::kOutOfCreditsProperty, 240 kCellular1ServicePath, shill::kOutOfCreditsProperty, base::Value(true));
243 base::FundamentalValue(true));
244 base::RunLoop().RunUntilIdle(); 241 base::RunLoop().RunUntilIdle();
245 242
246 NetworkConnect::Get()->MaybeShowConfigureUI( 243 NetworkConnect::Get()->MaybeShowConfigureUI(
247 kCellular1Guid, NetworkConnectionHandler::kErrorConnectFailed); 244 kCellular1Guid, NetworkConnectionHandler::kErrorConnectFailed);
248 } 245 }
249 246
250 TEST_F(NetworkConnectTest, ActivateCellular) { 247 TEST_F(NetworkConnectTest, ActivateCellular) {
251 EXPECT_CALL(*mock_delegate_, ShowMobileSetupDialog(kCellular1Guid)); 248 EXPECT_CALL(*mock_delegate_, ShowMobileSetupDialog(kCellular1Guid));
252 249
253 service_test_->SetServiceProperty( 250 service_test_->SetServiceProperty(
(...skipping 17 matching lines...) Expand all
271 268
272 NetworkConnect::Get()->ConnectToNetworkId(kCellular1Guid); 269 NetworkConnect::Get()->ConnectToNetworkId(kCellular1Guid);
273 } 270 }
274 271
275 TEST_F(NetworkConnectTest, ShowMobileSimDialog) { 272 TEST_F(NetworkConnectTest, ShowMobileSimDialog) {
276 EXPECT_CALL(*mock_delegate_, ShowMobileSimDialog()); 273 EXPECT_CALL(*mock_delegate_, ShowMobileSimDialog());
277 274
278 NetworkConnect::Get()->SetTechnologyEnabled(NetworkTypePattern::Cellular(), 275 NetworkConnect::Get()->SetTechnologyEnabled(NetworkTypePattern::Cellular(),
279 false); 276 false);
280 277
281 device_test_->SetDeviceProperty(kCellular1DevicePath, 278 device_test_->SetDeviceProperty(
282 shill::kSIMPresentProperty, 279 kCellular1DevicePath, shill::kSIMPresentProperty, base::Value(true));
283 base::FundamentalValue(true));
284 device_test_->SetSimLocked(kCellular1DevicePath, true); 280 device_test_->SetSimLocked(kCellular1DevicePath, true);
285 281
286 base::RunLoop().RunUntilIdle(); 282 base::RunLoop().RunUntilIdle();
287 283
288 NetworkConnect::Get()->SetTechnologyEnabled(NetworkTypePattern::Cellular(), 284 NetworkConnect::Get()->SetTechnologyEnabled(NetworkTypePattern::Cellular(),
289 true); 285 true);
290 } 286 }
291 287
292 TEST_F(NetworkConnectTest, ShowMobileSimDialog_SimAbsent) { 288 TEST_F(NetworkConnectTest, ShowMobileSimDialog_SimAbsent) {
293 EXPECT_CALL(*mock_delegate_, ShowMobileSimDialog()).Times(0); 289 EXPECT_CALL(*mock_delegate_, ShowMobileSimDialog()).Times(0);
294 290
295 NetworkConnect::Get()->SetTechnologyEnabled(NetworkTypePattern::Cellular(), 291 NetworkConnect::Get()->SetTechnologyEnabled(NetworkTypePattern::Cellular(),
296 false); 292 false);
297 293
298 device_test_->SetDeviceProperty(kCellular1DevicePath, 294 device_test_->SetDeviceProperty(
299 shill::kSIMPresentProperty, 295 kCellular1DevicePath, shill::kSIMPresentProperty, base::Value(false));
300 base::FundamentalValue(false));
301 device_test_->SetSimLocked(kCellular1DevicePath, true); 296 device_test_->SetSimLocked(kCellular1DevicePath, true);
302 297
303 base::RunLoop().RunUntilIdle(); 298 base::RunLoop().RunUntilIdle();
304 299
305 NetworkConnect::Get()->SetTechnologyEnabled(NetworkTypePattern::Cellular(), 300 NetworkConnect::Get()->SetTechnologyEnabled(NetworkTypePattern::Cellular(),
306 true); 301 true);
307 } 302 }
308 303
309 TEST_F(NetworkConnectTest, ShowMobileSimDialog_SimUnlocked) { 304 TEST_F(NetworkConnectTest, ShowMobileSimDialog_SimUnlocked) {
310 EXPECT_CALL(*mock_delegate_, ShowMobileSimDialog()).Times(0); 305 EXPECT_CALL(*mock_delegate_, ShowMobileSimDialog()).Times(0);
311 306
312 NetworkConnect::Get()->SetTechnologyEnabled(NetworkTypePattern::Cellular(), 307 NetworkConnect::Get()->SetTechnologyEnabled(NetworkTypePattern::Cellular(),
313 false); 308 false);
314 309
315 device_test_->SetDeviceProperty(kCellular1DevicePath, 310 device_test_->SetDeviceProperty(
316 shill::kSIMPresentProperty, 311 kCellular1DevicePath, shill::kSIMPresentProperty, base::Value(true));
317 base::FundamentalValue(true));
318 device_test_->SetSimLocked(kCellular1DevicePath, false); 312 device_test_->SetSimLocked(kCellular1DevicePath, false);
319 313
320 base::RunLoop().RunUntilIdle(); 314 base::RunLoop().RunUntilIdle();
321 315
322 NetworkConnect::Get()->SetTechnologyEnabled(NetworkTypePattern::Cellular(), 316 NetworkConnect::Get()->SetTechnologyEnabled(NetworkTypePattern::Cellular(),
323 true); 317 true);
324 } 318 }
325 319
326 TEST_F(NetworkConnectTest, ConnectToTetherNetwork) { 320 TEST_F(NetworkConnectTest, ConnectToTetherNetwork) {
327 EXPECT_CALL(*mock_tether_delegate_, ConnectToNetwork(kTether1Guid)); 321 EXPECT_CALL(*mock_tether_delegate_, ConnectToNetwork(kTether1Guid));
(...skipping 15 matching lines...) Expand all
343 TEST_F(NetworkConnectTest, ConnectToTetherNetwork_TetherDelegateNotSet) { 337 TEST_F(NetworkConnectTest, ConnectToTetherNetwork_TetherDelegateNotSet) {
344 EXPECT_CALL(*mock_tether_delegate_, ConnectToNetwork(_)).Times(0); 338 EXPECT_CALL(*mock_tether_delegate_, ConnectToNetwork(_)).Times(0);
345 339
346 NetworkHandler::Get()->network_state_handler()->AddTetherNetworkState( 340 NetworkHandler::Get()->network_state_handler()->AddTetherNetworkState(
347 kTether1Guid, "TetherNetwork"); 341 kTether1Guid, "TetherNetwork");
348 342
349 NetworkConnect::Get()->ConnectToNetworkId(kTether1Guid); 343 NetworkConnect::Get()->ConnectToNetworkId(kTether1Guid);
350 } 344 }
351 345
352 } // namespace chromeos 346 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/shill_service_client_unittest.cc ('k') | chromeos/network/network_device_handler_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698