Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Side by Side Diff: content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.h

Issue 1382743002: bluetooth: Add characteristicvaluechanged event (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-notifications-1
Patch Set: Final clean up Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
Jeffrey Yasskin 2015/10/15 23:00:51 Good hack. Can you file a bug to change this to an
ortuno 2015/10/16 01:24:21 Done.
179 // callback with a
174 // BaseGATTNotifySession(characteristic_instance_id) 180 // BaseGATTNotifySession(characteristic_instance_id)
175 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> 181 static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>>
176 GetHeartRateAdapter(); 182 GetHeartRateAdapter();
177 183
178 // |FailingConnectionsAdapter| 184 // |FailingConnectionsAdapter|
179 // Inherits from |EmptyAdapter| 185 // Inherits from |EmptyAdapter|
180 // FailingConnectionsAdapter holds a device for each type of connection error 186 // 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 187 // 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 188 // of error. Each of the devices has a service with a different UUID so that
183 // they can be accessed by using different filters. 189 // they can be accessed by using different filters.
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 431
426 // Notify Sessions 432 // Notify Sessions
427 433
428 // |BaseGATTNotifySession|(characteristic_identifier) 434 // |BaseGATTNotifySession|(characteristic_identifier)
429 // Mock Functions: 435 // Mock Functions:
430 // - GetCharacteristicIdentifier: 436 // - GetCharacteristicIdentifier:
431 // Returns: characteristic_identifier 437 // Returns: characteristic_identifier
432 // - IsActive: 438 // - IsActive:
433 // Returns: true 439 // Returns: true
434 // - Stop: 440 // - Stop:
435 // Run callback. 441 // Stops calling GattCharacteristicValueChanged and runs callback.
436 static scoped_ptr<testing::NiceMock<device::MockBluetoothGattNotifySession>> 442 static scoped_ptr<testing::NiceMock<device::MockBluetoothGattNotifySession>>
437 GetBaseGATTNotifySession(const std::string& characteristic_identifier); 443 GetBaseGATTNotifySession(const std::string& characteristic_identifier);
438 444
439 // Helper functions: 445 // Helper functions:
440 446
441 // errorUUID(alias) returns a UUID with the top 32 bits of 447 // errorUUID(alias) returns a UUID with the top 32 bits of
442 // "00000000-97e5-4cd7-b9f1-f5a427670c59" replaced with the bits of |alias|. 448 // "00000000-97e5-4cd7-b9f1-f5a427670c59" replaced with the bits of |alias|.
443 // For example, errorUUID(0xDEADBEEF) returns 449 // For example, errorUUID(0xDEADBEEF) returns
444 // "deadbeef-97e5-4cd7-b9f1-f5a427670c59". The bottom 96 bits of error UUIDs 450 // "deadbeef-97e5-4cd7-b9f1-f5a427670c59". The bottom 96 bits of error UUIDs
445 // were generated as a type 4 (random) UUID. 451 // were generated as a type 4 (random) UUID.
446 static std::string errorUUID(uint32_t alias); 452 static std::string errorUUID(uint32_t alias);
447 453
448 // Function to turn an integer into an MAC address of the form 454 // Function to turn an integer into an MAC address of the form
449 // XX:XX:XX:XX:XX:XX. For example makeMACAddress(0xdeadbeef) 455 // XX:XX:XX:XX:XX:XX. For example makeMACAddress(0xdeadbeef)
450 // returns "00:00:DE:AD:BE:EF". 456 // returns "00:00:DE:AD:BE:EF".
451 static std::string makeMACAddress(uint64_t addr); 457 static std::string makeMACAddress(uint64_t addr);
452 }; 458 };
453 459
454 } // namespace content 460 } // namespace content
455 461
456 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVI DER_H_ 462 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVI DER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698