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

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

Issue 299403012: Clean up shill fake implementations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/json/json_writer.h" 6 #include "base/json/json_writer.h"
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/strings/string_piece.h" 8 #include "base/strings/string_piece.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chromeos/dbus/dbus_thread_manager.h" 10 #include "chromeos/dbus/dbus_thread_manager.h"
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 scoped_ptr<TestObserver> test_observer_; 499 scoped_ptr<TestObserver> test_observer_;
500 base::MessageLoopForUI message_loop_; 500 base::MessageLoopForUI message_loop_;
501 std::string success_callback_name_; 501 std::string success_callback_name_;
502 std::string get_properties_path_; 502 std::string get_properties_path_;
503 scoped_ptr<base::DictionaryValue> get_properties_; 503 scoped_ptr<base::DictionaryValue> get_properties_;
504 std::string create_service_path_; 504 std::string create_service_path_;
505 }; 505 };
506 506
507 TEST_F(NetworkConfigurationHandlerStubTest, StubSetAndClearProperties) { 507 TEST_F(NetworkConfigurationHandlerStubTest, StubSetAndClearProperties) {
508 // TODO(stevenjb): Remove dependency on default Stub service. 508 // TODO(stevenjb): Remove dependency on default Stub service.
509 const std::string service_path("wifi1"); 509 const std::string service_path("/service/wifi1");
510 const std::string test_identity("test_identity"); 510 const std::string test_identity("test_identity");
511 const std::string test_passphrase("test_passphrase"); 511 const std::string test_passphrase("test_passphrase");
512 512
513 // Set Properties 513 // Set Properties
514 base::DictionaryValue properties_to_set; 514 base::DictionaryValue properties_to_set;
515 properties_to_set.SetStringWithoutPathExpansion( 515 properties_to_set.SetStringWithoutPathExpansion(
516 shill::kIdentityProperty, test_identity); 516 shill::kIdentityProperty, test_identity);
517 properties_to_set.SetStringWithoutPathExpansion( 517 properties_to_set.SetStringWithoutPathExpansion(
518 shill::kPassphraseProperty, test_passphrase); 518 shill::kPassphraseProperty, test_passphrase);
519 network_configuration_handler_->SetProperties( 519 network_configuration_handler_->SetProperties(
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 EXPECT_EQ("ClearProperties", success_callback_name_); 551 EXPECT_EQ("ClearProperties", success_callback_name_);
552 EXPECT_FALSE(GetServiceStringProperty( 552 EXPECT_FALSE(GetServiceStringProperty(
553 service_path, shill::kIdentityProperty, &identity)); 553 service_path, shill::kIdentityProperty, &identity));
554 EXPECT_FALSE(GetServiceStringProperty( 554 EXPECT_FALSE(GetServiceStringProperty(
555 service_path, shill::kIdentityProperty, &passphrase)); 555 service_path, shill::kIdentityProperty, &passphrase));
556 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService(service_path)); 556 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService(service_path));
557 } 557 }
558 558
559 TEST_F(NetworkConfigurationHandlerStubTest, StubGetNameFromWifiHex) { 559 TEST_F(NetworkConfigurationHandlerStubTest, StubGetNameFromWifiHex) {
560 // TODO(stevenjb): Remove dependency on default Stub service. 560 // TODO(stevenjb): Remove dependency on default Stub service.
561 const std::string service_path("wifi1"); 561 const std::string service_path("/service/wifi1");
562 std::string wifi_hex = "5468697320697320484558205353494421"; 562 std::string wifi_hex = "5468697320697320484558205353494421";
563 std::string expected_name = "This is HEX SSID!"; 563 std::string expected_name = "This is HEX SSID!";
564 564
565 // Set Properties 565 // Set Properties
566 base::DictionaryValue properties_to_set; 566 base::DictionaryValue properties_to_set;
567 properties_to_set.SetStringWithoutPathExpansion( 567 properties_to_set.SetStringWithoutPathExpansion(
568 shill::kWifiHexSsid, wifi_hex); 568 shill::kWifiHexSsid, wifi_hex);
569 network_configuration_handler_->SetProperties( 569 network_configuration_handler_->SetProperties(
570 service_path, 570 service_path,
571 properties_to_set, 571 properties_to_set,
(...skipping 14 matching lines...) Expand all
586 message_loop_.RunUntilIdle(); 586 message_loop_.RunUntilIdle();
587 587
588 EXPECT_EQ(service_path, get_properties_path_); 588 EXPECT_EQ(service_path, get_properties_path_);
589 std::string name_result; 589 std::string name_result;
590 EXPECT_TRUE(GetReceivedStringProperty( 590 EXPECT_TRUE(GetReceivedStringProperty(
591 service_path, shill::kNameProperty, &name_result)); 591 service_path, shill::kNameProperty, &name_result));
592 EXPECT_EQ(expected_name, name_result); 592 EXPECT_EQ(expected_name, name_result);
593 } 593 }
594 594
595 TEST_F(NetworkConfigurationHandlerStubTest, StubCreateConfiguration) { 595 TEST_F(NetworkConfigurationHandlerStubTest, StubCreateConfiguration) {
596 const std::string service_path("test_wifi"); 596 const std::string service_path("/service/test_wifi");
597 base::DictionaryValue properties; 597 base::DictionaryValue properties;
598 shill_property_util::SetSSID(service_path, &properties); 598 shill_property_util::SetSSID(service_path, &properties);
599 properties.SetStringWithoutPathExpansion(shill::kNameProperty, service_path); 599 properties.SetStringWithoutPathExpansion(shill::kNameProperty, service_path);
600 properties.SetStringWithoutPathExpansion(shill::kGuidProperty, service_path); 600 properties.SetStringWithoutPathExpansion(shill::kGuidProperty, service_path);
601 properties.SetStringWithoutPathExpansion( 601 properties.SetStringWithoutPathExpansion(
602 shill::kTypeProperty, shill::kTypeWifi); 602 shill::kTypeProperty, shill::kTypeWifi);
603 properties.SetStringWithoutPathExpansion( 603 properties.SetStringWithoutPathExpansion(
604 shill::kStateProperty, shill::kStateIdle); 604 shill::kStateProperty, shill::kStateIdle);
605 properties.SetStringWithoutPathExpansion( 605 properties.SetStringWithoutPathExpansion(
606 shill::kProfileProperty, NetworkProfileHandler::GetSharedProfilePath()); 606 shill::kProfileProperty, NetworkProfileHandler::GetSharedProfilePath());
(...skipping 13 matching lines...) Expand all
620 create_service_path_, shill::kGuidProperty, &guid)); 620 create_service_path_, shill::kGuidProperty, &guid));
621 EXPECT_EQ(service_path, guid); 621 EXPECT_EQ(service_path, guid);
622 622
623 std::string actual_profile; 623 std::string actual_profile;
624 EXPECT_TRUE(GetServiceStringProperty( 624 EXPECT_TRUE(GetServiceStringProperty(
625 create_service_path_, shill::kProfileProperty, &actual_profile)); 625 create_service_path_, shill::kProfileProperty, &actual_profile));
626 EXPECT_EQ(NetworkProfileHandler::GetSharedProfilePath(), actual_profile); 626 EXPECT_EQ(NetworkProfileHandler::GetSharedProfilePath(), actual_profile);
627 } 627 }
628 628
629 } // namespace chromeos 629 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698