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

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

Issue 2908673002: device/blueooth: Add BlueZ unit test for BluetoothDevice::SetConnectionInterval. (Closed)
Patch Set: Created 3 years, 6 months 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 #include <vector> 10 #include <vector>
(...skipping 4558 matching lines...) Expand 10 before | Expand all | Expand 10 after
4569 EXPECT_EQ(0x12u, device->GetAdvertisingDataFlags().value()); 4569 EXPECT_EQ(0x12u, device->GetAdvertisingDataFlags().value());
4570 4570
4571 // Check that we can update advertising data flags. 4571 // Check that we can update advertising data flags.
4572 properties->advertising_data_flags.ReplaceValue(std::vector<uint8_t>({0x23})); 4572 properties->advertising_data_flags.ReplaceValue(std::vector<uint8_t>({0x23}));
4573 EXPECT_EQ(2, observer.device_changed_count()); 4573 EXPECT_EQ(2, observer.device_changed_count());
4574 EXPECT_EQ(device, observer.last_device()); 4574 EXPECT_EQ(device, observer.last_device());
4575 EXPECT_TRUE(device->GetAdvertisingDataFlags().has_value()); 4575 EXPECT_TRUE(device->GetAdvertisingDataFlags().has_value());
4576 EXPECT_EQ(0x23u, device->GetAdvertisingDataFlags().value()); 4576 EXPECT_EQ(0x23u, device->GetAdvertisingDataFlags().value());
4577 } 4577 }
4578 4578
4579 TEST_F(BluetoothBlueZTest, SetConnectionLatency) {
4580 GetAdapter();
4581 DiscoverDevices();
4582
4583 // SetConnectionLatency is supported on LE devices.
4584 bluez::FakeBluetoothDeviceClient::Properties* properties =
4585 fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
4586 bluez::FakeBluetoothDeviceClient::kConnectUnpairablePath));
4587 properties->type.ReplaceValue(BluetoothDeviceClient::kTypeLe);
4588 BluetoothDevice* device = adapter_->GetDevice(
4589 bluez::FakeBluetoothDeviceClient::kConnectUnpairableAddress);
4590 ASSERT_TRUE(device);
4591
4592 device->SetConnectionLatency(
4593 BluetoothDevice::ConnectionLatency::CONNECTION_LATENCY_LOW, GetCallback(),
4594 GetErrorCallback());
4595 EXPECT_EQ(1, callback_count_);
4596 EXPECT_EQ(0, error_callback_count_);
4597
4598 device->SetConnectionLatency(
4599 BluetoothDevice::ConnectionLatency::CONNECTION_LATENCY_HIGH,
4600 GetCallback(), GetErrorCallback());
4601 EXPECT_EQ(2, callback_count_);
4602 EXPECT_EQ(0, error_callback_count_);
4603
Miao 2017/05/31 20:14:06 The test on BluetoothDeviceClient::kTypeDual shoul
Tim Song 2017/06/01 18:06:02 Done.
4604 // This API is not supported for BR/EDR devices.
4605 properties->type.ReplaceValue(BluetoothDeviceClient::kTypeBredr);
4606
4607 device->SetConnectionLatency(
4608 BluetoothDevice::ConnectionLatency::CONNECTION_LATENCY_MEDIUM,
4609 GetCallback(), GetErrorCallback());
4610 EXPECT_EQ(2, callback_count_);
4611 EXPECT_EQ(1, error_callback_count_);
4612 }
4613
4579 } // namespace bluez 4614 } // namespace bluez
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698