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

Unified 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: rebase diff to exclude 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/bluetooth/bluetooth_utils.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/bluetooth/bluetooth_utils_unittest.cc
diff --git a/chrome/browser/chromeos/bluetooth/bluetooth_utils_unittest.cc b/chrome/browser/chromeos/bluetooth/bluetooth_utils_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4c04035cb5d569ce54c589185100695479956811
--- /dev/null
+++ b/chrome/browser/chromeos/bluetooth/bluetooth_utils_unittest.cc
@@ -0,0 +1,31 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <bluetooth/bluetooth.h>
+
+#include "chrome/browser/chromeos/bluetooth/bluetooth_utils.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+
+namespace chromeos {
+
+TEST(BluetoothUtilsTest, str2ba) {
+ bdaddr_t bluetooth_address;
+
+ EXPECT_TRUE(bluetooth_utils::str2ba("01:02:03:0A:10:A0", &bluetooth_address));
+ EXPECT_EQ(1, bluetooth_address.b[0]);
+ EXPECT_EQ(2, bluetooth_address.b[1]);
+ EXPECT_EQ(3, bluetooth_address.b[2]);
+ EXPECT_EQ(10, bluetooth_address.b[3]);
+ EXPECT_EQ(16, bluetooth_address.b[4]);
+ EXPECT_EQ(160, bluetooth_address.b[5]);
+
+ EXPECT_FALSE(bluetooth_utils::str2ba("obviously wrong", &bluetooth_address));
+ EXPECT_FALSE(bluetooth_utils::str2ba("00:00", &bluetooth_address));
+ EXPECT_FALSE(bluetooth_utils::str2ba("00:00:00:00:00:00:00",
+ &bluetooth_address));
+ EXPECT_FALSE(bluetooth_utils::str2ba("01:02:03:0A:10:A0", NULL));
+}
+
+} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/bluetooth/bluetooth_utils.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698