Chromium Code Reviews| 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 |