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

Unified Diff: chrome/browser/policy/policy_browsertest.cc

Issue 1706503002: Add enterprise policy to turn off Bluetooth. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Release the BrowserMessageFilter::Internal once it has attached the Sender. Created 4 years, 10 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: chrome/browser/policy/policy_browsertest.cc
diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc
index 6817c64effadeedef78139e1ed77c65f9fed9c6f..ecbe50ec55baf8da1ff7410fad5d681f7696bf2e 100644
--- a/chrome/browser/policy/policy_browsertest.cc
+++ b/chrome/browser/policy/policy_browsertest.cc
@@ -36,6 +36,7 @@
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/background/background_contents_service.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/chrome_content_browser_client.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/content_settings/tab_specific_content_settings.h"
#include "chrome/browser/devtools/devtools_window_testing.h"
@@ -3654,6 +3655,21 @@ INSTANTIATE_TEST_CASE_P(MediaStreamDevicesControllerBrowserTestInstance,
MediaStreamDevicesControllerBrowserTest,
testing::Bool());
+IN_PROC_BROWSER_TEST_F(PolicyTest, BlockWebBluetooth) {
+ ChromeContentBrowserClient client;
+ EXPECT_TRUE(client.AllowWebBluetooth());
+
+ PolicyMap policies;
+ policies.Set(key::kDefaultWebBluetoothGuardSetting, POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
+ new base::FundamentalValue(2), nullptr);
+ UpdateProviderPolicy(policies);
+
+ // See BluetoothDispatcherHostTest.ContentClientCanDisableAPI for evidence
bartfab (slow) 2016/02/25 17:37:50 We try hard to make our browser tests be truly end
Jeffrey Yasskin 2016/02/25 20:38:50 It turns out to be really hard. To run a bluetooth
Jeffrey Yasskin 2016/02/25 22:34:49 Gio pointed out the device::BluetoothAdapterFactor
bartfab (slow) 2016/02/26 18:00:44 Thanks for that. Looks great!
+ // that this actually prevents Web Bluetooth from working.
+ EXPECT_FALSE(client.AllowWebBluetooth());
+}
+
// Test that when extended reporting opt-in is disabled by policy, the
// opt-in checkbox does not appear on SSL blocking pages.
IN_PROC_BROWSER_TEST_F(PolicyTest, SafeBrowsingExtendedReportingOptInAllowed) {

Powered by Google App Engine
This is Rietveld 408576698