OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #include "chrome/browser/chromeos/policy/device_policy_builder.h" |
| 6 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" |
| 7 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" |
| 8 #include "chrome/browser/metrics/variations/variations_service.h" |
| 9 #include "chrome/test/base/testing_browser_process.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 |
| 12 namespace policy { |
| 13 |
| 14 class VariationsServiceDevicePolicyTest : public DevicePolicyCrosBrowserTest { |
| 15 protected: |
| 16 VariationsServiceDevicePolicyTest() {} |
| 17 |
| 18 void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 19 DevicePolicyCrosBrowserTest::SetUpInProcessBrowserTestFixture(); |
| 20 |
| 21 InstallOwnerKey(); |
| 22 SetSpecificDevicePolicies(); |
| 23 RefreshDevicePolicy(); |
| 24 } |
| 25 |
| 26 void SetSpecificDevicePolicies() { |
| 27 // Setup the device policy DeviceVariationsRestrictParameter. |
| 28 enterprise_management::ChromeDeviceSettingsProto& proto( |
| 29 device_policy()->payload()); |
| 30 proto.mutable_variations_parameter()->set_parameter("restricted"); |
| 31 } |
| 32 |
| 33 private: |
| 34 DISALLOW_COPY_AND_ASSIGN(VariationsServiceDevicePolicyTest); |
| 35 }; |
| 36 |
| 37 IN_PROC_BROWSER_TEST_F(VariationsServiceDevicePolicyTest, VariationsURLValid) { |
| 38 const std::string default_variations_url = |
| 39 chrome_variations::VariationsService:: |
| 40 GetDefaultVariationsServerURLForTesting(); |
| 41 |
| 42 // Device policy has updated the cros settings. |
| 43 EXPECT_EQ(default_variations_url + "?restrict=restricted", |
| 44 chrome_variations::VariationsService::GetVariationsServerURL( |
| 45 TestingBrowserProcess::GetGlobal()->local_state()).spec()); |
| 46 } |
| 47 |
| 48 } // namespace policy |
OLD | NEW |