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 <string> |
| 6 |
| 7 #include "base/file_path.h" |
| 8 #include "base/file_util.h" |
| 9 #include "base/path_service.h" |
| 10 #include "chrome/browser/chromeos/bluetooth/bluetooth_service_record.h" |
| 11 #include "chrome/common/chrome_paths.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 |
| 14 namespace { |
| 15 |
| 16 static const char* kAddress = "01:02:03:04:05:06"; |
| 17 |
| 18 } // namespace |
| 19 |
| 20 namespace chromeos { |
| 21 |
| 22 class BluetoothServiceRecordTest : public testing::Test { |
| 23 public: |
| 24 FilePath GetTestDataFilePath(const char* file) { |
| 25 FilePath path; |
| 26 PathService::Get(chrome::DIR_TEST_DATA, &path); |
| 27 path = path.AppendASCII("chromeos"); |
| 28 path = path.AppendASCII("bluetooth"); |
| 29 path = path.AppendASCII(file); |
| 30 return path; |
| 31 } |
| 32 }; |
| 33 |
| 34 TEST_F(BluetoothServiceRecordTest, RfcommService) { |
| 35 std::string xml_data; |
| 36 file_util::ReadFileToString(GetTestDataFilePath("rfcomm.xml"), &xml_data); |
| 37 |
| 38 BluetoothServiceRecord service_record(kAddress, xml_data); |
| 39 EXPECT_EQ(kAddress, service_record.address()); |
| 40 EXPECT_EQ("Headset Audio Gateway", service_record.name()); |
| 41 EXPECT_TRUE(service_record.SupportsRfcomm()); |
| 42 EXPECT_EQ((uint8_t)12, service_record.rfcomm_channel()); |
| 43 } |
| 44 |
| 45 } // namespace chromeos |
OLD | NEW |