OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "device/bluetooth/bluetooth_device.h" | 5 #include "device/bluetooth/bluetooth_device.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "device/bluetooth/test/test_bluetooth_adapter_observer.h" | 10 #include "device/bluetooth/test/test_bluetooth_adapter_observer.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 TestBluetoothAdapterObserver observer(adapter_); | 70 TestBluetoothAdapterObserver observer(adapter_); |
71 | 71 |
72 adapter_->StartDiscoverySession(GetDiscoverySessionCallback(), | 72 adapter_->StartDiscoverySession(GetDiscoverySessionCallback(), |
73 GetErrorCallback()); | 73 GetErrorCallback()); |
74 base::RunLoop().RunUntilIdle(); | 74 base::RunLoop().RunUntilIdle(); |
75 DiscoverLowEnergyDevice(1); | 75 DiscoverLowEnergyDevice(1); |
76 base::RunLoop().RunUntilIdle(); | 76 base::RunLoop().RunUntilIdle(); |
77 BluetoothDevice* device = observer.last_device(); | 77 BluetoothDevice* device = observer.last_device(); |
78 ASSERT_TRUE(device); | 78 ASSERT_TRUE(device); |
79 EXPECT_EQ(0x1F00u, device->GetBluetoothClass()); | 79 EXPECT_EQ(0x1F00u, device->GetBluetoothClass()); |
80 EXPECT_EQ(kTestDeviceAddress1, device->GetAddress()); | 80 EXPECT_EQ("AA:00:00:00:00:01", device->GetAddress()); |
81 EXPECT_EQ(BluetoothDevice::VENDOR_ID_UNKNOWN, device->GetVendorIDSource()); | 81 EXPECT_EQ(BluetoothDevice::VENDOR_ID_UNKNOWN, device->GetVendorIDSource()); |
82 EXPECT_EQ(0, device->GetVendorID()); | 82 EXPECT_EQ(0, device->GetVendorID()); |
83 EXPECT_EQ(0, device->GetProductID()); | 83 EXPECT_EQ(0, device->GetProductID()); |
84 EXPECT_EQ(0, device->GetDeviceID()); | 84 EXPECT_EQ(0, device->GetDeviceID()); |
85 EXPECT_EQ(base::UTF8ToUTF16("FakeBluetoothDevice"), device->GetName()); | 85 EXPECT_EQ(base::UTF8ToUTF16("FakeBluetoothDevice"), device->GetName()); |
86 EXPECT_EQ(true, device->IsPaired()); | 86 EXPECT_EQ(true, device->IsPaired()); |
87 BluetoothDevice::UUIDList uuids = device->GetUUIDs(); | 87 BluetoothDevice::UUIDList uuids = device->GetUUIDs(); |
88 EXPECT_TRUE(ContainsValue(uuids, BluetoothUUID("1800"))); | 88 EXPECT_TRUE(ContainsValue(uuids, BluetoothUUID("1800"))); |
89 EXPECT_TRUE(ContainsValue(uuids, BluetoothUUID("1801"))); | 89 EXPECT_TRUE(ContainsValue(uuids, BluetoothUUID("1801"))); |
90 } | 90 } |
(...skipping 18 matching lines...) Expand all Loading... |
109 #endif // defined(OS_ANDROID) | 109 #endif // defined(OS_ANDROID) |
110 | 110 |
111 // TODO(scheib): Test with a device with no name. http://crbug.com/506415 | 111 // TODO(scheib): Test with a device with no name. http://crbug.com/506415 |
112 // BluetoothDevice::GetAddressWithLocalizedDeviceTypeName() will run, which | 112 // BluetoothDevice::GetAddressWithLocalizedDeviceTypeName() will run, which |
113 // requires string resources to be loaded. For that, something like | 113 // requires string resources to be loaded. For that, something like |
114 // InitSharedInstance must be run. See unittest files that call that. It will | 114 // InitSharedInstance must be run. See unittest files that call that. It will |
115 // also require build configuration to generate string resources into a .pak | 115 // also require build configuration to generate string resources into a .pak |
116 // file. | 116 // file. |
117 | 117 |
118 } // namespace device | 118 } // namespace device |
OLD | NEW |