OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
7 #include "chromeos/dbus/fake_bluetooth_adapter_client.h" | 7 #include "chromeos/dbus/fake_bluetooth_adapter_client.h" |
8 #include "chromeos/dbus/fake_bluetooth_device_client.h" | 8 #include "chromeos/dbus/fake_bluetooth_device_client.h" |
9 #include "chromeos/dbus/fake_dbus_thread_manager.h" | 9 #include "chromeos/dbus/fake_dbus_thread_manager.h" |
10 #include "dbus/object_path.h" | 10 #include "dbus/object_path.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 void QuitMessageLoop() { | 201 void QuitMessageLoop() { |
202 if (base::MessageLoop::current() && | 202 if (base::MessageLoop::current() && |
203 base::MessageLoop::current()->is_running()) | 203 base::MessageLoop::current()->is_running()) |
204 base::MessageLoop::current()->Quit(); | 204 base::MessageLoop::current()->Quit(); |
205 } | 205 } |
206 }; | 206 }; |
207 | 207 |
208 class BluetoothChromeOSTest : public testing::Test { | 208 class BluetoothChromeOSTest : public testing::Test { |
209 public: | 209 public: |
210 virtual void SetUp() { | 210 virtual void SetUp() { |
211 fake_dbus_thread_manager_ = new FakeDBusThreadManager(); | 211 FakeDBusThreadManager* fake_dbus_thread_manager = new FakeDBusThreadManager; |
212 DBusThreadManager::InitializeForTesting(fake_dbus_thread_manager_); | 212 fake_bluetooth_adapter_client_ = new FakeBluetoothAdapterClient; |
213 | 213 fake_dbus_thread_manager_->SetBluetoothAdapterClient( |
214 fake_bluetooth_adapter_client_ = | 214 scoped_ptr<BluetoothAdapterClient>(fake_bluetooth_adapter_client_)); |
215 fake_dbus_thread_manager_->fake_bluetooth_adapter_client(); | 215 fake_bluetooth_device_client_ = new FakeBluetoothDeviceClient; |
216 fake_bluetooth_device_client_ = | 216 fake_dbus_thread_manager_->SetBluetoothDeviceClient( |
217 fake_dbus_thread_manager_->fake_bluetooth_device_client(); | 217 scoped_ptr<BluetoothDeviceClient>(fake_bluetooth_device_client_)); |
| 218 DBusThreadManager::InitializeForTesting(fake_dbus_thread_manager); |
218 | 219 |
219 callback_count_ = 0; | 220 callback_count_ = 0; |
220 error_callback_count_ = 0; | 221 error_callback_count_ = 0; |
221 last_connect_error_ = BluetoothDevice::ERROR_UNKNOWN; | 222 last_connect_error_ = BluetoothDevice::ERROR_UNKNOWN; |
222 } | 223 } |
223 | 224 |
224 virtual void TearDown() { | 225 virtual void TearDown() { |
225 adapter_ = NULL; | 226 adapter_ = NULL; |
226 DBusThreadManager::Shutdown(); | 227 DBusThreadManager::Shutdown(); |
227 } | 228 } |
(...skipping 1789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2017 EXPECT_FALSE(device->IsConnected()); | 2018 EXPECT_FALSE(device->IsConnected()); |
2018 EXPECT_FALSE(device->IsConnecting()); | 2019 EXPECT_FALSE(device->IsConnecting()); |
2019 EXPECT_FALSE(device->IsPaired()); | 2020 EXPECT_FALSE(device->IsPaired()); |
2020 | 2021 |
2021 // Pairing dialog should be dismissed | 2022 // Pairing dialog should be dismissed |
2022 EXPECT_EQ(1, pairing_delegate.call_count_); | 2023 EXPECT_EQ(1, pairing_delegate.call_count_); |
2023 EXPECT_EQ(1, pairing_delegate.dismiss_count_); | 2024 EXPECT_EQ(1, pairing_delegate.dismiss_count_); |
2024 } | 2025 } |
2025 | 2026 |
2026 } // namespace chromeos | 2027 } // namespace chromeos |
OLD | NEW |