OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Warning: this file will not be compiled for ChromeOS because the test | 5 // Warning: this file will not be compiled for ChromeOS because the test |
6 // PolicyMakeDefaultBrowserTest is not valid for this platform. | 6 // PolicyMakeDefaultBrowserTest is not valid for this platform. |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "chrome/common/chrome_result_codes.h" | 9 #include "chrome/common/chrome_result_codes.h" |
10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
11 #include "chrome/test/base/in_process_browser_test.h" | 11 #include "chrome/test/base/in_process_browser_test.h" |
12 #include "components/policy/core/browser/browser_policy_connector.h" | 12 #include "components/policy/core/browser/browser_policy_connector.h" |
13 #include "components/policy/core/common/mock_configuration_policy_provider.h" | 13 #include "components/policy/core/common/mock_configuration_policy_provider.h" |
14 #include "components/policy/core/common/policy_map.h" | 14 #include "components/policy/core/common/policy_map.h" |
15 #include "components/policy/core/common/policy_types.h" | |
16 #include "policy/policy_constants.h" | 15 #include "policy/policy_constants.h" |
17 | 16 |
18 class PolicyMakeDefaultBrowserTest : public InProcessBrowserTest { | 17 class PolicyMakeDefaultBrowserTest : public InProcessBrowserTest { |
19 protected: | 18 protected: |
20 PolicyMakeDefaultBrowserTest() : InProcessBrowserTest() { | 19 PolicyMakeDefaultBrowserTest() : InProcessBrowserTest() { |
21 set_expected_exit_code(chrome::RESULT_CODE_ACTION_DISALLOWED_BY_POLICY); | 20 set_expected_exit_code(chrome::RESULT_CODE_ACTION_DISALLOWED_BY_POLICY); |
22 } | 21 } |
23 | 22 |
24 void SetUpInProcessBrowserTestFixture() override { | 23 void SetUpInProcessBrowserTestFixture() override { |
25 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 24 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
26 switches::kMakeDefaultBrowser); | 25 switches::kMakeDefaultBrowser); |
27 EXPECT_CALL(provider_, IsInitializationComplete(testing::_)) | 26 EXPECT_CALL(provider_, IsInitializationComplete(testing::_)) |
28 .WillRepeatedly(testing::Return(true)); | 27 .WillRepeatedly(testing::Return(true)); |
29 | 28 |
30 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); | 29 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); |
31 | 30 |
32 policy::PolicyMap values; | 31 policy::PolicyMap values; |
33 values.Set(policy::key::kDefaultBrowserSettingEnabled, | 32 values.Set(policy::key::kDefaultBrowserSettingEnabled, |
34 policy::POLICY_LEVEL_MANDATORY, | 33 policy::POLICY_LEVEL_MANDATORY, |
35 policy::POLICY_SCOPE_MACHINE, | 34 policy::POLICY_SCOPE_MACHINE, |
36 policy::POLICY_SOURCE_CLOUD, | |
37 new base::FundamentalValue(false), | 35 new base::FundamentalValue(false), |
38 NULL); | 36 NULL); |
39 provider_.UpdateChromePolicy(values); | 37 provider_.UpdateChromePolicy(values); |
40 } | 38 } |
41 | 39 |
42 private: | 40 private: |
43 policy::MockConfigurationPolicyProvider provider_; | 41 policy::MockConfigurationPolicyProvider provider_; |
44 DISALLOW_COPY_AND_ASSIGN(PolicyMakeDefaultBrowserTest); | 42 DISALLOW_COPY_AND_ASSIGN(PolicyMakeDefaultBrowserTest); |
45 }; | 43 }; |
46 | 44 |
47 IN_PROC_BROWSER_TEST_F(PolicyMakeDefaultBrowserTest, MakeDefaultDisabled) { | 45 IN_PROC_BROWSER_TEST_F(PolicyMakeDefaultBrowserTest, MakeDefaultDisabled) { |
48 } | 46 } |
OLD | NEW |