Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Unified Diff: chrome/browser/policy/policy_startup_browsertest.cc

Issue 927163002: Now command line flag does not beat Policy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed test for chromeos and rebase Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chrome_browser_main.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
+}
« no previous file with comments | « chrome/browser/chrome_browser_main.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698