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

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

Issue 2844363003: [CrOS Tether] Add HasConnectedToHost property for Tether networks. (Closed)
Patch Set: Rebased. Created 3 years, 7 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) 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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) { 364 TEST_F(NetworkConfigurationHandlerTest, GetProperties_TetherNetwork) {
365 network_state_handler_->SetTetherTechnologyState( 365 network_state_handler_->SetTetherTechnologyState(
366 NetworkStateHandler::TechnologyState::TECHNOLOGY_ENABLED); 366 NetworkStateHandler::TechnologyState::TECHNOLOGY_ENABLED);
367 367
368 std::string kTetherGuid = "TetherGuid"; 368 std::string kTetherGuid = "TetherGuid";
369 // TODO(khorimoto): Pass a has_connected_to_host parameter to this function
370 // and verify that it is present in the JSON below. Currently, it is hard-
371 // coded to false.
369 network_state_handler_->AddTetherNetworkState( 372 network_state_handler_->AddTetherNetworkState(
370 kTetherGuid, "TetherNetworkName", "TetherNetworkCarrier", 373 kTetherGuid, "TetherNetworkName", "TetherNetworkCarrier",
371 100 /* battery_percentage */, 100 /* signal_strength */); 374 100 /* battery_percentage */, 100 /* signal_strength */);
372 375
373 std::string expected_json = 376 std::string expected_json =
374 "{\n " 377 "{\n "
375 "\"GUID\": \"TetherGuid\",\n " 378 "\"GUID\": \"TetherGuid\",\n "
376 "\"Name\": \"TetherNetworkName\",\n " 379 "\"Name\": \"TetherNetworkName\",\n "
377 "\"Priority\": 0,\n " 380 "\"Priority\": 0,\n "
378 "\"Profile\": \"\",\n " 381 "\"Profile\": \"\",\n "
379 "\"SecurityClass\": \"\",\n " 382 "\"SecurityClass\": \"\",\n "
380 "\"State\": \"\",\n " 383 "\"State\": \"\",\n "
381 "\"Tether.BatteryPercentage\": 100,\n " 384 "\"Tether.BatteryPercentage\": 100,\n "
382 "\"Tether.Carrier\": \"TetherNetworkCarrier\",\n " 385 "\"Tether.Carrier\": \"TetherNetworkCarrier\",\n "
386 "\"Tether.HasConnectedToHost\": false,\n "
383 "\"Tether.SignalStrength\": 100,\n " 387 "\"Tether.SignalStrength\": 100,\n "
384 "\"Type\": \"wifi-tether\"\n" 388 "\"Type\": \"wifi-tether\"\n"
385 "}\n"; 389 "}\n";
386 390
387 // Tether networks use service path and GUID interchangeably. 391 // Tether networks use service path and GUID interchangeably.
388 std::string& tether_service_path = kTetherGuid; 392 std::string& tether_service_path = kTetherGuid;
389 network_configuration_handler_->GetShillProperties( 393 network_configuration_handler_->GetShillProperties(
390 tether_service_path, 394 tether_service_path,
391 base::Bind(&DictionaryValueCallback, tether_service_path, expected_json), 395 base::Bind(&DictionaryValueCallback, tether_service_path, expected_json),
392 base::Bind(&ErrorCallback)); 396 base::Bind(&ErrorCallback));
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 EXPECT_FALSE(test_observer->HasConfiguration(service_path)); 914 EXPECT_FALSE(test_observer->HasConfiguration(service_path));
911 EXPECT_FALSE(test_observer->HasConfigurationInProfile( 915 EXPECT_FALSE(test_observer->HasConfigurationInProfile(
912 service_path, NetworkProfileHandler::GetSharedProfilePath())); 916 service_path, NetworkProfileHandler::GetSharedProfilePath()));
913 EXPECT_FALSE( 917 EXPECT_FALSE(
914 test_observer->HasConfigurationInProfile(service_path, user_profile)); 918 test_observer->HasConfigurationInProfile(service_path, user_profile));
915 919
916 network_configuration_handler_->RemoveObserver(test_observer.get()); 920 network_configuration_handler_->RemoveObserver(test_observer.get());
917 } 921 }
918 922
919 } // namespace chromeos 923 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/networking_private/chromeos/test.js ('k') | chromeos/network/network_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698