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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 18 matching lines...) Expand all
29 #include "base/strings/stringprintf.h" 29 #include "base/strings/stringprintf.h"
30 #include "base/strings/utf_string_conversions.h" 30 #include "base/strings/utf_string_conversions.h"
31 #include "base/test/test_file_util.h" 31 #include "base/test/test_file_util.h"
32 #include "base/threading/sequenced_worker_pool.h" 32 #include "base/threading/sequenced_worker_pool.h"
33 #include "base/time/time.h" 33 #include "base/time/time.h"
34 #include "base/values.h" 34 #include "base/values.h"
35 #include "build/build_config.h" 35 #include "build/build_config.h"
36 #include "chrome/app/chrome_command_ids.h" 36 #include "chrome/app/chrome_command_ids.h"
37 #include "chrome/browser/background/background_contents_service.h" 37 #include "chrome/browser/background/background_contents_service.h"
38 #include "chrome/browser/browser_process.h" 38 #include "chrome/browser/browser_process.h"
39 #include "chrome/browser/chrome_content_browser_client.h"
39 #include "chrome/browser/chrome_notification_types.h" 40 #include "chrome/browser/chrome_notification_types.h"
40 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 41 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
41 #include "chrome/browser/devtools/devtools_window_testing.h" 42 #include "chrome/browser/devtools/devtools_window_testing.h"
42 #include "chrome/browser/download/download_prefs.h" 43 #include "chrome/browser/download/download_prefs.h"
43 #include "chrome/browser/extensions/api/messaging/message_service.h" 44 #include "chrome/browser/extensions/api/messaging/message_service.h"
44 #include "chrome/browser/extensions/crx_installer.h" 45 #include "chrome/browser/extensions/crx_installer.h"
45 #include "chrome/browser/extensions/extension_management_constants.h" 46 #include "chrome/browser/extensions/extension_management_constants.h"
46 #include "chrome/browser/extensions/extension_management_test_util.h" 47 #include "chrome/browser/extensions/extension_management_test_util.h"
47 #include "chrome/browser/extensions/extension_service.h" 48 #include "chrome/browser/extensions/extension_service.h"
48 #include "chrome/browser/extensions/shared_module_service.h" 49 #include "chrome/browser/extensions/shared_module_service.h"
(...skipping 3598 matching lines...) Expand 10 before | Expand all | Expand 10 after
3647 this)); 3648 this));
3648 3649
3649 base::MessageLoop::current()->Run(); 3650 base::MessageLoop::current()->Run();
3650 } 3651 }
3651 } 3652 }
3652 3653
3653 INSTANTIATE_TEST_CASE_P(MediaStreamDevicesControllerBrowserTestInstance, 3654 INSTANTIATE_TEST_CASE_P(MediaStreamDevicesControllerBrowserTestInstance,
3654 MediaStreamDevicesControllerBrowserTest, 3655 MediaStreamDevicesControllerBrowserTest,
3655 testing::Bool()); 3656 testing::Bool());
3656 3657
3658 IN_PROC_BROWSER_TEST_F(PolicyTest, BlockWebBluetooth) {
3659 ChromeContentBrowserClient client;
3660 EXPECT_TRUE(client.AllowWebBluetooth());
3661
3662 PolicyMap policies;
3663 policies.Set(key::kDefaultWebBluetoothGuardSetting, POLICY_LEVEL_MANDATORY,
3664 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
3665 new base::FundamentalValue(2), nullptr);
3666 UpdateProviderPolicy(policies);
3667
3668 // 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!
3669 // that this actually prevents Web Bluetooth from working.
3670 EXPECT_FALSE(client.AllowWebBluetooth());
3671 }
3672
3657 // Test that when extended reporting opt-in is disabled by policy, the 3673 // Test that when extended reporting opt-in is disabled by policy, the
3658 // opt-in checkbox does not appear on SSL blocking pages. 3674 // opt-in checkbox does not appear on SSL blocking pages.
3659 IN_PROC_BROWSER_TEST_F(PolicyTest, SafeBrowsingExtendedReportingOptInAllowed) { 3675 IN_PROC_BROWSER_TEST_F(PolicyTest, SafeBrowsingExtendedReportingOptInAllowed) {
3660 net::EmbeddedTestServer https_server_expired( 3676 net::EmbeddedTestServer https_server_expired(
3661 net::EmbeddedTestServer::TYPE_HTTPS); 3677 net::EmbeddedTestServer::TYPE_HTTPS);
3662 https_server_expired.SetSSLConfig(net::EmbeddedTestServer::CERT_EXPIRED); 3678 https_server_expired.SetSSLConfig(net::EmbeddedTestServer::CERT_EXPIRED);
3663 https_server_expired.ServeFilesFromSourceDirectory("chrome/test/data"); 3679 https_server_expired.ServeFilesFromSourceDirectory("chrome/test/data");
3664 ASSERT_TRUE(https_server_expired.Start()); 3680 ASSERT_TRUE(https_server_expired.Start());
3665 3681
3666 // Set the enterprise policy to disallow opt-in. 3682 // Set the enterprise policy to disallow opt-in.
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
3938 POLICY_SCOPE_USER, 3954 POLICY_SCOPE_USER,
3939 POLICY_SOURCE_CLOUD, 3955 POLICY_SOURCE_CLOUD,
3940 new base::FundamentalValue(false), 3956 new base::FundamentalValue(false),
3941 NULL); 3957 NULL);
3942 UpdateProviderPolicy(policies); 3958 UpdateProviderPolicy(policies);
3943 EXPECT_FALSE(display_manager->unified_desktop_enabled()); 3959 EXPECT_FALSE(display_manager->unified_desktop_enabled());
3944 } 3960 }
3945 #endif // defined(OS_CHROMEOS) 3961 #endif // defined(OS_CHROMEOS)
3946 3962
3947 } // namespace policy 3963 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698