Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: device/bluetooth/bluez/bluetooth_bluez_unittest.cc

Issue 2440043002: bluetooth: bluez: GetName uses 'name' instead of 'alias'. (Closed)
Patch Set: Android needs StartLowEnergyDiscoverySession; Browser test needs s/alias/name/ Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2127 matching lines...) Expand 10 before | Expand all | Expand 10 after
2138 ASSERT_EQ(2U, devices.size()); 2138 ASSERT_EQ(2U, devices.size());
2139 2139
2140 int idx = GetDeviceIndexByAddress( 2140 int idx = GetDeviceIndexByAddress(
2141 devices, bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress); 2141 devices, bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
2142 ASSERT_NE(-1, idx); 2142 ASSERT_NE(-1, idx);
2143 ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress, 2143 ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress,
2144 devices[idx]->GetAddress()); 2144 devices[idx]->GetAddress());
2145 2145
2146 // Verify the other device properties. 2146 // Verify the other device properties.
2147 EXPECT_EQ( 2147 EXPECT_EQ(
2148 base::UTF8ToUTF16(bluez::FakeBluetoothDeviceClient::kPairedDeviceAlias), 2148 base::UTF8ToUTF16(bluez::FakeBluetoothDeviceClient::kPairedDeviceName),
2149 devices[idx]->GetNameForDisplay()); 2149 devices[idx]->GetNameForDisplay());
2150 EXPECT_EQ(BluetoothDeviceType::COMPUTER, devices[idx]->GetDeviceType()); 2150 EXPECT_EQ(BluetoothDeviceType::COMPUTER, devices[idx]->GetDeviceType());
2151 EXPECT_TRUE(devices[idx]->IsPaired()); 2151 EXPECT_TRUE(devices[idx]->IsPaired());
2152 EXPECT_FALSE(devices[idx]->IsConnected()); 2152 EXPECT_FALSE(devices[idx]->IsConnected());
2153 EXPECT_FALSE(devices[idx]->IsConnecting()); 2153 EXPECT_FALSE(devices[idx]->IsConnecting());
2154 2154
2155 // Non HID devices are always connectable. 2155 // Non HID devices are always connectable.
2156 EXPECT_TRUE(devices[idx]->IsConnectable()); 2156 EXPECT_TRUE(devices[idx]->IsConnectable());
2157 2157
2158 BluetoothDevice::UUIDSet uuids = devices[idx]->GetUUIDs(); 2158 BluetoothDevice::UUIDSet uuids = devices[idx]->GetUUIDs();
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
2313 2313
2314 BluetoothAdapter::DeviceList devices = adapter_->GetDevices(); 2314 BluetoothAdapter::DeviceList devices = adapter_->GetDevices();
2315 ASSERT_EQ(2U, devices.size()); 2315 ASSERT_EQ(2U, devices.size());
2316 2316
2317 int idx = GetDeviceIndexByAddress( 2317 int idx = GetDeviceIndexByAddress(
2318 devices, bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress); 2318 devices, bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
2319 ASSERT_NE(-1, idx); 2319 ASSERT_NE(-1, idx);
2320 ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress, 2320 ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress,
2321 devices[idx]->GetAddress()); 2321 devices[idx]->GetAddress());
2322 ASSERT_EQ( 2322 ASSERT_EQ(
2323 base::UTF8ToUTF16(bluez::FakeBluetoothDeviceClient::kPairedDeviceAlias), 2323 base::UTF8ToUTF16(bluez::FakeBluetoothDeviceClient::kPairedDeviceName),
2324 devices[idx]->GetNameForDisplay()); 2324 devices[idx]->GetNameForDisplay());
2325 2325
2326 // Install an observer; expect the DeviceChanged method to be called when 2326 // Install an observer; expect the DeviceChanged method to be called when
2327 // we change the alias of the device. 2327 // we change the alias of the device.
2328 TestBluetoothAdapterObserver observer(adapter_); 2328 TestBluetoothAdapterObserver observer(adapter_);
2329 2329
2330 bluez::FakeBluetoothDeviceClient::Properties* properties = 2330 bluez::FakeBluetoothDeviceClient::Properties* properties =
2331 fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath( 2331 fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
2332 bluez::FakeBluetoothDeviceClient::kPairedDevicePath)); 2332 bluez::FakeBluetoothDeviceClient::kPairedDevicePath));
2333 2333
2334 static const std::string new_name("New Device Name"); 2334 static const std::string new_name("New Device Name");
2335 properties->alias.ReplaceValue(new_name); 2335 properties->name.ReplaceValue(new_name);
2336 2336
2337 EXPECT_EQ(1, observer.device_changed_count()); 2337 EXPECT_EQ(1, observer.device_changed_count());
2338 EXPECT_EQ(devices[idx], observer.last_device()); 2338 EXPECT_EQ(devices[idx], observer.last_device());
2339 2339
2340 EXPECT_EQ(base::UTF8ToUTF16(new_name), devices[idx]->GetNameForDisplay()); 2340 EXPECT_EQ(base::UTF8ToUTF16(new_name), devices[idx]->GetNameForDisplay());
2341 } 2341 }
2342 2342
2343 TEST_F(BluetoothBlueZTest, DeviceAddressChanged) { 2343 TEST_F(BluetoothBlueZTest, DeviceAddressChanged) {
2344 // Simulate a change of address of a device. 2344 // Simulate a change of address of a device.
2345 GetAdapter(); 2345 GetAdapter();
2346 2346
2347 BluetoothAdapter::DeviceList devices = adapter_->GetDevices(); 2347 BluetoothAdapter::DeviceList devices = adapter_->GetDevices();
2348 ASSERT_EQ(2U, devices.size()); 2348 ASSERT_EQ(2U, devices.size());
2349 2349
2350 int idx = GetDeviceIndexByAddress( 2350 int idx = GetDeviceIndexByAddress(
2351 devices, bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress); 2351 devices, bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
2352 ASSERT_NE(-1, idx); 2352 ASSERT_NE(-1, idx);
2353 ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress, 2353 ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress,
2354 devices[idx]->GetAddress()); 2354 devices[idx]->GetAddress());
2355 ASSERT_EQ( 2355 ASSERT_EQ(
2356 base::UTF8ToUTF16(bluez::FakeBluetoothDeviceClient::kPairedDeviceAlias), 2356 base::UTF8ToUTF16(bluez::FakeBluetoothDeviceClient::kPairedDeviceName),
2357 devices[idx]->GetNameForDisplay()); 2357 devices[idx]->GetNameForDisplay());
2358 2358
2359 // Install an observer; expect the DeviceAddressChanged method to be called 2359 // Install an observer; expect the DeviceAddressChanged method to be called
2360 // when we change the alias of the device. 2360 // when we change the alias of the device.
2361 TestBluetoothAdapterObserver observer(adapter_); 2361 TestBluetoothAdapterObserver observer(adapter_);
2362 2362
2363 bluez::FakeBluetoothDeviceClient::Properties* properties = 2363 bluez::FakeBluetoothDeviceClient::Properties* properties =
2364 fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath( 2364 fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
2365 bluez::FakeBluetoothDeviceClient::kPairedDevicePath)); 2365 bluez::FakeBluetoothDeviceClient::kPairedDevicePath));
2366 2366
(...skipping 2177 matching lines...) Expand 10 before | Expand all | Expand 10 after
4544 device->GetServiceData()); 4544 device->GetServiceData());
4545 EXPECT_EQ(BluetoothDevice::UUIDSet({BluetoothUUID(kPnpUuid)}), 4545 EXPECT_EQ(BluetoothDevice::UUIDSet({BluetoothUUID(kPnpUuid)}),
4546 device->GetServiceDataUUIDs()); 4546 device->GetServiceDataUUIDs());
4547 EXPECT_EQ(std::vector<uint8_t>({3, 2, 1}), 4547 EXPECT_EQ(std::vector<uint8_t>({3, 2, 1}),
4548 *(device->GetServiceDataForUUID(BluetoothUUID(kPnpUuid)))); 4548 *(device->GetServiceDataForUUID(BluetoothUUID(kPnpUuid))));
4549 EXPECT_EQ(nullptr, device->GetServiceDataForUUID(BluetoothUUID(kGapUuid))); 4549 EXPECT_EQ(nullptr, device->GetServiceDataForUUID(BluetoothUUID(kGapUuid)));
4550 EXPECT_EQ(nullptr, device->GetServiceDataForUUID(BluetoothUUID(kGattUuid))); 4550 EXPECT_EQ(nullptr, device->GetServiceDataForUUID(BluetoothUUID(kGattUuid)));
4551 } 4551 }
4552 4552
4553 } // namespace bluez 4553 } // namespace bluez
OLDNEW
« no previous file with comments | « device/bluetooth/bluez/bluetooth_adapter_bluez.cc ('k') | device/bluetooth/bluez/bluetooth_device_bluez.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698