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

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

Issue 2059513003: Add a policy for disabling the stripping of PAC URLs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 6 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 05339894a2d65e2b7d57c3f55e08a567b9d38f7c..e0a7d4551c5c4be59ec1af92526712c5d25f3f22 100644
--- a/chrome/browser/policy/policy_browsertest.cc
+++ b/chrome/browser/policy/policy_browsertest.cc
@@ -54,6 +54,7 @@
#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/interstitials/security_interstitial_page.h"
#include "chrome/browser/interstitials/security_interstitial_page_test_utils.h"
+#include "chrome/browser/io_thread.h"
#include "chrome/browser/media/media_capture_devices_dispatcher.h"
#include "chrome/browser/media/media_stream_devices_controller.h"
#include "chrome/browser/media/router/media_router_feature.h"
@@ -1353,6 +1354,48 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, DisableSpdy) {
EXPECT_TRUE(net::HttpStreamFactory::spdy_enabled());
}
+namespace {
+
+// The following helpers retrieve whether https:// URL stripping is
+// enabled for PAC scripts. It needs to run on the IO thread.
+void GetPacHttpsUrlStrippingEnabledOnIOThread(IOThread* io_thread,
+ bool* enabled) {
+ *enabled = io_thread->PacHttpsUrlStrippingEnabled();
+}
+
+bool GetPacHttpsUrlStrippingEnabled() {
+ bool enabled;
+ base::RunLoop loop;
+ BrowserThread::PostTaskAndReply(
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(&GetPacHttpsUrlStrippingEnabledOnIOThread,
+ g_browser_process->io_thread(), base::Unretained(&enabled)),
+ loop.QuitClosure());
+ loop.Run();
+ return enabled;
+}
+
+} // namespace
+
+// Verifies that stripping of https:// URLs before sending to PAC scripts can
+// be disabled via a policy. Also verifies that stripping is enabled by
+// default.
+IN_PROC_BROWSER_TEST_F(PolicyTest, DisablePacHttpsUrlStripping) {
+ // Stripping is enabled by default.
+ EXPECT_TRUE(GetPacHttpsUrlStrippingEnabled());
+
+ // Disable it via a policy.
+ PolicyMap policies;
+ policies.Set(key::kPacHttpsUrlStrippingEnabled, POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
+ base::WrapUnique(new base::FundamentalValue(false)), nullptr);
+ UpdateProviderPolicy(policies);
+ content::RunAllPendingInMessageLoop();
+
+ // It should now reflect as disabled.
+ EXPECT_FALSE(GetPacHttpsUrlStrippingEnabled());
+}
+
IN_PROC_BROWSER_TEST_F(PolicyTest, DisabledPlugins) {
// Verifies that plugins can be forced to be disabled by policy.
« no previous file with comments | « chrome/browser/policy/configuration_policy_handler_list_factory.cc ('k') | chrome/browser/prefs/command_line_pref_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698