Index: chrome/browser/policy/policy_startup_browsertest.cc |
diff --git a/chrome/browser/policy/policy_startup_browsertest.cc b/chrome/browser/policy/policy_startup_browsertest.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..bf429d33f8b0ac6125c4046b95bc3cec18bdaca7 |
--- /dev/null |
+++ b/chrome/browser/policy/policy_startup_browsertest.cc |
@@ -0,0 +1,46 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+// Warning: this file will not be compiled for ChromeOS because the test |
+// PolicyMakeDefaultBrowserTest is not valid for this platform. |
+ |
+#include "base/command_line.h" |
+#include "chrome/common/chrome_result_codes.h" |
+#include "chrome/common/chrome_switches.h" |
+#include "chrome/test/base/in_process_browser_test.h" |
+#include "components/policy/core/browser/browser_policy_connector.h" |
+#include "components/policy/core/common/mock_configuration_policy_provider.h" |
+#include "components/policy/core/common/policy_map.h" |
+#include "policy/policy_constants.h" |
+ |
+class PolicyMakeDefaultBrowserTest : public InProcessBrowserTest { |
+ protected: |
+ PolicyMakeDefaultBrowserTest() : InProcessBrowserTest() { |
+ set_expected_exit_code(chrome::RESULT_CODE_ACTION_DISALLOWED_BY_POLICY); |
+ } |
+ |
+ void SetUpInProcessBrowserTestFixture() override { |
+ base::CommandLine::ForCurrentProcess()->AppendSwitch( |
+ switches::kMakeDefaultBrowser); |
+ EXPECT_CALL(provider_, IsInitializationComplete(testing::_)) |
+ .WillRepeatedly(testing::Return(true)); |
+ |
+ policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); |
+ |
+ policy::PolicyMap values; |
+ values.Set(policy::key::kDefaultBrowserSettingEnabled, |
+ policy::POLICY_LEVEL_MANDATORY, |
+ policy::POLICY_SCOPE_MACHINE, |
+ new base::FundamentalValue(false), |
+ NULL); |
+ provider_.UpdateChromePolicy(values); |
+ } |
+ |
+ private: |
+ policy::MockConfigurationPolicyProvider provider_; |
+ DISALLOW_COPY_AND_ASSIGN(PolicyMakeDefaultBrowserTest); |
+}; |
+ |
+IN_PROC_BROWSER_TEST_F(PolicyMakeDefaultBrowserTest, MakeDefaultDisabled) { |
+} |