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 |
index a4f44645e48763bc52c9b206aa2fcaf02a5ca806..17ed0ab7ecd040309c3f7a940f47852997ba5765 100644 |
--- a/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.h |
+++ b/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.h |
@@ -9,6 +9,7 @@ |
#include "device/bluetooth/bluetooth_adapter_factory.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 { |
@@ -35,17 +36,11 @@ class LayoutTestBluetoothAdapterProvider { |
static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>> |
GetSingleEmptyDeviceAdapter(); |
- // Calls |callback| with a DiscoverySession with the following |
+ // Returns a fake DiscoverySession with the following |
// characteristics: |
- // - |Stop| will invoke |SuccessfulDiscoverySessionStop|. |
- static void SuccessfulDiscoverySession( |
- const device::BluetoothAdapter::DiscoverySessionCallback& callback, |
- const device::BluetoothAdapter::ErrorCallback& error_callback); |
- |
- // Calls |callback|. |
- static void SuccessfulDiscoverySessionStop( |
- const base::Closure& callback, |
- const base::Closure& error_callback); |
+ // - |Stop(callback, error_callback)| will run callback. |
+ static scoped_ptr<testing::NiceMock<device::MockBluetoothDiscoverySession>> |
+ GetDiscoverySession(); |
// Returns an |EmptyDevice| with the following characeteristics: |
// - |GetAddress| returns "Empty Mock Device instanceID". |
@@ -62,6 +57,22 @@ class LayoutTestBluetoothAdapterProvider { |
GetEmptyDevice(device::MockBluetoothAdapter* adapter); |
}; |
+// Invokes Run() on the k-th argument of the function with no arguments. |
+ACTION_TEMPLATE(RunCallback, |
Jeffrey Yasskin
2015/05/19 01:09:01
I'm nervous about defining something with such a g
ortuno
2015/05/19 01:51:54
Done.
|
+ HAS_1_TEMPLATE_PARAMS(int, k), |
+ AND_0_VALUE_PARAMS()) { |
+ return ::std::tr1::get<k>(args).Run(); |
+} |
+ |
+// Function for when the value passed to the callback needs to be a scoped_ptr. |
+// Invokes Run() on the k-th argument of the function with value wrapped in |
+// scoped_ptr<T> |
+ACTION_TEMPLATE(RunCallbackScoped, |
+ HAS_2_TEMPLATE_PARAMS(int, k, typename, T), |
+ AND_1_VALUE_PARAMS(value)) { |
+ return ::std::tr1::get<k>(args).Run(scoped_ptr<T>(value)); |
+} |
+ |
} // namespace content |
#endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_BLUETOOTH_ADAPTER_PROVIDER_H_ |