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

Side by Side Diff: chrome/browser/policy/policy_startup_browsertest.cc

Issue 1940153002: Use std::unique_ptr to express ownership of base::Value in PolicyMap::Entry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another-fix Created 4 years, 7 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 unified diff | Download patch
OLDNEW
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 "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h"
10 #include "chrome/common/chrome_result_codes.h" 11 #include "chrome/common/chrome_result_codes.h"
11 #include "chrome/common/chrome_switches.h" 12 #include "chrome/common/chrome_switches.h"
12 #include "chrome/test/base/in_process_browser_test.h" 13 #include "chrome/test/base/in_process_browser_test.h"
13 #include "components/policy/core/browser/browser_policy_connector.h" 14 #include "components/policy/core/browser/browser_policy_connector.h"
14 #include "components/policy/core/common/mock_configuration_policy_provider.h" 15 #include "components/policy/core/common/mock_configuration_policy_provider.h"
15 #include "components/policy/core/common/policy_map.h" 16 #include "components/policy/core/common/policy_map.h"
16 #include "components/policy/core/common/policy_types.h" 17 #include "components/policy/core/common/policy_types.h"
17 #include "policy/policy_constants.h" 18 #include "policy/policy_constants.h"
18 19
19 class PolicyMakeDefaultBrowserTest : public InProcessBrowserTest { 20 class PolicyMakeDefaultBrowserTest : public InProcessBrowserTest {
20 protected: 21 protected:
21 PolicyMakeDefaultBrowserTest() : InProcessBrowserTest() { 22 PolicyMakeDefaultBrowserTest() : InProcessBrowserTest() {
22 set_expected_exit_code(chrome::RESULT_CODE_ACTION_DISALLOWED_BY_POLICY); 23 set_expected_exit_code(chrome::RESULT_CODE_ACTION_DISALLOWED_BY_POLICY);
23 } 24 }
24 25
25 void SetUpInProcessBrowserTestFixture() override { 26 void SetUpInProcessBrowserTestFixture() override {
26 base::CommandLine::ForCurrentProcess()->AppendSwitch( 27 base::CommandLine::ForCurrentProcess()->AppendSwitch(
27 switches::kMakeDefaultBrowser); 28 switches::kMakeDefaultBrowser);
28 EXPECT_CALL(provider_, IsInitializationComplete(testing::_)) 29 EXPECT_CALL(provider_, IsInitializationComplete(testing::_))
29 .WillRepeatedly(testing::Return(true)); 30 .WillRepeatedly(testing::Return(true));
30 31
31 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); 32 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_);
32 33
33 policy::PolicyMap values; 34 policy::PolicyMap values;
34 values.Set(policy::key::kDefaultBrowserSettingEnabled, 35 values.Set(policy::key::kDefaultBrowserSettingEnabled,
35 policy::POLICY_LEVEL_MANDATORY, 36 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_MACHINE,
36 policy::POLICY_SCOPE_MACHINE,
37 policy::POLICY_SOURCE_CLOUD, 37 policy::POLICY_SOURCE_CLOUD,
38 new base::FundamentalValue(false), 38 base::WrapUnique(new base::FundamentalValue(false)), nullptr);
39 NULL);
40 provider_.UpdateChromePolicy(values); 39 provider_.UpdateChromePolicy(values);
41 } 40 }
42 41
43 private: 42 private:
44 policy::MockConfigurationPolicyProvider provider_; 43 policy::MockConfigurationPolicyProvider provider_;
45 DISALLOW_COPY_AND_ASSIGN(PolicyMakeDefaultBrowserTest); 44 DISALLOW_COPY_AND_ASSIGN(PolicyMakeDefaultBrowserTest);
46 }; 45 };
47 46
48 IN_PROC_BROWSER_TEST_F(PolicyMakeDefaultBrowserTest, MakeDefaultDisabled) { 47 IN_PROC_BROWSER_TEST_F(PolicyMakeDefaultBrowserTest, MakeDefaultDisabled) {
49 } 48 }
OLDNEW
« no previous file with comments | « chrome/browser/policy/policy_prefs_browsertest.cc ('k') | chrome/browser/policy/profile_policy_connector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698