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

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

Issue 431493003: Implement policy for kNetworkPredictionOptions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and increment policy id yet again. Created 6 years, 5 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
« no previous file with comments | « chrome/browser/policy/network_prediction_policy_handler.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/policy_browsertest.cc
diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc
index f1fd484be2391a74542ffde0e38acc483d176668..bc4bc930ab5133bc9c2839738c26540fa5a3e2e8 100644
--- a/chrome/browser/policy/policy_browsertest.cc
+++ b/chrome/browser/policy/policy_browsertest.cc
@@ -43,6 +43,7 @@
#include "chrome/browser/media/media_capture_devices_dispatcher.h"
#include "chrome/browser/media/media_stream_devices_controller.h"
#include "chrome/browser/metrics/variations/variations_service.h"
+#include "chrome/browser/net/prediction_options.h"
#include "chrome/browser/net/url_request_mock_util.h"
#include "chrome/browser/plugins/plugin_prefs.h"
#include "chrome/browser/policy/cloud/test_request_interceptor.h"
@@ -376,6 +377,10 @@ bool IsJavascriptEnabled(content::WebContents* contents) {
return result == 123;
}
+bool IsNetworkPredictionEnabled(PrefService* prefs) {
+ return chrome_browser_net::CanPredictNetworkActionsUI(prefs);
+}
+
void CopyPluginListAndQuit(std::vector<content::WebPluginInfo>* out,
const std::vector<content::WebPluginInfo>& in) {
*out = in;
@@ -1921,6 +1926,35 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, Javascript) {
EXPECT_TRUE(IsJavascriptEnabled(contents));
}
+IN_PROC_BROWSER_TEST_F(PolicyTest, NetworkPrediction) {
+ PrefService* prefs = browser()->profile()->GetPrefs();
+
+ // Enabled by default.
+ EXPECT_TRUE(IsNetworkPredictionEnabled(prefs));
+
+ // Disable by old, deprecated policy.
+ PolicyMap policies;
+ policies.Set(key::kDnsPrefetchingEnabled,
+ POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_USER,
+ new base::FundamentalValue(false),
+ NULL);
+ UpdateProviderPolicy(policies);
+
+ EXPECT_FALSE(IsNetworkPredictionEnabled(prefs));
+
+ // Enabled by new policy, this should override old one.
+ policies.Set(
+ key::kNetworkPredictionOptions,
+ POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_USER,
+ new base::FundamentalValue(chrome_browser_net::NETWORK_PREDICTION_ALWAYS),
+ NULL);
+ UpdateProviderPolicy(policies);
+
+ EXPECT_TRUE(IsNetworkPredictionEnabled(prefs));
+}
+
IN_PROC_BROWSER_TEST_F(PolicyTest, SavingBrowserHistoryDisabled) {
// Verifies that browsing history is not saved.
PolicyMap policies;
« no previous file with comments | « chrome/browser/policy/network_prediction_policy_handler.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698