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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 EXPECT_CALL(*mock_service_client_, GetProperties(_, _)) | 354 EXPECT_CALL(*mock_service_client_, GetProperties(_, _)) |
355 .WillOnce( | 355 .WillOnce( |
356 Invoke(this, &NetworkConfigurationHandlerTest::OnGetProperties)); | 356 Invoke(this, &NetworkConfigurationHandlerTest::OnGetProperties)); |
357 network_configuration_handler_->GetShillProperties( | 357 network_configuration_handler_->GetShillProperties( |
358 service_path, | 358 service_path, |
359 base::Bind(&DictionaryValueCallback, service_path, expected_json), | 359 base::Bind(&DictionaryValueCallback, service_path, expected_json), |
360 base::Bind(&ErrorCallback)); | 360 base::Bind(&ErrorCallback)); |
361 base::RunLoop().RunUntilIdle(); | 361 base::RunLoop().RunUntilIdle(); |
362 } | 362 } |
363 | 363 |
| 364 TEST_F(NetworkConfigurationHandlerTest, GetProperties_TetherNetwork) { |
| 365 network_state_handler_->SetTetherTechnologyState( |
| 366 NetworkStateHandler::TechnologyState::TECHNOLOGY_ENABLED); |
| 367 |
| 368 std::string kTetherGuid = "TetherGuid"; |
| 369 network_state_handler_->AddTetherNetworkState( |
| 370 kTetherGuid, "TetherNetworkName", "TetherNetworkCarrier", |
| 371 100 /* battery_percentage */, 100 /* signal_strength */); |
| 372 |
| 373 std::string expected_json = |
| 374 "{\n " |
| 375 "\"GUID\": \"TetherGuid\",\n " |
| 376 "\"Name\": \"TetherNetworkName\",\n " |
| 377 "\"Priority\": 0,\n " |
| 378 "\"Profile\": \"\",\n " |
| 379 "\"SecurityClass\": \"\",\n " |
| 380 "\"State\": \"\",\n " |
| 381 "\"Tether.BatteryPercentage\": 100,\n " |
| 382 "\"Tether.Carrier\": \"TetherNetworkCarrier\",\n " |
| 383 "\"Tether.SignalStrength\": 100,\n " |
| 384 "\"Type\": \"wifi-tether\"\n" |
| 385 "}\n"; |
| 386 |
| 387 // Tether networks use service path and GUID interchangeably. |
| 388 std::string& tether_service_path = kTetherGuid; |
| 389 network_configuration_handler_->GetShillProperties( |
| 390 tether_service_path, |
| 391 base::Bind(&DictionaryValueCallback, tether_service_path, expected_json), |
| 392 base::Bind(&ErrorCallback)); |
| 393 } |
| 394 |
364 TEST_F(NetworkConfigurationHandlerTest, SetProperties) { | 395 TEST_F(NetworkConfigurationHandlerTest, SetProperties) { |
365 std::string service_path = "/service/1"; | 396 std::string service_path = "/service/1"; |
366 std::string networkName = "MyNetwork"; | 397 std::string networkName = "MyNetwork"; |
367 std::string key = "SSID"; | 398 std::string key = "SSID"; |
368 std::unique_ptr<base::Value> networkNameValue(new base::Value(networkName)); | 399 std::unique_ptr<base::Value> networkNameValue(new base::Value(networkName)); |
369 | 400 |
370 base::DictionaryValue value; | 401 base::DictionaryValue value; |
371 value.Set(key, new base::Value(networkName)); | 402 value.Set(key, new base::Value(networkName)); |
372 dictionary_value_result_ = &value; | 403 dictionary_value_result_ = &value; |
373 EXPECT_CALL(*mock_service_client_, SetProperties(_, _, _, _)) | 404 EXPECT_CALL(*mock_service_client_, SetProperties(_, _, _, _)) |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 EXPECT_FALSE(test_observer->HasConfiguration(service_path)); | 910 EXPECT_FALSE(test_observer->HasConfiguration(service_path)); |
880 EXPECT_FALSE(test_observer->HasConfigurationInProfile( | 911 EXPECT_FALSE(test_observer->HasConfigurationInProfile( |
881 service_path, NetworkProfileHandler::GetSharedProfilePath())); | 912 service_path, NetworkProfileHandler::GetSharedProfilePath())); |
882 EXPECT_FALSE( | 913 EXPECT_FALSE( |
883 test_observer->HasConfigurationInProfile(service_path, user_profile)); | 914 test_observer->HasConfigurationInProfile(service_path, user_profile)); |
884 | 915 |
885 network_configuration_handler_->RemoveObserver(test_observer.get()); | 916 network_configuration_handler_->RemoveObserver(test_observer.get()); |
886 } | 917 } |
887 | 918 |
888 } // namespace chromeos | 919 } // namespace chromeos |
OLD | NEW |