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

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

Issue 1264323002: bluetooth: Return specific message if Bluetooth Adapter is off (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-web-bluetooth-action
Patch Set: Add issue to TODO Created 5 years, 4 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 4b185a55e5462aa9cf67b6802c5f51c352a77f12..61fcc0ccdfd04a6be3b1c96a6838f2d295ba8ff2 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
@@ -100,6 +100,10 @@ LayoutTestBluetoothAdapterProvider::GetBluetoothAdapter(
const std::string& fake_adapter_name) {
if (fake_adapter_name == "BaseAdapter")
return GetBaseAdapter();
+ else if (fake_adapter_name == "NotPresentAdapter")
+ return GetNotPresentAdapter();
+ else if (fake_adapter_name == "NotPoweredAdapter")
+ return GetNotPoweredAdapter();
else if (fake_adapter_name == "ScanFilterCheckingAdapter")
return GetScanFilterCheckingAdapter();
else if (fake_adapter_name == "EmptyAdapter")
@@ -149,8 +153,44 @@ LayoutTestBluetoothAdapterProvider::GetBaseAdapter() {
// static
scoped_refptr<NiceMockBluetoothAdapter>
-LayoutTestBluetoothAdapterProvider::GetScanFilterCheckingAdapter() {
+LayoutTestBluetoothAdapterProvider::GetPresentAdapter() {
+ scoped_refptr<NiceMockBluetoothAdapter> adapter(GetBaseAdapter());
+ ON_CALL(*adapter, IsPresent()).WillByDefault(Return(true));
+
+ return adapter.Pass();
+}
+
+// static
+scoped_refptr<NiceMockBluetoothAdapter>
+LayoutTestBluetoothAdapterProvider::GetNotPresentAdapter() {
scoped_refptr<NiceMockBluetoothAdapter> adapter(GetBaseAdapter());
+ ON_CALL(*adapter, IsPresent()).WillByDefault(Return(false));
+
+ return adapter.Pass();
+}
+
+// static
+scoped_refptr<NiceMockBluetoothAdapter>
+LayoutTestBluetoothAdapterProvider::GetPoweredAdapter() {
+ scoped_refptr<NiceMockBluetoothAdapter> adapter(GetPresentAdapter());
+ ON_CALL(*adapter, IsPowered()).WillByDefault(Return(true));
+
+ return adapter.Pass();
+}
+
+// static
+scoped_refptr<NiceMockBluetoothAdapter>
+LayoutTestBluetoothAdapterProvider::GetNotPoweredAdapter() {
+ scoped_refptr<NiceMockBluetoothAdapter> adapter(GetPresentAdapter());
+ ON_CALL(*adapter, IsPowered()).WillByDefault(Return(false));
+
+ return adapter.Pass();
+}
+
+// static
+scoped_refptr<NiceMockBluetoothAdapter>
+LayoutTestBluetoothAdapterProvider::GetScanFilterCheckingAdapter() {
+ scoped_refptr<NiceMockBluetoothAdapter> adapter(GetPoweredAdapter());
// This fails the test with an error message listing actual and expected UUIDs
// if StartDiscoverySessionWithFilter() is called with the wrong argument.
@@ -177,7 +217,7 @@ LayoutTestBluetoothAdapterProvider::GetScanFilterCheckingAdapter() {
// static
scoped_refptr<NiceMockBluetoothAdapter>
LayoutTestBluetoothAdapterProvider::GetFailStartDiscoveryAdapter() {
- scoped_refptr<NiceMockBluetoothAdapter> adapter(GetBaseAdapter());
+ scoped_refptr<NiceMockBluetoothAdapter> adapter(GetPoweredAdapter());
ON_CALL(*adapter, StartDiscoverySessionWithFilterRaw(_, _, _))
.WillByDefault(RunCallback<2 /* error_callback */>());
@@ -188,7 +228,7 @@ LayoutTestBluetoothAdapterProvider::GetFailStartDiscoveryAdapter() {
// static
scoped_refptr<NiceMockBluetoothAdapter>
LayoutTestBluetoothAdapterProvider::GetEmptyAdapter() {
- scoped_refptr<NiceMockBluetoothAdapter> adapter(GetBaseAdapter());
+ scoped_refptr<NiceMockBluetoothAdapter> adapter(GetPoweredAdapter());
ON_CALL(*adapter, StartDiscoverySessionWithFilterRaw(_, _, _))
.WillByDefault(RunCallbackWithResult<1 /* success_callback */>(
« no previous file with comments | « content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698