There was a missing check to return the right record.
R=erikwright@chromium.org, youngki@chromium.org BUG= Review URL: https://chromiumcodereview.appspot.com/21089002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214751 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
@@ -108,7 +108,7 @@ class BluetoothDevice {
|
|||||||
//
|
//
|
||||||
// This is used for Bluetooth 2.0 and earlier keyboard devices, the
|
// This is used for Bluetooth 2.0 and earlier keyboard devices, the
|
||||||
// |pincode| will always be a six-digit numeric in the range 000000-999999
|
// |pincode| will always be a six-digit numeric in the range 000000-999999
|
||||||
// for compatibilty with later specifications.
|
// for compatibility with later specifications.
|
||||||
virtual void DisplayPinCode(BluetoothDevice* device,
|
virtual void DisplayPinCode(BluetoothDevice* device,
|
||||||
const std::string& pincode) = 0;
|
const std::string& pincode) = 0;
|
||||||
|
|
||||||
@@ -186,7 +186,7 @@ class BluetoothDevice {
|
|||||||
virtual uint16 GetDeviceID() const = 0;
|
virtual uint16 GetDeviceID() const = 0;
|
||||||
|
|
||||||
// Returns the name of the device suitable for displaying, this may
|
// Returns the name of the device suitable for displaying, this may
|
||||||
// be a synthesied string containing the address and localized type name
|
// be a synthesized string containing the address and localized type name
|
||||||
// if the device has no obtained name.
|
// if the device has no obtained name.
|
||||||
virtual string16 GetName() const;
|
virtual string16 GetName() const;
|
||||||
|
|
||||||
@@ -323,10 +323,10 @@ class BluetoothDevice {
|
|||||||
|
|
||||||
// Disconnects the device, terminating the low-level ACL connection
|
// Disconnects the device, terminating the low-level ACL connection
|
||||||
// and any application connections using it, and then discards link keys
|
// and any application connections using it, and then discards link keys
|
||||||
// and other pairing information. The device object remainds valid until
|
// and other pairing information. The device object remains valid until
|
||||||
// returing from the calling function, after which it should be assumed to
|
// returning from the calling function, after which it should be assumed to
|
||||||
// have been deleted. If the request fails, |error_callback| will be called.
|
// have been deleted. If the request fails, |error_callback| will be called.
|
||||||
// There is no callback for success beause this object is often deleted
|
// There is no callback for success because this object is often deleted
|
||||||
// before that callback would be called.
|
// before that callback would be called.
|
||||||
virtual void Forget(const ErrorCallback& error_callback) = 0;
|
virtual void Forget(const ErrorCallback& error_callback) = 0;
|
||||||
|
|
||||||
|
@@ -221,7 +221,8 @@ const BluetoothServiceRecord* BluetoothDeviceWin::GetServiceRecord(
|
|||||||
for (ServiceRecordList::const_iterator iter = service_record_list_.begin();
|
for (ServiceRecordList::const_iterator iter = service_record_list_.begin();
|
||||||
iter != service_record_list_.end();
|
iter != service_record_list_.end();
|
||||||
++iter) {
|
++iter) {
|
||||||
return *iter;
|
if ((*iter)->uuid().compare(uuid) == 0)
|
||||||
|
return *iter;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@@ -94,7 +94,7 @@ class BluetoothDeviceWin : public BluetoothDevice {
|
|||||||
// The Bluetooth address of the device.
|
// The Bluetooth address of the device.
|
||||||
std::string address_;
|
std::string address_;
|
||||||
|
|
||||||
// Tracked device state, updated by the adapter managing the lifecyle of
|
// Tracked device state, updated by the adapter managing the lifecycle of
|
||||||
// the device.
|
// the device.
|
||||||
bool paired_;
|
bool paired_;
|
||||||
bool connected_;
|
bool connected_;
|
||||||
|
@@ -101,6 +101,23 @@ TEST_F(BluetoothDeviceWinTest, GetServiceRecords) {
|
|||||||
EXPECT_EQ(2, service_records_->size());
|
EXPECT_EQ(2, service_records_->size());
|
||||||
EXPECT_STREQ(kTestAudioSdpUuid, (*service_records_)[0]->uuid().c_str());
|
EXPECT_STREQ(kTestAudioSdpUuid, (*service_records_)[0]->uuid().c_str());
|
||||||
EXPECT_STREQ(kTestVideoSdpUuid, (*service_records_)[1]->uuid().c_str());
|
EXPECT_STREQ(kTestVideoSdpUuid, (*service_records_)[1]->uuid().c_str());
|
||||||
|
|
||||||
|
BluetoothDeviceWin* device_win =
|
||||||
|
reinterpret_cast<BluetoothDeviceWin*>(device_.get());
|
||||||
|
|
||||||
|
const BluetoothServiceRecord* audio_device =
|
||||||
|
device_win->GetServiceRecord(kTestAudioSdpUuid);
|
||||||
|
ASSERT_TRUE(audio_device != NULL);
|
||||||
|
EXPECT_EQ((*service_records_)[0], audio_device);
|
||||||
|
|
||||||
|
const BluetoothServiceRecord* video_device =
|
||||||
|
device_win->GetServiceRecord(kTestVideoSdpUuid);
|
||||||
|
ASSERT_TRUE(video_device != NULL);
|
||||||
|
EXPECT_EQ((*service_records_)[1], video_device);
|
||||||
|
|
||||||
|
const BluetoothServiceRecord* invalid_device =
|
||||||
|
device_win->GetServiceRecord(kTestVideoSdpAddress);
|
||||||
|
EXPECT_TRUE(invalid_device == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(BluetoothDeviceWinTest, ProvidesServiceWithName) {
|
TEST_F(BluetoothDeviceWinTest, ProvidesServiceWithName) {
|
||||||
|
Reference in New Issue
Block a user