OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include <bluetooth/bluetooth.h> |
| 6 |
| 7 #include "chrome/browser/chromeos/bluetooth/bluetooth_utils.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 |
| 10 |
| 11 namespace chromeos { |
| 12 |
| 13 TEST(BluetoothUtilsTest, str2ba) { |
| 14 bdaddr_t bluetooth_address; |
| 15 |
| 16 EXPECT_TRUE(bluetooth_utils::str2ba("01:02:03:0A:10:A0", &bluetooth_address)); |
| 17 EXPECT_EQ(1, bluetooth_address.b[0]); |
| 18 EXPECT_EQ(2, bluetooth_address.b[1]); |
| 19 EXPECT_EQ(3, bluetooth_address.b[2]); |
| 20 EXPECT_EQ(10, bluetooth_address.b[3]); |
| 21 EXPECT_EQ(16, bluetooth_address.b[4]); |
| 22 EXPECT_EQ(160, bluetooth_address.b[5]); |
| 23 |
| 24 EXPECT_FALSE(bluetooth_utils::str2ba("obviously wrong", &bluetooth_address)); |
| 25 EXPECT_FALSE(bluetooth_utils::str2ba("00:00", &bluetooth_address)); |
| 26 EXPECT_FALSE(bluetooth_utils::str2ba("00:00:00:00:00:00:00", |
| 27 &bluetooth_address)); |
| 28 EXPECT_FALSE(bluetooth_utils::str2ba("01:02:03:0A:10:A0", NULL)); |
| 29 } |
| 30 |
| 31 } // namespace chromeos |
OLD | NEW |