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

Side by Side Diff: device/bluetooth/README.md

Issue 2737343003: bluetooth: Add FakeBluetooth interface (Closed)
Patch Set: Add all the READMEs! Created 3 years, 8 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 # Bluetooth 1 # Bluetooth
2 2
3 `device/bluetooth` abstracts 3 `device/bluetooth` abstracts
4 [Bluetooth Classic](https://en.wikipedia.org/wiki/Bluetooth) and 4 [Bluetooth Classic](https://en.wikipedia.org/wiki/Bluetooth) and
5 [Low Energy](https://en.wikipedia.org/wiki/Bluetooth_low_energy) features 5 [Low Energy](https://en.wikipedia.org/wiki/Bluetooth_low_energy) features
6 across multiple platforms. 6 across multiple platforms.
7 7
8 Classic and Low Energy based profiles differ substantially. Platform 8 Classic and Low Energy based profiles differ substantially. Platform
9 implementations may support only one or the other, even though several classes 9 implementations may support only one or the other, even though several classes
10 have interfaces for both, e.g. `BluetoothAdapter` & `BluetoothDevice`. 10 have interfaces for both, e.g. `BluetoothAdapter` & `BluetoothDevice`.
(...skipping 25 matching lines...) Expand all
36 * [chrome.bluetoothSocket](https://developer.chrome.com/apps/bluetoothSocket) 36 * [chrome.bluetoothSocket](https://developer.chrome.com/apps/bluetoothSocket)
37 37
38 Active development in 2015 & 2016 is focused on enabling GATT features for: 38 Active development in 2015 & 2016 is focused on enabling GATT features for:
39 39
40 * [Web Bluetooth](https://crbug.com/419413) 40 * [Web Bluetooth](https://crbug.com/419413)
41 * Peripheral mode for Chrome OS. 41 * Peripheral mode for Chrome OS.
42 42
43 Known future work is tracked in the 43 Known future work is tracked in the
44 [Refactoring meta issue](https://crbug.com/580406). 44 [Refactoring meta issue](https://crbug.com/580406).
45 45
46
47 ## Testing 46 ## Testing
48 47 See [test/README.md](//device/bluetooth/test/README.md)
49 Implementation of the Bluetooth component is tested via unittests. Client code
50 uses Mock Bluetooth objects:
51
52
53 ### Cross Platform Unit Tests
54
55 New feature development uses cross platform unit tests. This reduces test code
56 redundancy and produces consistency across all implementations.
57
58 Unit tests operate at the public `device/bluetooth` API layer and the
59 `BluetoothTest` fixture controls fake operating system behavior as close to the
60 platfom as possible. The resulting test coverage spans the cross platform API,
61 common implementation, and platform specific implementation as close to
62 operating system APIs as possible.
63
64 `test/bluetooth_test.h` defines the cross platform test fixture
65 `BluetoothTestBase`. Platform implementations provide subclasses, such as
66 `test/bluetooth_test_android.h` and typedef to the name `BluetoothTest`.
67
68 [More testing information](https://docs.google.com/document/d/1mBipxn1sJu6jMqP0R QZpkYXC1o601bzLCpCxwTA2yGA/edit?usp=sharing)
69
70 ### Legacy Platform Specific Unit Tests
71
72 Early code (Classic on most platforms, and Low Energy on BlueZ) was tested with
73 platform specific unit tests, e.g. `bluetooth_bluez_unittest.cc` &
74 `bluetooth_adapter_win_unittest.cc`. The BlueZ style has platform specific
75 methods to create fake devices and the public API is used to interact with them.
76
77 Maintenance of these earlier implementation featuress should update tests in
78 place. Long term these tests should be [refactored into cross platform
79 tests](https://crbug.com/580403).
80
81
82 ### Mock Bluetooth Objects
83
84 `test/mock_bluetooth_*` files provide GoogleMock based fake objects for use in
85 client code.
86
87
88 ### Chrome OS Blueooth Controller Tests
89
90 Bluetooth controller system tests generating radio signals are run and managed
91 by the Chrome OS team. See:
92 https://chromium.googlesource.com/chromiumos/third_party/autotest/+/master/serve r/site_tests/
93 https://chromium.googlesource.com/chromiumos/third_party/autotest/+/master/serve r/cros/bluetooth/
94 https://chromium.googlesource.com/chromiumos/third_party/autotest/+/master/clien t/cros/bluetooth/
95
96
97 ## Android
98
99 The android implementation requires crossing from C++ to Java using
100 [__JNI__](https://www.chromium.org/developers/design-documents/android-jni).
101
102 Object ownership is rooted in the C++ classes, starting with the Adapter, which
103 owns Devices, Services, etc. Java counter parts interface with the Android
104 Bluetooth objects. E.g.
105
106 For testing, the Android objects are __wrapped__ in:
107 `android/java/src/org/chromium/device/bluetooth/Wrappers.java`. <br>
108 and __fakes__ implemented in:
109 `test/android/java/src/org/chromium/device/bluetooth/Fakes.java`.
110
111 Thus:
112
113 * `bluetooth_adapter_android.h` owns:
114 * `android/.../ChromeBluetoothAdapter.java` uses:
115 * `android/.../Wrappers.java`: `BluetoothAdapterWrapper`
116 * Which under test is a `FakeBluetoothAdapter`
117 * `bluetooth_device_android.h` owns:
118 * `android/.../ChromeBluetoothDevice.java` uses:
119 * `android/.../Wrappers.java`: `BluetoothDeviceWrapper`
120 * Which under test is a `FakeBluetoothDevice`
121 * `bluetooth_gatt_service_android.h` owns:
122 * `android/.../ChromeBluetoothService.java` uses:
123 * `android/.../Wrappers.java`: `BluetoothServiceWrapper`
124 * Which under test is a `FakeBluetoothService`
125 * ... and so on for characteristics and descriptors.
126
127 Fake objects are controlled by `bluetooth_test_android.cc`.
128
129 See also: [Class Diagram of Web Bluetooth through Bluetooth Android][Class]
130
131 [Class]: https://sites.google.com/a/chromium.org/dev/developers/design-documents /bluetooth-design-docs/web-bluetooth-through-bluetooth-android-class-diagram
132
133 48
134 ## Design Documents 49 ## Design Documents
135 50
136 * [Bluetooth Notifications](https://docs.google.com/document/d/1guBtAnQUP8ZoZre4 VQGrjR5uX0ZYxfK-lwKNeqY0-z4/edit?usp=sharing) 2016-08-26 51 * [Bluetooth Notifications](https://docs.google.com/document/d/1guBtAnQUP8ZoZre4 VQGrjR5uX0ZYxfK-lwKNeqY0-z4/edit?usp=sharing) 2016-08-26
137 * Web Bluetooth through Android implementation details, class diagram and 52 * Web Bluetooth through Android implementation details, class diagram and
138 call flow. 53 call flow.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698