Index: content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.h |
diff --git a/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.h b/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4cf67c029169c0d2cc9ab6482a593e14c4078b56 |
--- /dev/null |
+++ b/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.h |
@@ -0,0 +1,90 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVIDER_H_ |
+#define CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVIDER_H_ |
+ |
+#include "base/callback.h" |
+#include "device/bluetooth/bluetooth_adapter.h" |
+#include "device/bluetooth/bluetooth_adapter_factory.h" |
+#include "device/bluetooth/bluetooth_device.h" |
+#include "device/bluetooth/bluetooth_uuid.h" |
+#include "device/bluetooth/test/mock_bluetooth_adapter.h" |
+#include "device/bluetooth/test/mock_bluetooth_device.h" |
+#include "device/bluetooth/test/mock_bluetooth_discovery_session.h" |
+ |
+namespace content { |
+ |
+using device::BluetoothAdapter; |
+using device::BluetoothAdapterFactory; |
+using device::BluetoothDevice; |
+using device::BluetoothDiscoverySession; |
+using device::BluetoothUUID; |
+using device::MockBluetoothAdapter; |
+using device::MockBluetoothDevice; |
+using device::MockBluetoothDiscoverySession; |
+ |
+class LayoutTestBluetoothAdapterProvider { |
scheib
2015/05/11 20:19:26
Class comment, along the lines of:
Implements fake
ortuno
2015/05/12 19:33:20
Done.
|
+ public: |
+ LayoutTestBluetoothAdapterProvider(); |
+ ~LayoutTestBluetoothAdapterProvider(); |
+ void GetBluetoothAdapter( |
scheib
2015/05/11 20:19:26
Same comment as used in BrowserContext.
ortuno
2015/05/12 19:33:20
Done.
|
+ const base::Callback< |
+ void(scoped_refptr<device::BluetoothAdapter> adapter)>& callback, |
+ const std::string& adapter); |
+ |
+ protected: |
+ scoped_ptr<testing::NiceMock<MockBluetoothDevice>> empty_device_; |
+ |
+ private: |
scheib
2015/05/12 01:16:28
We can leave everything in protected, move the dat
ortuno
2015/05/12 19:33:20
Done.
|
+ /* |
scheib
2015/05/11 20:19:26
Use // comment style for consistency. Though /* */
scheib
2015/05/12 01:16:28
Lead these comment blocks with the fake_adapter_na
ortuno
2015/05/12 19:33:20
Done.
|
+ Calls |callback| with a BluetoothAdapter with the following |
+ characteristics: |
+ - |StartDiscoverySession| invokes |SuccessfulDiscoverySession| |
scheib
2015/05/11 20:19:26
Add periods to all sentence fragments comments in
ortuno
2015/05/12 19:33:20
Done.
|
+ - |GetDevices| returns an empty list of devices |
+ */ |
+ void GetEmptyAdapter( |
+ const BluetoothAdapterFactory::AdapterCallback& callback); |
+ /* |
+ Calls |callback| with a BluetoothAdapter with the following |
+ characteristics: |
+ - |StartDiscoverySession| invokes |SuccessfulDiscoverySessionCallback| |
+ - |GetDevices| returns an list with an |Empty Device| |
scheib
2015/05/11 20:19:26
"returns a list".
scheib
2015/05/12 01:16:28
In the fake adapter names you've gone with a Camel
ortuno
2015/05/12 19:33:20
Done.
|
+ */ |
+ void GetSingleEmptyDeviceAdapter( |
+ const BluetoothAdapterFactory::AdapterCallback& callback); |
+ |
+ /* |
+ Calls |callback| with a DiscoverySession with the following |
+ characteristics: |
+ - |Stop| will invoke |SuccessfulStopDiscoverySession| |
+ */ |
+ void SuccessfulDiscoverySessionCallback( |
scheib
2015/05/12 01:16:28
How about just "SuccessfulDiscoverySession".
ortuno
2015/05/12 19:33:20
Done.
|
+ const BluetoothAdapter::DiscoverySessionCallback& callback, |
+ const BluetoothAdapter::ErrorCallback& error_callback); |
+ |
+ // Calls |callback| |
scheib
2015/05/12 01:16:28
Just merge this method up to be covered by previou
ortuno
2015/05/12 19:33:20
Done.
|
+ static void SuccessfulStopDiscoverySessionCallback( |
+ const base::Closure& callback, |
+ const base::Closure& error_callback); |
+ /* |
+ Sets up an |Empty Device| with the following characeteristics: |
+ - |GetAddress| returns "Empty Mock Device instanceID" |
+ - |GetName| returns "Empty Mock Device name" |
+ - |GetBluetoothClass| returns |kUnspecifiedDeviceClass| |
+ - |GetVendorIDSource| returns |BluetoothDevice::VENDOR_ID_BLUETOOTH| |
+ - |GetVendorID| returns |0xFFFF| |
+ - |GetProductID| returns 1 |
+ - |GetDeviceID| returns 2 |
+ - |IsPaired| returns true |
+ - |GetUUIDs| returns a list with two UUIDs: |uuid1| and |uuid2| |
scheib
2015/05/11 20:19:26
I like these method docs. At some point we'll move
ortuno
2015/05/12 19:33:20
Moved everything inline since we aren't using anyt
|
+ */ |
+ void SetUpMockEmptyDevice(MockBluetoothAdapter* adapter); |
scheib
2015/05/11 20:19:26
Everything is a mock in this class, and 'Setup' is
ortuno
2015/05/12 19:33:20
Done.
|
+ scoped_ptr<BluetoothUUID> uuid1; |
scheib
2015/05/11 20:19:26
FYI Naming style of members has an underscore suff
ortuno
2015/05/12 19:33:20
Done.
|
+ scoped_ptr<BluetoothUUID> uuid2; |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVIDER_H_ |