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

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

Issue 2478573003: NetworkStateHandler::InitializeForTest() should return a std::unique_ptr. (Closed)
Patch Set: Created 4 years, 1 month 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 dbus_setter->SetShillServiceClient( 193 dbus_setter->SetShillServiceClient(
194 std::unique_ptr<ShillServiceClient>(mock_service_client_)); 194 std::unique_ptr<ShillServiceClient>(mock_service_client_));
195 195
196 EXPECT_CALL(*mock_service_client_, GetProperties(_, _)).Times(AnyNumber()); 196 EXPECT_CALL(*mock_service_client_, GetProperties(_, _)).Times(AnyNumber());
197 EXPECT_CALL(*mock_manager_client_, GetProperties(_)).Times(AnyNumber()); 197 EXPECT_CALL(*mock_manager_client_, GetProperties(_)).Times(AnyNumber());
198 EXPECT_CALL(*mock_manager_client_, AddPropertyChangedObserver(_)) 198 EXPECT_CALL(*mock_manager_client_, AddPropertyChangedObserver(_))
199 .Times(AnyNumber()); 199 .Times(AnyNumber());
200 EXPECT_CALL(*mock_manager_client_, RemovePropertyChangedObserver(_)) 200 EXPECT_CALL(*mock_manager_client_, RemovePropertyChangedObserver(_))
201 .Times(AnyNumber()); 201 .Times(AnyNumber());
202 202
203 network_state_handler_.reset(NetworkStateHandler::InitializeForTest()); 203 network_state_handler_ = NetworkStateHandler::InitializeForTest();
204 network_configuration_handler_.reset(new NetworkConfigurationHandler()); 204 network_configuration_handler_.reset(new NetworkConfigurationHandler());
205 network_configuration_handler_->Init(network_state_handler_.get(), 205 network_configuration_handler_->Init(network_state_handler_.get(),
206 NULL /* network_device_handler */); 206 NULL /* network_device_handler */);
207 base::RunLoop().RunUntilIdle(); 207 base::RunLoop().RunUntilIdle();
208 } 208 }
209 209
210 void TearDown() override { 210 void TearDown() override {
211 network_configuration_handler_.reset(); 211 network_configuration_handler_.reset();
212 network_state_handler_.reset(); 212 network_state_handler_.reset();
213 DBusThreadManager::Shutdown(); 213 DBusThreadManager::Shutdown();
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 488
489 class NetworkConfigurationHandlerStubTest : public testing::Test { 489 class NetworkConfigurationHandlerStubTest : public testing::Test {
490 public: 490 public:
491 NetworkConfigurationHandlerStubTest() {} 491 NetworkConfigurationHandlerStubTest() {}
492 492
493 ~NetworkConfigurationHandlerStubTest() override {} 493 ~NetworkConfigurationHandlerStubTest() override {}
494 494
495 void SetUp() override { 495 void SetUp() override {
496 DBusThreadManager::Initialize(); 496 DBusThreadManager::Initialize();
497 497
498 network_state_handler_.reset(NetworkStateHandler::InitializeForTest()); 498 network_state_handler_ = NetworkStateHandler::InitializeForTest();
499 test_observer_.reset(new TestObserver()); 499 test_observer_.reset(new TestObserver());
500 network_state_handler_->AddObserver(test_observer_.get(), FROM_HERE); 500 network_state_handler_->AddObserver(test_observer_.get(), FROM_HERE);
501 501
502 network_configuration_handler_.reset(new NetworkConfigurationHandler()); 502 network_configuration_handler_.reset(new NetworkConfigurationHandler());
503 network_configuration_handler_->Init(network_state_handler_.get(), 503 network_configuration_handler_->Init(network_state_handler_.get(),
504 NULL /* network_device_handler */); 504 NULL /* network_device_handler */);
505 505
506 base::RunLoop().RunUntilIdle(); 506 base::RunLoop().RunUntilIdle();
507 test_observer_->ClearPropertyUpdates(); 507 test_observer_->ClearPropertyUpdates();
508 } 508 }
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 EXPECT_FALSE(test_observer->HasConfiguration(service_path)); 743 EXPECT_FALSE(test_observer->HasConfiguration(service_path));
744 EXPECT_FALSE(test_observer->HasConfigurationInProfile( 744 EXPECT_FALSE(test_observer->HasConfigurationInProfile(
745 service_path, NetworkProfileHandler::GetSharedProfilePath())); 745 service_path, NetworkProfileHandler::GetSharedProfilePath()));
746 EXPECT_FALSE( 746 EXPECT_FALSE(
747 test_observer->HasConfigurationInProfile(service_path, user_profile)); 747 test_observer->HasConfigurationInProfile(service_path, user_profile));
748 748
749 network_configuration_handler_->RemoveObserver(test_observer.get()); 749 network_configuration_handler_->RemoveObserver(test_observer.get());
750 } 750 }
751 751
752 } // namespace chromeos 752 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698