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

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

Issue 181413006: Replace misc. network stub flags with more flexible ones (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Elim. shill_stub_helper and move functions to clients. Created 6 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 | 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"
11 #include "chromeos/dbus/fake_dbus_thread_manager.h" 11 #include "chromeos/dbus/fake_dbus_thread_manager.h"
12 #include "chromeos/dbus/mock_shill_manager_client.h" 12 #include "chromeos/dbus/mock_shill_manager_client.h"
13 #include "chromeos/dbus/mock_shill_profile_client.h" 13 #include "chromeos/dbus/mock_shill_profile_client.h"
14 #include "chromeos/dbus/mock_shill_service_client.h" 14 #include "chromeos/dbus/mock_shill_service_client.h"
15 #include "chromeos/dbus/shill_stub_helper.h"
16 #include "chromeos/network/network_configuration_handler.h" 15 #include "chromeos/network/network_configuration_handler.h"
16 #include "chromeos/network/network_profile_handler.h"
17 #include "chromeos/network/network_state.h" 17 #include "chromeos/network/network_state.h"
18 #include "chromeos/network/network_state_handler.h" 18 #include "chromeos/network/network_state_handler.h"
19 #include "chromeos/network/network_state_handler_observer.h" 19 #include "chromeos/network/network_state_handler_observer.h"
20 #include "chromeos/network/shill_property_util.h" 20 #include "chromeos/network/shill_property_util.h"
21 #include "testing/gmock/include/gmock/gmock.h" 21 #include "testing/gmock/include/gmock/gmock.h"
22 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
23 #include "third_party/cros_system_api/dbus/service_constants.h" 23 #include "third_party/cros_system_api/dbus/service_constants.h"
24 24
25 using ::testing::_; 25 using ::testing::_;
26 using ::testing::AnyNumber; 26 using ::testing::AnyNumber;
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 const std::string service_path("test_wifi"); 593 const std::string service_path("test_wifi");
594 base::DictionaryValue properties; 594 base::DictionaryValue properties;
595 shill_property_util::SetSSID(service_path, &properties); 595 shill_property_util::SetSSID(service_path, &properties);
596 properties.SetStringWithoutPathExpansion(shill::kNameProperty, service_path); 596 properties.SetStringWithoutPathExpansion(shill::kNameProperty, service_path);
597 properties.SetStringWithoutPathExpansion(shill::kGuidProperty, service_path); 597 properties.SetStringWithoutPathExpansion(shill::kGuidProperty, service_path);
598 properties.SetStringWithoutPathExpansion( 598 properties.SetStringWithoutPathExpansion(
599 shill::kTypeProperty, shill::kTypeWifi); 599 shill::kTypeProperty, shill::kTypeWifi);
600 properties.SetStringWithoutPathExpansion( 600 properties.SetStringWithoutPathExpansion(
601 shill::kStateProperty, shill::kStateIdle); 601 shill::kStateProperty, shill::kStateIdle);
602 properties.SetStringWithoutPathExpansion( 602 properties.SetStringWithoutPathExpansion(
603 shill::kProfileProperty, shill_stub_helper::kSharedProfilePath); 603 shill::kProfileProperty, NetworkProfileHandler::GetSharedProfilePath());
604 604
605 network_configuration_handler_->CreateConfiguration( 605 network_configuration_handler_->CreateConfiguration(
606 properties, 606 properties,
607 base::Bind( 607 base::Bind(
608 &NetworkConfigurationHandlerStubTest::CreateConfigurationCallback, 608 &NetworkConfigurationHandlerStubTest::CreateConfigurationCallback,
609 base::Unretained(this)), 609 base::Unretained(this)),
610 base::Bind(&ErrorCallback, false, service_path)); 610 base::Bind(&ErrorCallback, false, service_path));
611 message_loop_.RunUntilIdle(); 611 message_loop_.RunUntilIdle();
612 612
613 EXPECT_FALSE(create_service_path_.empty()); 613 EXPECT_FALSE(create_service_path_.empty());
614 614
615 std::string guid; 615 std::string guid;
616 EXPECT_TRUE(GetServiceStringProperty( 616 EXPECT_TRUE(GetServiceStringProperty(
617 create_service_path_, shill::kGuidProperty, &guid)); 617 create_service_path_, shill::kGuidProperty, &guid));
618 EXPECT_EQ(service_path, guid); 618 EXPECT_EQ(service_path, guid);
619 619
620 std::string actual_profile; 620 std::string actual_profile;
621 EXPECT_TRUE(GetServiceStringProperty( 621 EXPECT_TRUE(GetServiceStringProperty(
622 create_service_path_, shill::kProfileProperty, &actual_profile)); 622 create_service_path_, shill::kProfileProperty, &actual_profile));
623 EXPECT_EQ(shill_stub_helper::kSharedProfilePath, actual_profile); 623 EXPECT_EQ(NetworkProfileHandler::GetSharedProfilePath(), actual_profile);
624 } 624 }
625 625
626 } // namespace chromeos 626 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698