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

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

Issue 477663004: Merged FakedDBusThreadManager with DBusThreadManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 3 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"
12 #include "chromeos/dbus/mock_shill_manager_client.h" 11 #include "chromeos/dbus/mock_shill_manager_client.h"
13 #include "chromeos/dbus/mock_shill_profile_client.h" 12 #include "chromeos/dbus/mock_shill_profile_client.h"
14 #include "chromeos/dbus/mock_shill_service_client.h" 13 #include "chromeos/dbus/mock_shill_service_client.h"
15 #include "chromeos/network/network_configuration_handler.h" 14 #include "chromeos/network/network_configuration_handler.h"
16 #include "chromeos/network/network_profile_handler.h" 15 #include "chromeos/network/network_profile_handler.h"
17 #include "chromeos/network/network_state.h" 16 #include "chromeos/network/network_state.h"
18 #include "chromeos/network/network_state_handler.h" 17 #include "chromeos/network/network_state_handler.h"
19 #include "chromeos/network/network_state_handler_observer.h" 18 #include "chromeos/network/network_state_handler_observer.h"
20 #include "chromeos/network/shill_property_util.h" 19 #include "chromeos/network/shill_property_util.h"
21 #include "testing/gmock/include/gmock/gmock.h" 20 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 class NetworkConfigurationHandlerTest : public testing::Test { 91 class NetworkConfigurationHandlerTest : public testing::Test {
93 public: 92 public:
94 NetworkConfigurationHandlerTest() 93 NetworkConfigurationHandlerTest()
95 : mock_manager_client_(NULL), 94 : mock_manager_client_(NULL),
96 mock_profile_client_(NULL), 95 mock_profile_client_(NULL),
97 mock_service_client_(NULL), 96 mock_service_client_(NULL),
98 dictionary_value_result_(NULL) {} 97 dictionary_value_result_(NULL) {}
99 virtual ~NetworkConfigurationHandlerTest() {} 98 virtual ~NetworkConfigurationHandlerTest() {}
100 99
101 virtual void SetUp() OVERRIDE { 100 virtual void SetUp() OVERRIDE {
102 FakeDBusThreadManager* dbus_thread_manager = new FakeDBusThreadManager; 101 scoped_ptr<DBusThreadManagerSetter> dbus_setter =
102 DBusThreadManager::GetSetterForTesting();
103 mock_manager_client_ = new MockShillManagerClient(); 103 mock_manager_client_ = new MockShillManagerClient();
104 mock_profile_client_ = new MockShillProfileClient(); 104 mock_profile_client_ = new MockShillProfileClient();
105 mock_service_client_ = new MockShillServiceClient(); 105 mock_service_client_ = new MockShillServiceClient();
106 dbus_thread_manager->SetShillManagerClient( 106 dbus_setter->SetShillManagerClient(
107 scoped_ptr<ShillManagerClient>(mock_manager_client_).Pass()); 107 scoped_ptr<ShillManagerClient>(mock_manager_client_).Pass());
108 dbus_thread_manager->SetShillProfileClient( 108 dbus_setter->SetShillProfileClient(
109 scoped_ptr<ShillProfileClient>(mock_profile_client_).Pass()); 109 scoped_ptr<ShillProfileClient>(mock_profile_client_).Pass());
110 dbus_thread_manager->SetShillServiceClient( 110 dbus_setter->SetShillServiceClient(
111 scoped_ptr<ShillServiceClient>(mock_service_client_).Pass()); 111 scoped_ptr<ShillServiceClient>(mock_service_client_).Pass());
112 112
113 EXPECT_CALL(*mock_service_client_, GetProperties(_, _)) 113 EXPECT_CALL(*mock_service_client_, GetProperties(_, _))
114 .Times(AnyNumber()); 114 .Times(AnyNumber());
115 EXPECT_CALL(*mock_manager_client_, GetProperties(_)) 115 EXPECT_CALL(*mock_manager_client_, GetProperties(_))
116 .Times(AnyNumber()); 116 .Times(AnyNumber());
117 EXPECT_CALL(*mock_manager_client_, AddPropertyChangedObserver(_)) 117 EXPECT_CALL(*mock_manager_client_, AddPropertyChangedObserver(_))
118 .Times(AnyNumber()); 118 .Times(AnyNumber());
119 EXPECT_CALL(*mock_manager_client_, RemovePropertyChangedObserver(_)) 119 EXPECT_CALL(*mock_manager_client_, RemovePropertyChangedObserver(_))
120 .Times(AnyNumber()); 120 .Times(AnyNumber());
121 121
122 DBusThreadManager::InitializeForTesting(dbus_thread_manager);
123
124 network_state_handler_.reset(NetworkStateHandler::InitializeForTest()); 122 network_state_handler_.reset(NetworkStateHandler::InitializeForTest());
125 network_configuration_handler_.reset(new NetworkConfigurationHandler()); 123 network_configuration_handler_.reset(new NetworkConfigurationHandler());
126 network_configuration_handler_->Init(network_state_handler_.get()); 124 network_configuration_handler_->Init(network_state_handler_.get());
127 message_loop_.RunUntilIdle(); 125 message_loop_.RunUntilIdle();
128 } 126 }
129 127
130 virtual void TearDown() OVERRIDE { 128 virtual void TearDown() OVERRIDE {
131 network_configuration_handler_.reset(); 129 network_configuration_handler_.reset();
132 network_state_handler_.reset(); 130 network_state_handler_.reset();
133 DBusThreadManager::Shutdown(); 131 DBusThreadManager::Shutdown();
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 427
430 class NetworkConfigurationHandlerStubTest : public testing::Test { 428 class NetworkConfigurationHandlerStubTest : public testing::Test {
431 public: 429 public:
432 NetworkConfigurationHandlerStubTest() { 430 NetworkConfigurationHandlerStubTest() {
433 } 431 }
434 432
435 virtual ~NetworkConfigurationHandlerStubTest() { 433 virtual ~NetworkConfigurationHandlerStubTest() {
436 } 434 }
437 435
438 virtual void SetUp() OVERRIDE { 436 virtual void SetUp() OVERRIDE {
439 DBusThreadManager::InitializeWithStub(); 437 DBusThreadManager::Initialize();
440 438
441 network_state_handler_.reset(NetworkStateHandler::InitializeForTest()); 439 network_state_handler_.reset(NetworkStateHandler::InitializeForTest());
442 test_observer_.reset(new TestObserver()); 440 test_observer_.reset(new TestObserver());
443 network_state_handler_->AddObserver(test_observer_.get(), FROM_HERE); 441 network_state_handler_->AddObserver(test_observer_.get(), FROM_HERE);
444 442
445 network_configuration_handler_.reset(new NetworkConfigurationHandler()); 443 network_configuration_handler_.reset(new NetworkConfigurationHandler());
446 network_configuration_handler_->Init(network_state_handler_.get()); 444 network_configuration_handler_->Init(network_state_handler_.get());
447 445
448 message_loop_.RunUntilIdle(); 446 message_loop_.RunUntilIdle();
449 test_observer_->ClearPropertyUpdates(); 447 test_observer_->ClearPropertyUpdates();
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 create_service_path_, shill::kGuidProperty, &guid)); 618 create_service_path_, shill::kGuidProperty, &guid));
621 EXPECT_EQ(service_path, guid); 619 EXPECT_EQ(service_path, guid);
622 620
623 std::string actual_profile; 621 std::string actual_profile;
624 EXPECT_TRUE(GetServiceStringProperty( 622 EXPECT_TRUE(GetServiceStringProperty(
625 create_service_path_, shill::kProfileProperty, &actual_profile)); 623 create_service_path_, shill::kProfileProperty, &actual_profile));
626 EXPECT_EQ(NetworkProfileHandler::GetSharedProfilePath(), actual_profile); 624 EXPECT_EQ(NetworkProfileHandler::GetSharedProfilePath(), actual_profile);
627 } 625 }
628 626
629 } // namespace chromeos 627 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/network_cert_migrator_unittest.cc ('k') | chromeos/network/network_connection_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698