diff options
author | etienneb@chromium.org <etienneb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-31 15:49:36 +0000 |
---|---|---|
committer | etienneb@chromium.org <etienneb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-31 15:49:36 +0000 |
commit | 69b6838cc05f9dc9f7027d45b5ec95de3e5ad1a0 (patch) | |
tree | dc3f753f77fe1cbefaea1f724752d1a38c0d41c9 /device | |
parent | 793f2312bc6ce5c24d9ccd63c08ab85037ccbab5 (diff) | |
download | chromium_src-69b6838cc05f9dc9f7027d45b5ec95de3e5ad1a0.zip chromium_src-69b6838cc05f9dc9f7027d45b5ec95de3e5ad1a0.tar.gz chromium_src-69b6838cc05f9dc9f7027d45b5ec95de3e5ad1a0.tar.bz2 |
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
Diffstat (limited to 'device')
-rw-r--r-- | device/bluetooth/bluetooth_device.h | 10 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_device_win.cc | 3 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_device_win.h | 2 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_device_win_unittest.cc | 17 |
4 files changed, 25 insertions, 7 deletions
diff --git a/device/bluetooth/bluetooth_device.h b/device/bluetooth/bluetooth_device.h index 831e5e5..aaf4e93 100644 --- a/device/bluetooth/bluetooth_device.h +++ b/device/bluetooth/bluetooth_device.h @@ -108,7 +108,7 @@ class BluetoothDevice { // // 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 - // for compatibilty with later specifications. + // for compatibility with later specifications. virtual void DisplayPinCode(BluetoothDevice* device, const std::string& pincode) = 0; @@ -186,7 +186,7 @@ class BluetoothDevice { virtual uint16 GetDeviceID() const = 0; // 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. virtual string16 GetName() const; @@ -323,10 +323,10 @@ class BluetoothDevice { // Disconnects the device, terminating the low-level ACL connection // and any application connections using it, and then discards link keys - // and other pairing information. The device object remainds valid until - // returing from the calling function, after which it should be assumed to + // and other pairing information. The device object remains valid until + // returning from the calling function, after which it should be assumed to // 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. virtual void Forget(const ErrorCallback& error_callback) = 0; diff --git a/device/bluetooth/bluetooth_device_win.cc b/device/bluetooth/bluetooth_device_win.cc index 34b7b40..bfd9bc6 100644 --- a/device/bluetooth/bluetooth_device_win.cc +++ b/device/bluetooth/bluetooth_device_win.cc @@ -221,7 +221,8 @@ const BluetoothServiceRecord* BluetoothDeviceWin::GetServiceRecord( for (ServiceRecordList::const_iterator iter = service_record_list_.begin(); iter != service_record_list_.end(); ++iter) { - return *iter; + if ((*iter)->uuid().compare(uuid) == 0) + return *iter; } return NULL; } diff --git a/device/bluetooth/bluetooth_device_win.h b/device/bluetooth/bluetooth_device_win.h index 7e208ed..452f6f2 100644 --- a/device/bluetooth/bluetooth_device_win.h +++ b/device/bluetooth/bluetooth_device_win.h @@ -94,7 +94,7 @@ class BluetoothDeviceWin : public BluetoothDevice { // The Bluetooth address of the device. 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. bool paired_; bool connected_; diff --git a/device/bluetooth/bluetooth_device_win_unittest.cc b/device/bluetooth/bluetooth_device_win_unittest.cc index 93fd990..20be2ad 100644 --- a/device/bluetooth/bluetooth_device_win_unittest.cc +++ b/device/bluetooth/bluetooth_device_win_unittest.cc @@ -101,6 +101,23 @@ TEST_F(BluetoothDeviceWinTest, GetServiceRecords) { EXPECT_EQ(2, service_records_->size()); EXPECT_STREQ(kTestAudioSdpUuid, (*service_records_)[0]->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) { |