| 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 "device/bluetooth/bluetooth_service_record_mac.h" | 5 #include "device/bluetooth/bluetooth_service_record_mac.h" |
| 6 | 6 |
| 7 #import <IOBluetooth/objc/IOBluetoothSDPDataElement.h> | 7 #import <IOBluetooth/objc/IOBluetoothSDPDataElement.h> |
| 8 #import <IOBluetooth/objc/IOBluetoothSDPServiceRecord.h> | 8 #import <IOBluetooth/objc/IOBluetoothSDPServiceRecord.h> |
| 9 #import <IOBluetooth/objc/IOBluetoothSDPUUID.h> | 9 #import <IOBluetooth/objc/IOBluetoothSDPUUID.h> |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/sys_string_conversions.h" | 15 #include "base/strings/sys_string_conversions.h" |
| 16 #include "device/bluetooth/bluetooth_uuid.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 const BluetoothSDPServiceAttributeID kServiceClassIDAttributeId = 0x0001; | 21 const BluetoothSDPServiceAttributeID kServiceClassIDAttributeId = 0x0001; |
| 21 const BluetoothSDPServiceAttributeID kProtocolDescriptorListAttributeId = | 22 const BluetoothSDPServiceAttributeID kProtocolDescriptorListAttributeId = |
| 22 0x0004; | 23 0x0004; |
| 23 const BluetoothSDPServiceAttributeID kServiceNameAttributeId = 0x0100; | 24 const BluetoothSDPServiceAttributeID kServiceNameAttributeId = 0x0100; |
| 24 | 25 |
| 25 const uint8 kRfcommChannel = 0x0c; | 26 const uint8 kRfcommChannel = 0x0c; |
| 26 const char kServiceName[] = "Headset Audio Gateway"; | 27 const char kServiceName[] = "Headset Audio Gateway"; |
| 27 | 28 |
| 28 const char kExpectedRfcommUuid[] = "01234567-89ab-cdef-0123-456789abcdef"; | 29 const device::BluetoothUUID kExpectedRfcommUuid( |
| 29 const char kExpectedSerialUuid[] = "00001101-0000-1000-8000-00805f9b34fb"; | 30 "01234567-89ab-cdef-0123-456789abcdef"); |
| 31 const device::BluetoothUUID kExpectedSerialUuid("1101"); |
| 30 | 32 |
| 31 const int kMaxUuidSize = 16; | 33 const int kMaxUuidSize = 16; |
| 32 | 34 |
| 33 } // namespace | 35 } // namespace |
| 34 | 36 |
| 35 namespace device { | 37 namespace device { |
| 36 | 38 |
| 37 class BluetoothServiceRecordMacTest : public testing::Test { | 39 class BluetoothServiceRecordMacTest : public testing::Test { |
| 38 public: | 40 public: |
| 39 | 41 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 const char upper_case_uuid_bytes[] = "0123456789ABCDEF0123456789ABCDEF"; | 141 const char upper_case_uuid_bytes[] = "0123456789ABCDEF0123456789ABCDEF"; |
| 140 IOBluetoothSDPUUID* upper_case_uuid = | 142 IOBluetoothSDPUUID* upper_case_uuid = |
| 141 ConvertUuid(upper_case_uuid_bytes, sizeof(upper_case_uuid_bytes) / 2); | 143 ConvertUuid(upper_case_uuid_bytes, sizeof(upper_case_uuid_bytes) / 2); |
| 142 | 144 |
| 143 BluetoothServiceRecordMac record(GetServiceRecord(upper_case_uuid, false)); | 145 BluetoothServiceRecordMac record(GetServiceRecord(upper_case_uuid, false)); |
| 144 EXPECT_EQ(kExpectedRfcommUuid, record.uuid()); | 146 EXPECT_EQ(kExpectedRfcommUuid, record.uuid()); |
| 145 } | 147 } |
| 146 | 148 |
| 147 TEST_F(BluetoothServiceRecordMacTest, InvalidUuid) { | 149 TEST_F(BluetoothServiceRecordMacTest, InvalidUuid) { |
| 148 BluetoothServiceRecordMac record(GetServiceRecord(nil, false)); | 150 BluetoothServiceRecordMac record(GetServiceRecord(nil, false)); |
| 149 EXPECT_EQ("", record.uuid()); | 151 EXPECT_FALSE(record.uuid().IsValid()); |
| 150 } | 152 } |
| 151 | 153 |
| 152 } // namespace device | 154 } // namespace device |
| OLD | NEW |