| 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.h" | 5 #include "base/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/mock_dbus_thread_manager_without_gmock.h" | 9 #include "chromeos/dbus/mock_dbus_thread_manager_without_gmock.h" |
| 10 #include "dbus/object_path.h" | 10 #include "dbus/object_path.h" |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 } | 237 } |
| 238 | 238 |
| 239 void ConnectErrorCallback(enum BluetoothDevice::ConnectErrorCode error) { | 239 void ConnectErrorCallback(enum BluetoothDevice::ConnectErrorCode error) { |
| 240 ++error_callback_count_; | 240 ++error_callback_count_; |
| 241 last_connect_error_ = error; | 241 last_connect_error_ = error; |
| 242 } | 242 } |
| 243 | 243 |
| 244 // Call to fill the adapter_ member with a BluetoothAdapter instance. | 244 // Call to fill the adapter_ member with a BluetoothAdapter instance. |
| 245 void GetAdapter() { | 245 void GetAdapter() { |
| 246 adapter_ = new BluetoothAdapterChromeOS(); | 246 adapter_ = new BluetoothAdapterChromeOS(); |
| 247 ASSERT_TRUE(adapter_ != NULL); | 247 ASSERT_TRUE(adapter_.get() != NULL); |
| 248 ASSERT_TRUE(adapter_->IsInitialized()); | 248 ASSERT_TRUE(adapter_->IsInitialized()); |
| 249 } | 249 } |
| 250 | 250 |
| 251 // Run a discovery phase until the named device is detected, or if the named | 251 // Run a discovery phase until the named device is detected, or if the named |
| 252 // device is not created, the discovery process ends without finding it. | 252 // device is not created, the discovery process ends without finding it. |
| 253 // | 253 // |
| 254 // The correct behavior of discovery is tested by the "Discovery" test case | 254 // The correct behavior of discovery is tested by the "Discovery" test case |
| 255 // without using this function. | 255 // without using this function. |
| 256 void DiscoverDevice(const std::string& address) { | 256 void DiscoverDevice(const std::string& address) { |
| 257 ASSERT_TRUE(adapter_ != NULL); | 257 ASSERT_TRUE(adapter_.get() != NULL); |
| 258 | 258 |
| 259 if (base::MessageLoop::current() == NULL) { | 259 if (base::MessageLoop::current() == NULL) { |
| 260 base::MessageLoop message_loop(base::MessageLoop::TYPE_DEFAULT); | 260 base::MessageLoop message_loop(base::MessageLoop::TYPE_DEFAULT); |
| 261 DiscoverDevices(); | 261 DiscoverDevices(); |
| 262 return; | 262 return; |
| 263 } | 263 } |
| 264 | 264 |
| 265 fake_bluetooth_device_client_->SetSimulationIntervalMs(10); | 265 fake_bluetooth_device_client_->SetSimulationIntervalMs(10); |
| 266 | 266 |
| 267 TestObserver observer(adapter_); | 267 TestObserver observer(adapter_); |
| (...skipping 1750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2018 EXPECT_FALSE(device->IsConnected()); | 2018 EXPECT_FALSE(device->IsConnected()); |
| 2019 EXPECT_FALSE(device->IsConnecting()); | 2019 EXPECT_FALSE(device->IsConnecting()); |
| 2020 EXPECT_FALSE(device->IsPaired()); | 2020 EXPECT_FALSE(device->IsPaired()); |
| 2021 | 2021 |
| 2022 // Pairing dialog should be dismissed | 2022 // Pairing dialog should be dismissed |
| 2023 EXPECT_EQ(1, pairing_delegate.call_count_); | 2023 EXPECT_EQ(1, pairing_delegate.call_count_); |
| 2024 EXPECT_EQ(1, pairing_delegate.dismiss_count_); | 2024 EXPECT_EQ(1, pairing_delegate.dismiss_count_); |
| 2025 } | 2025 } |
| 2026 | 2026 |
| 2027 } // namespace chromeos | 2027 } // namespace chromeos |
| OLD | NEW |