Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Side by Side Diff: chrome/browser/chromeos/bluetooth/bluetooth_utils_unittest.cc

Issue 10007008: Add support for creating bluetooth RFCOMM sockets. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove extensions code Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698