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

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

Issue 13831007: BrowserTest for VariationsRestrictParameter user policy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed unnecessary lines Created 7 years, 8 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 | « no previous file | no next file » | 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 c3f484f616e4880088217354e084c3a4353bc177..4f3c8ad0ef8f9772590f0b15f5d21bb7b1adbc9e 100644
--- a/chrome/browser/policy/policy_browsertest.cc
+++ b/chrome/browser/policy/policy_browsertest.cc
@@ -34,6 +34,7 @@
#include "chrome/browser/infobars/infobar_service.h"
#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/url_request_mock_util.h"
#include "chrome/browser/plugins/plugin_prefs.h"
#include "chrome/browser/policy/browser_policy_connector.h"
@@ -2055,4 +2056,33 @@ INSTANTIATE_TEST_CASE_P(MediaStreamDevicesControllerBrowserTestInstance,
MediaStreamDevicesControllerBrowserTest,
testing::Bool());
+#if !defined(OS_CHROMEOS)
+// Similar to PolicyTest but sets the proper policy before the browser is
+// started.
+class PolicyVariationsServiceTest : public PolicyTest {
+ public:
+ virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
+ PolicyTest::SetUpInProcessBrowserTestFixture();
+ PolicyMap policies;
+ policies.Set(
+ key::kVariationsRestrictParameter,
+ POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_USER,
+ base::Value::CreateStringValue("restricted"));
+ provider_.UpdateChromePolicy(policies);
+ }
+};
+
+IN_PROC_BROWSER_TEST_F(PolicyVariationsServiceTest, VariationsURLIsValid) {
+ const std::string default_variations_url =
+ chrome_variations::VariationsService::
+ GetDefaultVariationsServerURLForTesting();
+
+ // Policy is applied and pref is already updated in local state.
+ EXPECT_EQ(default_variations_url + "?restrict=restricted",
+ chrome_variations::VariationsService::GetVariationsServerURL(
+ g_browser_process->local_state()).spec());
+}
+#endif
+
} // namespace policy
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698