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

Unified Diff: content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc

Issue 2762023002: work in progress 2
Patch Set: Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc
diff --git a/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc b/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc
index 9dd447ef1fcd710ffbf8d06c2ded1b310e7f529d..017eeaa856a48ba22274a648644263251e64dc11 100644
--- a/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc
+++ b/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc
@@ -279,6 +279,9 @@ LayoutTestBluetoothAdapterProvider::GetBluetoothAdapter(
return GetDevicesRemovedAdapter();
if (fake_adapter_name == "DelayedServicesDiscoveryAdapter")
return GetDelayedServicesDiscoveryAdapter();
+// DJKim
+ if (fake_adapter_name == "StopDiscoveryAdapterDiscoveringChanged")
+ return GetStopDiscoveryAdapterDiscoveringChanged();
if (fake_adapter_name.empty())
return nullptr;
// New adapters that can be used when fuzzing the Web Bluetooth API
@@ -1736,6 +1739,29 @@ LayoutTestBluetoothAdapterProvider::GetErrorCharacteristic(
return characteristic;
}
+// static
+scoped_refptr<NiceMockBluetoothAdapter>
+LayoutTestBluetoothAdapterProvider::GetStopDiscoveryAdapterDiscoveringChanged() {
+ scoped_refptr<NiceMockBluetoothAdapter> adapter(GetPoweredAdapter());
+ NiceMockBluetoothAdapter* adapter_ptr = adapter.get();
+
+ EXPECT_CALL(*adapter, StartDiscoverySessionWithFilterRaw(_, _, _))
+ .WillOnce(RunCallbackWithResult<1 /* success_callback */>(
+ []() { return GetDiscoverySession(); }))
+ .WillOnce(
+ RunCallbackWithResult<1 /* success_callback */>([adapter_ptr]() {
+ // In the second discovery session, have the adapter discover a new
+ // device, shortly after the session starts.
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE,
+ base::Bind(&AddDevice, make_scoped_refptr(adapter_ptr),
+ base::Passed(GetHeartRateDevice(adapter_ptr))));
+ return GetDiscoverySession();
+ }));
+
+ return adapter;
+}
+
// Notify sessions
// static
« no previous file with comments | « content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.h ('k') | device/bluetooth/bluetooth_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698