OLD | NEW |
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.h" | 7 #include "base/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/mock_dbus_thread_manager.h" | 11 #include "chromeos/dbus/mock_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_service_client.h" | 13 #include "chromeos/dbus/mock_shill_service_client.h" |
14 #include "chromeos/network/network_configuration_handler.h" | 14 #include "chromeos/network/network_configuration_handler.h" |
| 15 #include "chromeos/network/network_state_handler.h" |
15 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
17 | 18 |
18 using ::testing::_; | 19 using ::testing::_; |
19 using ::testing::Invoke; | 20 using ::testing::Invoke; |
20 using ::testing::Pointee; | 21 using ::testing::Pointee; |
21 using ::testing::Return; | 22 using ::testing::Return; |
22 using ::testing::SaveArg; | 23 using ::testing::SaveArg; |
23 using ::testing::StrEq; | 24 using ::testing::StrEq; |
24 | 25 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 virtual void SetUp() OVERRIDE { | 81 virtual void SetUp() OVERRIDE { |
81 MockDBusThreadManager* mock_dbus_thread_manager = new MockDBusThreadManager; | 82 MockDBusThreadManager* mock_dbus_thread_manager = new MockDBusThreadManager; |
82 EXPECT_CALL(*mock_dbus_thread_manager, GetSystemBus()) | 83 EXPECT_CALL(*mock_dbus_thread_manager, GetSystemBus()) |
83 .WillRepeatedly(Return(reinterpret_cast<dbus::Bus*>(NULL))); | 84 .WillRepeatedly(Return(reinterpret_cast<dbus::Bus*>(NULL))); |
84 DBusThreadManager::InitializeForTesting(mock_dbus_thread_manager); | 85 DBusThreadManager::InitializeForTesting(mock_dbus_thread_manager); |
85 mock_manager_client_ = | 86 mock_manager_client_ = |
86 mock_dbus_thread_manager->mock_shill_manager_client(); | 87 mock_dbus_thread_manager->mock_shill_manager_client(); |
87 mock_service_client_ = | 88 mock_service_client_ = |
88 mock_dbus_thread_manager->mock_shill_service_client(); | 89 mock_dbus_thread_manager->mock_shill_service_client(); |
89 | 90 |
90 // Initialize DBusThreadManager with a stub implementation. | 91 NetworkStateHandler::Initialize(); |
91 NetworkConfigurationHandler::Initialize(); | 92 NetworkConfigurationHandler::Initialize(); |
92 message_loop_.RunUntilIdle(); | 93 message_loop_.RunUntilIdle(); |
93 } | 94 } |
94 | 95 |
95 virtual void TearDown() OVERRIDE { | 96 virtual void TearDown() OVERRIDE { |
96 NetworkConfigurationHandler::Shutdown(); | 97 NetworkConfigurationHandler::Shutdown(); |
| 98 NetworkStateHandler::Shutdown(); |
97 DBusThreadManager::Shutdown(); | 99 DBusThreadManager::Shutdown(); |
98 } | 100 } |
99 | 101 |
100 // Handles responses for GetProperties method calls. | 102 // Handles responses for GetProperties method calls. |
101 void OnGetProperties( | 103 void OnGetProperties( |
102 const dbus::ObjectPath& path, | 104 const dbus::ObjectPath& path, |
103 const ShillClientHelper::DictionaryValueCallback& callback) { | 105 const ShillClientHelper::DictionaryValueCallback& callback) { |
104 callback.Run(DBUS_METHOD_CALL_SUCCESS, *dictionary_value_result_); | 106 callback.Run(DBUS_METHOD_CALL_SUCCESS, *dictionary_value_result_); |
105 } | 107 } |
106 | 108 |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 Invoke(this, | 316 Invoke(this, |
315 &NetworkConfigurationHandlerTest::OnRemove)); | 317 &NetworkConfigurationHandlerTest::OnRemove)); |
316 NetworkConfigurationHandler::Get()->RemoveConfiguration( | 318 NetworkConfigurationHandler::Get()->RemoveConfiguration( |
317 service_path, | 319 service_path, |
318 base::Bind(&base::DoNothing), | 320 base::Bind(&base::DoNothing), |
319 base::Bind(&ErrorCallback, false, service_path)); | 321 base::Bind(&ErrorCallback, false, service_path)); |
320 message_loop_.RunUntilIdle(); | 322 message_loop_.RunUntilIdle(); |
321 } | 323 } |
322 | 324 |
323 } // namespace chromeos | 325 } // namespace chromeos |
OLD | NEW |