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

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: Comments 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..25593bde431a8698188e200401bff0cb007fa840 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,36 @@ 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:
+ PolicyVariationsServiceTest() {}
+ virtual ~PolicyVariationsServiceTest() {}
Alexei Svitkine (slow) 2013/04/18 14:53:23 You don't need these two, since the class is defin
Mathieu 2013/04/18 14:56:39 Done.
+
+ 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());
Mattias Nissler (ping if slow) 2013/04/18 15:02:53 Ideally, you'd check the URL that the service uses
Mathieu 2013/04/18 15:16:25 In this case this function is directly setting the
+}
+#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