Files.app: Provide detailed change information on onDirectoryChanged event
[chromium-blink-merge.git] / device / bluetooth / bluetooth_low_energy_win_unittest.cc
blob2db9d2081327f93100391f1a51fcdc4440bec037
1 // Copyright 2014 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.
5 #include "device/bluetooth/bluetooth_low_energy_win.h"
6 #include "testing/gtest/include/gtest/gtest.h"
8 namespace {
10 const char kValidDeviceInstanceId[] =
11 "BTHLE\\DEV_BC6A29AB5FB0\\8&31038925&0&BC6A29AB5FB0";
13 const char kInvalidDeviceInstanceId[] =
14 "BTHLE\\BC6A29AB5FB0_DEV_\\8&31038925&0&BC6A29AB5FB0";
16 } // namespace
18 namespace device {
20 class BluetoothLowEnergyWinTest : public testing::Test {};
22 TEST_F(BluetoothLowEnergyWinTest, ExtractValidBluetoothAddress) {
23 BLUETOOTH_ADDRESS btha;
24 std::string error;
25 bool success =
26 device::win::ExtractBluetoothAddressFromDeviceInstanceIdForTesting(
27 kValidDeviceInstanceId, &btha, &error);
29 EXPECT_TRUE(success);
30 EXPECT_TRUE(error.empty());
31 EXPECT_EQ(0xbc, btha.rgBytes[5]);
32 EXPECT_EQ(0x6a, btha.rgBytes[4]);
33 EXPECT_EQ(0x29, btha.rgBytes[3]);
34 EXPECT_EQ(0xab, btha.rgBytes[2]);
35 EXPECT_EQ(0x5f, btha.rgBytes[1]);
36 EXPECT_EQ(0xb0, btha.rgBytes[0]);
39 TEST_F(BluetoothLowEnergyWinTest, ExtractInvalidBluetoothAddress) {
40 BLUETOOTH_ADDRESS btha;
41 std::string error;
42 bool success =
43 device::win::ExtractBluetoothAddressFromDeviceInstanceIdForTesting(
44 kInvalidDeviceInstanceId, &btha, &error);
46 EXPECT_FALSE(success);
47 EXPECT_FALSE(error.empty());
50 } // namespace device