Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / chromeos / policy / variations_service_policy_browsertest.cc
blob80503936aa982ac8dafb669f63bcaa5661706947
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/strings/string_util.h"
6 #include "chrome/browser/chromeos/policy/device_policy_builder.h"
7 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h"
8 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h"
9 #include "chrome/browser/metrics/variations/variations_service.h"
10 #include "chrome/test/base/testing_browser_process.h"
11 #include "net/base/url_util.h"
12 #include "testing/gtest/include/gtest/gtest.h"
14 namespace policy {
16 class VariationsServiceDevicePolicyTest : public DevicePolicyCrosBrowserTest {
17 protected:
18 VariationsServiceDevicePolicyTest() {}
20 void SetUpInProcessBrowserTestFixture() override {
21 DevicePolicyCrosBrowserTest::SetUpInProcessBrowserTestFixture();
23 InstallOwnerKey();
24 SetSpecificDevicePolicies();
25 RefreshDevicePolicy();
28 void SetSpecificDevicePolicies() {
29 // Setup the device policy DeviceVariationsRestrictParameter.
30 enterprise_management::ChromeDeviceSettingsProto& proto(
31 device_policy()->payload());
32 proto.mutable_variations_parameter()->set_parameter("restricted");
35 private:
36 DISALLOW_COPY_AND_ASSIGN(VariationsServiceDevicePolicyTest);
39 IN_PROC_BROWSER_TEST_F(VariationsServiceDevicePolicyTest, VariationsURLValid) {
40 const std::string default_variations_url =
41 chrome_variations::VariationsService::
42 GetDefaultVariationsServerURLForTesting();
44 // Device policy has updated the cros settings.
45 const GURL url = chrome_variations::VariationsService::GetVariationsServerURL(
46 g_browser_process->local_state(), std::string());
47 EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true));
48 std::string value;
49 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value));
50 EXPECT_EQ("restricted", value);
53 } // namespace policy