OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/browser/bluetooth/bluetooth_allowed_devices_map.h" | 5 #include "content/browser/bluetooth/bluetooth_allowed_devices_map.h" |
6 | 6 |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "url/gurl.h" | 9 #include "url/gurl.h" |
10 | 10 |
11 using device::BluetoothUUID; | 11 using device::BluetoothUUID; |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 namespace { | 14 namespace { |
15 const url::Origin kTestOrigin1(GURL("https://www.example1.com")); | 15 const url::Origin kTestOrigin1(GURL("https://www.example1.com")); |
16 const url::Origin kTestOrigin2(GURL("https://www.example2.com")); | 16 const url::Origin kTestOrigin2(GURL("https://www.example2.com")); |
17 | 17 |
18 const std::string kDeviceAddress1 = "00:00:00"; | 18 const std::string kDeviceAddress1 = "00:00:00"; |
19 const std::string kDeviceAddress2 = "11:11:11"; | 19 const std::string kDeviceAddress2 = "11:11:11"; |
20 | 20 |
21 const char kGlucoseUUID[] = "00001808-0000-1000-8000-00805f9b34fb"; | 21 const char kGlucoseUUIDString[] = "00001808-0000-1000-8000-00805f9b34fb"; |
22 const char kHeartRateUUID[] = "0000180d-0000-1000-8000-00805f9b34fb"; | 22 const char kHeartRateUUIDString[] = "0000180d-0000-1000-8000-00805f9b34fb"; |
23 const char kBatteryServiceUUID[] = "0000180f-0000-1000-8000-00805f9b34fb"; | 23 const char kBatteryServiceUUIDString[] = "0000180f-0000-1000-8000-00805f9b34fb"; |
24 const char kBloodPressureUUID[] = "00001813-0000-1000-8000-00805f9b34fb"; | 24 const char kBloodPressureUUIDString[] = "00001813-0000-1000-8000-00805f9b34fb"; |
25 const char kCyclingPowerUUID[] = "00001818-0000-1000-8000-00805f9b34fb"; | 25 const char kCyclingPowerUUIDString[] = "00001818-0000-1000-8000-00805f9b34fb"; |
| 26 const BluetoothUUID kGlucoseUUID(kGlucoseUUIDString); |
| 27 const BluetoothUUID kHeartRateUUID(kHeartRateUUIDString); |
| 28 const BluetoothUUID kBatteryServiceUUID(kBatteryServiceUUIDString); |
| 29 const BluetoothUUID kBloodPressureUUID(kBloodPressureUUIDString); |
| 30 const BluetoothUUID kCyclingPowerUUID(kCyclingPowerUUIDString); |
26 | 31 |
27 class BluetoothAllowedDevicesMapTest : public testing::Test { | 32 class BluetoothAllowedDevicesMapTest : public testing::Test { |
28 protected: | 33 protected: |
29 BluetoothAllowedDevicesMapTest() { | 34 BluetoothAllowedDevicesMapTest() { |
30 empty_options_ = blink::mojom::WebBluetoothRequestDeviceOptions::New(); | 35 empty_options_ = blink::mojom::WebBluetoothRequestDeviceOptions::New(); |
31 } | 36 } |
32 | 37 |
33 ~BluetoothAllowedDevicesMapTest() override {} | 38 ~BluetoothAllowedDevicesMapTest() override {} |
34 | 39 |
35 blink::mojom::WebBluetoothRequestDeviceOptionsPtr empty_options_; | 40 blink::mojom::WebBluetoothRequestDeviceOptionsPtr empty_options_; |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 const std::string& device_id = allowed_devices_map.AddDevice( | 431 const std::string& device_id = allowed_devices_map.AddDevice( |
427 kTestOrigin1, kDeviceAddress1, empty_options_); | 432 kTestOrigin1, kDeviceAddress1, empty_options_); |
428 | 433 |
429 EXPECT_TRUE(device_id.size() == 24) | 434 EXPECT_TRUE(device_id.size() == 24) |
430 << "Expected Lenghth of a 128bit string encoded to Base64."; | 435 << "Expected Lenghth of a 128bit string encoded to Base64."; |
431 EXPECT_TRUE((device_id[22] == '=') && (device_id[23] == '=')) | 436 EXPECT_TRUE((device_id[22] == '=') && (device_id[23] == '=')) |
432 << "Expected padding characters for a 128bit string encoded to Base64."; | 437 << "Expected padding characters for a 128bit string encoded to Base64."; |
433 } | 438 } |
434 | 439 |
435 } // namespace content | 440 } // namespace content |
OLD | NEW |