| 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/memory/scoped_vector.h" | 5 #include "base/memory/scoped_vector.h" |
| 6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chromeos/dbus/fake_bluetooth_adapter_client.h" | 8 #include "chromeos/dbus/fake_bluetooth_adapter_client.h" |
| 9 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h" | 9 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h" |
| 10 #include "chromeos/dbus/fake_bluetooth_device_client.h" | 10 #include "chromeos/dbus/fake_bluetooth_device_client.h" |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 if (base::MessageLoop::current() && | 228 if (base::MessageLoop::current() && |
| 229 base::MessageLoop::current()->is_running()) | 229 base::MessageLoop::current()->is_running()) |
| 230 base::MessageLoop::current()->Quit(); | 230 base::MessageLoop::current()->Quit(); |
| 231 } | 231 } |
| 232 }; | 232 }; |
| 233 | 233 |
| 234 class BluetoothChromeOSTest : public testing::Test { | 234 class BluetoothChromeOSTest : public testing::Test { |
| 235 public: | 235 public: |
| 236 virtual void SetUp() { | 236 virtual void SetUp() { |
| 237 FakeDBusThreadManager* fake_dbus_thread_manager = new FakeDBusThreadManager; | 237 FakeDBusThreadManager* fake_dbus_thread_manager = new FakeDBusThreadManager; |
| 238 // We need to initialize DBusThreadManager early to prevent |
| 239 // Bluetooth*::Create() methods from picking the real instead of fake |
| 240 // implementations. |
| 241 DBusThreadManager::InitializeForTesting(fake_dbus_thread_manager); |
| 238 fake_bluetooth_adapter_client_ = new FakeBluetoothAdapterClient; | 242 fake_bluetooth_adapter_client_ = new FakeBluetoothAdapterClient; |
| 239 fake_dbus_thread_manager->SetBluetoothAdapterClient( | 243 fake_dbus_thread_manager->SetBluetoothAdapterClient( |
| 240 scoped_ptr<BluetoothAdapterClient>(fake_bluetooth_adapter_client_)); | 244 scoped_ptr<BluetoothAdapterClient>(fake_bluetooth_adapter_client_)); |
| 241 fake_bluetooth_device_client_ = new FakeBluetoothDeviceClient; | 245 fake_bluetooth_device_client_ = new FakeBluetoothDeviceClient; |
| 242 fake_dbus_thread_manager->SetBluetoothDeviceClient( | 246 fake_dbus_thread_manager->SetBluetoothDeviceClient( |
| 243 scoped_ptr<BluetoothDeviceClient>(fake_bluetooth_device_client_)); | 247 scoped_ptr<BluetoothDeviceClient>(fake_bluetooth_device_client_)); |
| 244 fake_dbus_thread_manager->SetBluetoothInputClient( | 248 fake_dbus_thread_manager->SetBluetoothInputClient( |
| 245 scoped_ptr<BluetoothInputClient>(new FakeBluetoothInputClient)); | 249 scoped_ptr<BluetoothInputClient>(new FakeBluetoothInputClient)); |
| 246 fake_dbus_thread_manager->SetBluetoothAgentManagerClient( | 250 fake_dbus_thread_manager->SetBluetoothAgentManagerClient( |
| 247 scoped_ptr<BluetoothAgentManagerClient>( | 251 scoped_ptr<BluetoothAgentManagerClient>( |
| 248 new FakeBluetoothAgentManagerClient)); | 252 new FakeBluetoothAgentManagerClient)); |
| 249 fake_dbus_thread_manager->SetBluetoothGattServiceClient( | 253 fake_dbus_thread_manager->SetBluetoothGattServiceClient( |
| 250 scoped_ptr<BluetoothGattServiceClient>( | 254 scoped_ptr<BluetoothGattServiceClient>( |
| 251 new FakeBluetoothGattServiceClient)); | 255 new FakeBluetoothGattServiceClient)); |
| 252 DBusThreadManager::InitializeForTesting(fake_dbus_thread_manager); | |
| 253 | 256 |
| 254 fake_bluetooth_adapter_client_->SetSimulationIntervalMs(10); | 257 fake_bluetooth_adapter_client_->SetSimulationIntervalMs(10); |
| 255 | 258 |
| 256 callback_count_ = 0; | 259 callback_count_ = 0; |
| 257 error_callback_count_ = 0; | 260 error_callback_count_ = 0; |
| 258 last_connect_error_ = BluetoothDevice::ERROR_UNKNOWN; | 261 last_connect_error_ = BluetoothDevice::ERROR_UNKNOWN; |
| 259 last_client_error_ = ""; | 262 last_client_error_ = ""; |
| 260 } | 263 } |
| 261 | 264 |
| 262 virtual void TearDown() { | 265 virtual void TearDown() { |
| (...skipping 2910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3173 // Unknown vendor specification identifier. | 3176 // Unknown vendor specification identifier. |
| 3174 properties->modalias.ReplaceValue("chrome:v00E0p2400d0400"); | 3177 properties->modalias.ReplaceValue("chrome:v00E0p2400d0400"); |
| 3175 | 3178 |
| 3176 EXPECT_EQ(BluetoothDevice::VENDOR_ID_UNKNOWN, device->GetVendorIDSource()); | 3179 EXPECT_EQ(BluetoothDevice::VENDOR_ID_UNKNOWN, device->GetVendorIDSource()); |
| 3177 EXPECT_EQ(0, device->GetVendorID()); | 3180 EXPECT_EQ(0, device->GetVendorID()); |
| 3178 EXPECT_EQ(0, device->GetProductID()); | 3181 EXPECT_EQ(0, device->GetProductID()); |
| 3179 EXPECT_EQ(0, device->GetDeviceID()); | 3182 EXPECT_EQ(0, device->GetDeviceID()); |
| 3180 } | 3183 } |
| 3181 | 3184 |
| 3182 } // namespace chromeos | 3185 } // namespace chromeos |
| OLD | NEW |