Chromium Code Reviews| 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 DBusThreadManager::InitializeForTesting(fake_dbus_thread_manager); | |
|
armansito
2014/08/13 20:59:27
Can you add a note here explaining why this has to
| |
| 238 fake_bluetooth_adapter_client_ = new FakeBluetoothAdapterClient; | 239 fake_bluetooth_adapter_client_ = new FakeBluetoothAdapterClient; |
| 239 fake_dbus_thread_manager->SetBluetoothAdapterClient( | 240 fake_dbus_thread_manager->SetBluetoothAdapterClient( |
| 240 scoped_ptr<BluetoothAdapterClient>(fake_bluetooth_adapter_client_)); | 241 scoped_ptr<BluetoothAdapterClient>(fake_bluetooth_adapter_client_)); |
| 241 fake_bluetooth_device_client_ = new FakeBluetoothDeviceClient; | 242 fake_bluetooth_device_client_ = new FakeBluetoothDeviceClient; |
| 242 fake_dbus_thread_manager->SetBluetoothDeviceClient( | 243 fake_dbus_thread_manager->SetBluetoothDeviceClient( |
| 243 scoped_ptr<BluetoothDeviceClient>(fake_bluetooth_device_client_)); | 244 scoped_ptr<BluetoothDeviceClient>(fake_bluetooth_device_client_)); |
| 244 fake_dbus_thread_manager->SetBluetoothInputClient( | 245 fake_dbus_thread_manager->SetBluetoothInputClient( |
| 245 scoped_ptr<BluetoothInputClient>(new FakeBluetoothInputClient)); | 246 scoped_ptr<BluetoothInputClient>(new FakeBluetoothInputClient)); |
| 246 fake_dbus_thread_manager->SetBluetoothAgentManagerClient( | 247 fake_dbus_thread_manager->SetBluetoothAgentManagerClient( |
| 247 scoped_ptr<BluetoothAgentManagerClient>( | 248 scoped_ptr<BluetoothAgentManagerClient>( |
| 248 new FakeBluetoothAgentManagerClient)); | 249 new FakeBluetoothAgentManagerClient)); |
| 249 fake_dbus_thread_manager->SetBluetoothGattServiceClient( | 250 fake_dbus_thread_manager->SetBluetoothGattServiceClient( |
| 250 scoped_ptr<BluetoothGattServiceClient>( | 251 scoped_ptr<BluetoothGattServiceClient>( |
| 251 new FakeBluetoothGattServiceClient)); | 252 new FakeBluetoothGattServiceClient)); |
| 252 DBusThreadManager::InitializeForTesting(fake_dbus_thread_manager); | |
| 253 | 253 |
| 254 fake_bluetooth_adapter_client_->SetSimulationIntervalMs(10); | 254 fake_bluetooth_adapter_client_->SetSimulationIntervalMs(10); |
| 255 | 255 |
| 256 callback_count_ = 0; | 256 callback_count_ = 0; |
| 257 error_callback_count_ = 0; | 257 error_callback_count_ = 0; |
| 258 last_connect_error_ = BluetoothDevice::ERROR_UNKNOWN; | 258 last_connect_error_ = BluetoothDevice::ERROR_UNKNOWN; |
| 259 last_client_error_ = ""; | 259 last_client_error_ = ""; |
| 260 } | 260 } |
| 261 | 261 |
| 262 virtual void TearDown() { | 262 virtual void TearDown() { |
| (...skipping 2910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3173 // Unknown vendor specification identifier. | 3173 // Unknown vendor specification identifier. |
| 3174 properties->modalias.ReplaceValue("chrome:v00E0p2400d0400"); | 3174 properties->modalias.ReplaceValue("chrome:v00E0p2400d0400"); |
| 3175 | 3175 |
| 3176 EXPECT_EQ(BluetoothDevice::VENDOR_ID_UNKNOWN, device->GetVendorIDSource()); | 3176 EXPECT_EQ(BluetoothDevice::VENDOR_ID_UNKNOWN, device->GetVendorIDSource()); |
| 3177 EXPECT_EQ(0, device->GetVendorID()); | 3177 EXPECT_EQ(0, device->GetVendorID()); |
| 3178 EXPECT_EQ(0, device->GetProductID()); | 3178 EXPECT_EQ(0, device->GetProductID()); |
| 3179 EXPECT_EQ(0, device->GetDeviceID()); | 3179 EXPECT_EQ(0, device->GetDeviceID()); |
| 3180 } | 3180 } |
| 3181 | 3181 |
| 3182 } // namespace chromeos | 3182 } // namespace chromeos |
| OLD | NEW |