| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 2134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2145 ASSERT_EQ(2U, devices.size()); | 2145 ASSERT_EQ(2U, devices.size()); |
| 2146 | 2146 |
| 2147 int idx = GetDeviceIndexByAddress( | 2147 int idx = GetDeviceIndexByAddress( |
| 2148 devices, bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress); | 2148 devices, bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress); |
| 2149 ASSERT_NE(-1, idx); | 2149 ASSERT_NE(-1, idx); |
| 2150 ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress, | 2150 ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress, |
| 2151 devices[idx]->GetAddress()); | 2151 devices[idx]->GetAddress()); |
| 2152 | 2152 |
| 2153 // Verify the other device properties. | 2153 // Verify the other device properties. |
| 2154 EXPECT_EQ( | 2154 EXPECT_EQ( |
| 2155 base::UTF8ToUTF16(bluez::FakeBluetoothDeviceClient::kPairedDeviceName), | 2155 base::UTF8ToUTF16(bluez::FakeBluetoothDeviceClient::kPairedDeviceAlias), |
| 2156 devices[idx]->GetNameForDisplay()); | 2156 devices[idx]->GetNameForDisplay()); |
| 2157 EXPECT_EQ(BluetoothDevice::DEVICE_COMPUTER, devices[idx]->GetDeviceType()); | 2157 EXPECT_EQ(BluetoothDevice::DEVICE_COMPUTER, devices[idx]->GetDeviceType()); |
| 2158 EXPECT_TRUE(devices[idx]->IsPaired()); | 2158 EXPECT_TRUE(devices[idx]->IsPaired()); |
| 2159 EXPECT_FALSE(devices[idx]->IsConnected()); | 2159 EXPECT_FALSE(devices[idx]->IsConnected()); |
| 2160 EXPECT_FALSE(devices[idx]->IsConnecting()); | 2160 EXPECT_FALSE(devices[idx]->IsConnecting()); |
| 2161 | 2161 |
| 2162 // Non HID devices are always connectable. | 2162 // Non HID devices are always connectable. |
| 2163 EXPECT_TRUE(devices[idx]->IsConnectable()); | 2163 EXPECT_TRUE(devices[idx]->IsConnectable()); |
| 2164 | 2164 |
| 2165 BluetoothDevice::UUIDList uuids = devices[idx]->GetUUIDs(); | 2165 BluetoothDevice::UUIDList uuids = devices[idx]->GetUUIDs(); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2320 | 2320 |
| 2321 BluetoothAdapter::DeviceList devices = adapter_->GetDevices(); | 2321 BluetoothAdapter::DeviceList devices = adapter_->GetDevices(); |
| 2322 ASSERT_EQ(2U, devices.size()); | 2322 ASSERT_EQ(2U, devices.size()); |
| 2323 | 2323 |
| 2324 int idx = GetDeviceIndexByAddress( | 2324 int idx = GetDeviceIndexByAddress( |
| 2325 devices, bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress); | 2325 devices, bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress); |
| 2326 ASSERT_NE(-1, idx); | 2326 ASSERT_NE(-1, idx); |
| 2327 ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress, | 2327 ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress, |
| 2328 devices[idx]->GetAddress()); | 2328 devices[idx]->GetAddress()); |
| 2329 ASSERT_EQ( | 2329 ASSERT_EQ( |
| 2330 base::UTF8ToUTF16(bluez::FakeBluetoothDeviceClient::kPairedDeviceName), | 2330 base::UTF8ToUTF16(bluez::FakeBluetoothDeviceClient::kPairedDeviceAlias), |
| 2331 devices[idx]->GetNameForDisplay()); | 2331 devices[idx]->GetNameForDisplay()); |
| 2332 | 2332 |
| 2333 // Install an observer; expect the DeviceChanged method to be called when | 2333 // Install an observer; expect the DeviceChanged method to be called when |
| 2334 // we change the alias of the device. | 2334 // we change the alias of the device. |
| 2335 TestBluetoothAdapterObserver observer(adapter_); | 2335 TestBluetoothAdapterObserver observer(adapter_); |
| 2336 | 2336 |
| 2337 bluez::FakeBluetoothDeviceClient::Properties* properties = | 2337 bluez::FakeBluetoothDeviceClient::Properties* properties = |
| 2338 fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath( | 2338 fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath( |
| 2339 bluez::FakeBluetoothDeviceClient::kPairedDevicePath)); | 2339 bluez::FakeBluetoothDeviceClient::kPairedDevicePath)); |
| 2340 | 2340 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2353 | 2353 |
| 2354 BluetoothAdapter::DeviceList devices = adapter_->GetDevices(); | 2354 BluetoothAdapter::DeviceList devices = adapter_->GetDevices(); |
| 2355 ASSERT_EQ(2U, devices.size()); | 2355 ASSERT_EQ(2U, devices.size()); |
| 2356 | 2356 |
| 2357 int idx = GetDeviceIndexByAddress( | 2357 int idx = GetDeviceIndexByAddress( |
| 2358 devices, bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress); | 2358 devices, bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress); |
| 2359 ASSERT_NE(-1, idx); | 2359 ASSERT_NE(-1, idx); |
| 2360 ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress, | 2360 ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress, |
| 2361 devices[idx]->GetAddress()); | 2361 devices[idx]->GetAddress()); |
| 2362 ASSERT_EQ( | 2362 ASSERT_EQ( |
| 2363 base::UTF8ToUTF16(bluez::FakeBluetoothDeviceClient::kPairedDeviceName), | 2363 base::UTF8ToUTF16(bluez::FakeBluetoothDeviceClient::kPairedDeviceAlias), |
| 2364 devices[idx]->GetNameForDisplay()); | 2364 devices[idx]->GetNameForDisplay()); |
| 2365 | 2365 |
| 2366 // Install an observer; expect the DeviceAddressChanged method to be called | 2366 // Install an observer; expect the DeviceAddressChanged method to be called |
| 2367 // when we change the alias of the device. | 2367 // when we change the alias of the device. |
| 2368 TestBluetoothAdapterObserver observer(adapter_); | 2368 TestBluetoothAdapterObserver observer(adapter_); |
| 2369 | 2369 |
| 2370 bluez::FakeBluetoothDeviceClient::Properties* properties = | 2370 bluez::FakeBluetoothDeviceClient::Properties* properties = |
| 2371 fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath( | 2371 fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath( |
| 2372 bluez::FakeBluetoothDeviceClient::kPairedDevicePath)); | 2372 bluez::FakeBluetoothDeviceClient::kPairedDevicePath)); |
| 2373 | 2373 |
| (...skipping 2123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4497 adapter_->Shutdown(); | 4497 adapter_->Shutdown(); |
| 4498 adapter_bluez->OnStopDiscoveryError(GetDiscoveryErrorCallback(), "", ""); | 4498 adapter_bluez->OnStopDiscoveryError(GetDiscoveryErrorCallback(), "", ""); |
| 4499 | 4499 |
| 4500 // 1 error reported to RemoveDiscoverySession because of OnStopDiscoveryError, | 4500 // 1 error reported to RemoveDiscoverySession because of OnStopDiscoveryError, |
| 4501 // and kNumberOfDiscoverySessions errors queued with AddDiscoverySession. | 4501 // and kNumberOfDiscoverySessions errors queued with AddDiscoverySession. |
| 4502 EXPECT_EQ(0, callback_count_); | 4502 EXPECT_EQ(0, callback_count_); |
| 4503 EXPECT_EQ(1 + kNumberOfDiscoverySessions, error_callback_count_); | 4503 EXPECT_EQ(1 + kNumberOfDiscoverySessions, error_callback_count_); |
| 4504 } | 4504 } |
| 4505 | 4505 |
| 4506 } // namespace bluez | 4506 } // namespace bluez |
| OLD | NEW |