Index: chromeos/network/network_connection_handler_unittest.cc |
diff --git a/chromeos/network/network_connection_handler_unittest.cc b/chromeos/network/network_connection_handler_unittest.cc |
index bd3f5a26b1ced96f1da5c009c6e07b4828b4b193..e5d02bfa29254dd16378d5253956c748468b4c8c 100644 |
--- a/chromeos/network/network_connection_handler_unittest.cc |
+++ b/chromeos/network/network_connection_handler_unittest.cc |
@@ -38,15 +38,19 @@ class NetworkConnectionHandlerTest : public testing::Test { |
DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface() |
->ClearServices(); |
message_loop_.RunUntilIdle(); |
- NetworkStateHandler::Initialize(); |
- NetworkConfigurationHandler::Initialize(); |
- NetworkConnectionHandler::Initialize(); |
+ network_state_handler_.reset(NetworkStateHandler::InitializeForTest()); |
+ network_configuration_handler_.reset( |
+ NetworkConfigurationHandler::InitializeForTest( |
+ network_state_handler_.get())); |
+ network_connection_handler_.reset(new NetworkConnectionHandler); |
+ network_connection_handler_->Init(network_state_handler_.get(), |
+ network_configuration_handler_.get()); |
} |
virtual void TearDown() OVERRIDE { |
- NetworkConnectionHandler::Shutdown(); |
- NetworkConfigurationHandler::Shutdown(); |
- NetworkStateHandler::Shutdown(); |
+ network_connection_handler_.reset(); |
+ network_configuration_handler_.reset(); |
+ network_state_handler_.reset(); |
DBusThreadManager::Shutdown(); |
} |
@@ -67,7 +71,7 @@ class NetworkConnectionHandlerTest : public testing::Test { |
void Connect(const std::string& service_path) { |
const bool ignore_error_state = false; |
- NetworkConnectionHandler::Get()->ConnectToNetwork( |
+ network_connection_handler_->ConnectToNetwork( |
service_path, |
base::Bind(&NetworkConnectionHandlerTest::SuccessCallback, |
base::Unretained(this)), |
@@ -78,7 +82,7 @@ class NetworkConnectionHandlerTest : public testing::Test { |
} |
void Disconnect(const std::string& service_path) { |
- NetworkConnectionHandler::Get()->DisconnectNetwork( |
+ network_connection_handler_->DisconnectNetwork( |
service_path, |
base::Bind(&NetworkConnectionHandlerTest::SuccessCallback, |
base::Unretained(this)), |
@@ -113,6 +117,9 @@ class NetworkConnectionHandlerTest : public testing::Test { |
return result; |
} |
+ scoped_ptr<NetworkStateHandler> network_state_handler_; |
+ scoped_ptr<NetworkConfigurationHandler> network_configuration_handler_; |
+ scoped_ptr<NetworkConnectionHandler> network_connection_handler_; |
MessageLoopForUI message_loop_; |
std::string result_; |