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

Side by Side Diff: chromeos/network/auto_connect_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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chromeos/network/auto_connect_handler.h" 5 #include "chromeos/network/auto_connect_handler.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 24 matching lines...) Expand all
35 #include "net/cert/x509_certificate.h" 35 #include "net/cert/x509_certificate.h"
36 #include "net/test/cert_test_util.h" 36 #include "net/test/cert_test_util.h"
37 #include "net/test/test_data_directory.h" 37 #include "net/test/test_data_directory.h"
38 #include "testing/gtest/include/gtest/gtest.h" 38 #include "testing/gtest/include/gtest/gtest.h"
39 #include "third_party/cros_system_api/dbus/service_constants.h" 39 #include "third_party/cros_system_api/dbus/service_constants.h"
40 40
41 namespace chromeos { 41 namespace chromeos {
42 42
43 namespace { 43 namespace {
44 44
45 const char* kUserHash = "user_hash"; 45 const char kUserHash[] = "user_hash";
46 46
47 void ConfigureCallback(const dbus::ObjectPath& result) { 47 void ConfigureCallback(const dbus::ObjectPath& result) {
48 } 48 }
49 49
50 void FailErrorCallback(const std::string& error_name, 50 void FailErrorCallback(const std::string& error_name,
51 const std::string& error_message) { 51 const std::string& error_message) {
52 // This function is not expected to be called. 52 // This function is not expected to be called.
53 EXPECT_TRUE(false); 53 EXPECT_TRUE(false);
54 } 54 }
55 55
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 "/device/wifi1", shill::kTypeWifi, "wifi_device1"); 103 "/device/wifi1", shill::kTypeWifi, "wifi_device1");
104 test_manager_client_->AddTechnology(shill::kTypeCellular, 104 test_manager_client_->AddTechnology(shill::kTypeCellular,
105 true /* enabled */); 105 true /* enabled */);
106 dbus_manager->GetShillProfileClient()->GetTestInterface()->AddProfile( 106 dbus_manager->GetShillProfileClient()->GetTestInterface()->AddProfile(
107 "shared_profile_path", std::string() /* shared profile */); 107 "shared_profile_path", std::string() /* shared profile */);
108 dbus_manager->GetShillProfileClient()->GetTestInterface()->AddProfile( 108 dbus_manager->GetShillProfileClient()->GetTestInterface()->AddProfile(
109 "user_profile_path", kUserHash); 109 "user_profile_path", kUserHash);
110 110
111 base::RunLoop().RunUntilIdle(); 111 base::RunLoop().RunUntilIdle();
112 LoginState::Initialize(); 112 LoginState::Initialize();
113 network_state_handler_.reset(NetworkStateHandler::InitializeForTest()); 113 network_state_handler_ = NetworkStateHandler::InitializeForTest();
114 network_config_handler_.reset( 114 network_config_handler_.reset(
115 NetworkConfigurationHandler::InitializeForTest( 115 NetworkConfigurationHandler::InitializeForTest(
116 network_state_handler_.get(), NULL /* network_device_handler */)); 116 network_state_handler_.get(), NULL /* network_device_handler */));
117 117
118 network_profile_handler_.reset(new NetworkProfileHandler()); 118 network_profile_handler_.reset(new NetworkProfileHandler());
119 network_profile_handler_->Init(); 119 network_profile_handler_->Init();
120 120
121 managed_config_handler_.reset(new ManagedNetworkConfigurationHandlerImpl()); 121 managed_config_handler_.reset(new ManagedNetworkConfigurationHandlerImpl());
122 managed_config_handler_->Init( 122 managed_config_handler_->Init(
123 network_state_handler_.get(), network_profile_handler_.get(), 123 network_state_handler_.get(), network_profile_handler_.get(),
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 // Applying the user policy after login would usually trigger connecting to 503 // Applying the user policy after login would usually trigger connecting to
504 // the 'best' network. But the manual connect prevents this. 504 // the 'best' network. But the manual connect prevents this.
505 SetupPolicy(std::string(), // no network configs 505 SetupPolicy(std::string(), // no network configs
506 base::DictionaryValue(), // no global config 506 base::DictionaryValue(), // no global config
507 true); // load as user policy 507 true); // load as user policy
508 EXPECT_EQ(shill::kStateOnline, GetServiceState("wifi0")); 508 EXPECT_EQ(shill::kStateOnline, GetServiceState("wifi0"));
509 EXPECT_EQ(shill::kStateIdle, GetServiceState("wifi1")); 509 EXPECT_EQ(shill::kStateIdle, GetServiceState("wifi1"));
510 } 510 }
511 511
512 } // namespace chromeos 512 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chromeos/network/client_cert_resolver_unittest.cc » ('j') | chromeos/network/network_state_handler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698