| 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 #ifndef CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVIDER
     _H_ | 5 #ifndef CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVIDER
     _H_ | 
| 6 #define CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVIDER
     _H_ | 6 #define CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVIDER
     _H_ | 
| 7 | 7 | 
| 8 #include "base/callback.h" | 8 #include "base/callback.h" | 
| 9 #include "device/bluetooth/test/mock_bluetooth_adapter.h" | 9 #include "device/bluetooth/test/mock_bluetooth_adapter.h" | 
| 10 #include "device/bluetooth/test/mock_bluetooth_device.h" | 10 #include "device/bluetooth/test/mock_bluetooth_device.h" | 
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 161   static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> | 161   static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> | 
| 162   GetGenericAccessAdapter(); | 162   GetGenericAccessAdapter(); | 
| 163 | 163 | 
| 164   // |HeartRateAdapter| | 164   // |HeartRateAdapter| | 
| 165   // Inherits from |EmptyAdapter| | 165   // Inherits from |EmptyAdapter| | 
| 166   // Internal Structure: | 166   // Internal Structure: | 
| 167   //   - Heart Rate Device | 167   //   - Heart Rate Device | 
| 168   //      - Generic Access UUID (0x1800) | 168   //      - Generic Access UUID (0x1800) | 
| 169   //      - Heart Rate UUID (0x180D) | 169   //      - Heart Rate UUID (0x180D) | 
| 170   //      - Heart Rate Service | 170   //      - Heart Rate Service | 
|  | 171   //         - Body Sensor Location | 
|  | 172   //           - Mock Functions: | 
|  | 173   //              - Read: Calls GattCharacteristicValueChanged and success | 
|  | 174   //                      callback with [1] which corresponds to chest. | 
| 171   //         - Heart Rate Measurement Characteristic: | 175   //         - Heart Rate Measurement Characteristic: | 
| 172   //            - Mock Functions: | 176   //            - Mock Functions: | 
| 173   //               - StartNotifySession: Calls success callback with a | 177   //               - StartNotifySession: Sets a timer to call | 
|  | 178   //                 GattCharacteristicValueChanged every 10ms and calls success | 
|  | 179   //                 callback with a | 
| 174   //                 BaseGATTNotifySession(characteristic_instance_id) | 180   //                 BaseGATTNotifySession(characteristic_instance_id) | 
|  | 181   //                 TODO: Instead of a timer we should be able to tell | 
|  | 182   //                 the fake adapter to call GattCharacteristicValueChanged | 
|  | 183   //                 from js. | 
|  | 184   //                 https://crbug.com/543884 | 
| 175   static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> | 185   static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> | 
| 176   GetHeartRateAdapter(); | 186   GetHeartRateAdapter(); | 
| 177 | 187 | 
| 178   // |FailingConnectionsAdapter| | 188   // |FailingConnectionsAdapter| | 
| 179   // Inherits from |EmptyAdapter| | 189   // Inherits from |EmptyAdapter| | 
| 180   // FailingConnectionsAdapter holds a device for each type of connection error | 190   // FailingConnectionsAdapter holds a device for each type of connection error | 
| 181   // that can occur. This way we don’t need to create an adapter for each type | 191   // that can occur. This way we don’t need to create an adapter for each type | 
| 182   // of error. Each of the devices has a service with a different UUID so that | 192   // of error. Each of the devices has a service with a different UUID so that | 
| 183   // they can be accessed by using different filters. | 193   // they can be accessed by using different filters. | 
| 184   // See errorUUID() declaration below. | 194   // See errorUUID() declaration below. | 
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 425 | 435 | 
| 426   // Notify Sessions | 436   // Notify Sessions | 
| 427 | 437 | 
| 428   // |BaseGATTNotifySession|(characteristic_identifier) | 438   // |BaseGATTNotifySession|(characteristic_identifier) | 
| 429   // Mock Functions: | 439   // Mock Functions: | 
| 430   //   - GetCharacteristicIdentifier: | 440   //   - GetCharacteristicIdentifier: | 
| 431   //       Returns: characteristic_identifier | 441   //       Returns: characteristic_identifier | 
| 432   //   - IsActive: | 442   //   - IsActive: | 
| 433   //       Returns: true | 443   //       Returns: true | 
| 434   //   - Stop: | 444   //   - Stop: | 
| 435   //       Run callback. | 445   //       Stops calling GattCharacteristicValueChanged and runs callback. | 
| 436   static scoped_ptr<testing::NiceMock<device::MockBluetoothGattNotifySession>> | 446   static scoped_ptr<testing::NiceMock<device::MockBluetoothGattNotifySession>> | 
| 437   GetBaseGATTNotifySession(const std::string& characteristic_identifier); | 447   GetBaseGATTNotifySession(const std::string& characteristic_identifier); | 
| 438 | 448 | 
| 439   // Helper functions: | 449   // Helper functions: | 
| 440 | 450 | 
| 441   // errorUUID(alias) returns a UUID with the top 32 bits of | 451   // errorUUID(alias) returns a UUID with the top 32 bits of | 
| 442   // "00000000-97e5-4cd7-b9f1-f5a427670c59" replaced with the bits of |alias|. | 452   // "00000000-97e5-4cd7-b9f1-f5a427670c59" replaced with the bits of |alias|. | 
| 443   // For example, errorUUID(0xDEADBEEF) returns | 453   // For example, errorUUID(0xDEADBEEF) returns | 
| 444   // "deadbeef-97e5-4cd7-b9f1-f5a427670c59". The bottom 96 bits of error UUIDs | 454   // "deadbeef-97e5-4cd7-b9f1-f5a427670c59". The bottom 96 bits of error UUIDs | 
| 445   // were generated as a type 4 (random) UUID. | 455   // were generated as a type 4 (random) UUID. | 
| 446   static std::string errorUUID(uint32_t alias); | 456   static std::string errorUUID(uint32_t alias); | 
| 447 | 457 | 
| 448   // Function to turn an integer into an MAC address of the form | 458   // Function to turn an integer into an MAC address of the form | 
| 449   // XX:XX:XX:XX:XX:XX. For example makeMACAddress(0xdeadbeef) | 459   // XX:XX:XX:XX:XX:XX. For example makeMACAddress(0xdeadbeef) | 
| 450   // returns "00:00:DE:AD:BE:EF". | 460   // returns "00:00:DE:AD:BE:EF". | 
| 451   static std::string makeMACAddress(uint64_t addr); | 461   static std::string makeMACAddress(uint64_t addr); | 
| 452 }; | 462 }; | 
| 453 | 463 | 
| 454 }  // namespace content | 464 }  // namespace content | 
| 455 | 465 | 
| 456 #endif  // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVI
     DER_H_ | 466 #endif  // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVI
     DER_H_ | 
| OLD | NEW | 
|---|