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

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

Issue 2850993002: [CrOS Tether] Add the HasConnectedToHost network field to NetworkStateHandler. (Closed)
Patch Set: 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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 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- 370 // and verify that it is present in the JSON below. Currently, it is hard-
371 // coded to false. 371 // coded to false.
372 network_state_handler_->AddTetherNetworkState( 372 network_state_handler_->AddTetherNetworkState(
373 kTetherGuid, "TetherNetworkName", "TetherNetworkCarrier", 373 kTetherGuid, "TetherNetworkName", "TetherNetworkCarrier",
374 100 /* battery_percentage */, 100 /* signal_strength */); 374 100 /* battery_percentage */, 100 /* signal_strength */,
375 true /* has_connected_to_host */);
375 376
376 std::string expected_json = 377 std::string expected_json =
377 "{\n " 378 "{\n "
378 "\"GUID\": \"TetherGuid\",\n " 379 "\"GUID\": \"TetherGuid\",\n "
379 "\"Name\": \"TetherNetworkName\",\n " 380 "\"Name\": \"TetherNetworkName\",\n "
380 "\"Priority\": 0,\n " 381 "\"Priority\": 0,\n "
381 "\"Profile\": \"\",\n " 382 "\"Profile\": \"\",\n "
382 "\"SecurityClass\": \"\",\n " 383 "\"SecurityClass\": \"\",\n "
383 "\"State\": \"\",\n " 384 "\"State\": \"\",\n "
384 "\"Tether.BatteryPercentage\": 100,\n " 385 "\"Tether.BatteryPercentage\": 100,\n "
385 "\"Tether.Carrier\": \"TetherNetworkCarrier\",\n " 386 "\"Tether.Carrier\": \"TetherNetworkCarrier\",\n "
386 "\"Tether.HasConnectedToHost\": false,\n " 387 "\"Tether.HasConnectedToHost\": true,\n "
387 "\"Tether.SignalStrength\": 100,\n " 388 "\"Tether.SignalStrength\": 100,\n "
388 "\"Type\": \"wifi-tether\"\n" 389 "\"Type\": \"wifi-tether\"\n"
389 "}\n"; 390 "}\n";
390 391
391 // Tether networks use service path and GUID interchangeably. 392 // Tether networks use service path and GUID interchangeably.
392 std::string& tether_service_path = kTetherGuid; 393 std::string& tether_service_path = kTetherGuid;
393 network_configuration_handler_->GetShillProperties( 394 network_configuration_handler_->GetShillProperties(
394 tether_service_path, 395 tether_service_path,
395 base::Bind(&DictionaryValueCallback, tether_service_path, expected_json), 396 base::Bind(&DictionaryValueCallback, tether_service_path, expected_json),
396 base::Bind(&ErrorCallback)); 397 base::Bind(&ErrorCallback));
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 EXPECT_FALSE(test_observer->HasConfiguration(service_path)); 915 EXPECT_FALSE(test_observer->HasConfiguration(service_path));
915 EXPECT_FALSE(test_observer->HasConfigurationInProfile( 916 EXPECT_FALSE(test_observer->HasConfigurationInProfile(
916 service_path, NetworkProfileHandler::GetSharedProfilePath())); 917 service_path, NetworkProfileHandler::GetSharedProfilePath()));
917 EXPECT_FALSE( 918 EXPECT_FALSE(
918 test_observer->HasConfigurationInProfile(service_path, user_profile)); 919 test_observer->HasConfigurationInProfile(service_path, user_profile));
919 920
920 network_configuration_handler_->RemoveObserver(test_observer.get()); 921 network_configuration_handler_->RemoveObserver(test_observer.get());
921 } 922 }
922 923
923 } // namespace chromeos 924 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698