OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <bluetooth/bluetooth.h> | 5 #include <bluetooth/bluetooth.h> |
6 | 6 |
7 #include "chrome/browser/chromeos/bluetooth/bluetooth_utils.h" | 7 #include "device/bluetooth/bluetooth_utils.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 namespace chromeos { | 10 namespace device_bluetooth { |
11 | 11 |
12 TEST(BluetoothUtilsTest, str2ba) { | 12 TEST(BluetoothUtilsTest, str2ba) { |
13 bdaddr_t bluetooth_address; | 13 bdaddr_t bluetooth_address; |
14 | 14 |
15 EXPECT_TRUE(bluetooth_utils::str2ba("01:02:03:0A:10:A0", &bluetooth_address)); | 15 EXPECT_TRUE(bluetooth_utils::str2ba("01:02:03:0A:10:A0", &bluetooth_address)); |
16 EXPECT_EQ(1, bluetooth_address.b[5]); | 16 EXPECT_EQ(1, bluetooth_address.b[5]); |
17 EXPECT_EQ(2, bluetooth_address.b[4]); | 17 EXPECT_EQ(2, bluetooth_address.b[4]); |
18 EXPECT_EQ(3, bluetooth_address.b[3]); | 18 EXPECT_EQ(3, bluetooth_address.b[3]); |
19 EXPECT_EQ(10, bluetooth_address.b[2]); | 19 EXPECT_EQ(10, bluetooth_address.b[2]); |
20 EXPECT_EQ(16, bluetooth_address.b[1]); | 20 EXPECT_EQ(16, bluetooth_address.b[1]); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 EXPECT_EQ("00001101-0000-1000-8000-00805f9b34fb", | 62 EXPECT_EQ("00001101-0000-1000-8000-00805f9b34fb", |
63 bluetooth_utils::CanonicalUuid("00001101")); | 63 bluetooth_utils::CanonicalUuid("00001101")); |
64 EXPECT_EQ("00001101-0000-1000-8000-00805f9b34fb", | 64 EXPECT_EQ("00001101-0000-1000-8000-00805f9b34fb", |
65 bluetooth_utils::CanonicalUuid("0x00001101")); | 65 bluetooth_utils::CanonicalUuid("0x00001101")); |
66 | 66 |
67 // No 0x prefix on 36 character | 67 // No 0x prefix on 36 character |
68 EXPECT_EQ("", | 68 EXPECT_EQ("", |
69 bluetooth_utils::CanonicalUuid("0x00001101-0000-1000-8000-00805f9b34fb")); | 69 bluetooth_utils::CanonicalUuid("0x00001101-0000-1000-8000-00805f9b34fb")); |
70 } | 70 } |
71 | 71 |
72 } // namespace chromeos | 72 } // namespace device_bluetooth |
OLD | NEW |