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

Side by Side Diff: chrome/browser/profiles/guest_mode_policy_handler_unittest.cc

Issue 2666093002: Remove base::FundamentalValue (Closed)
Patch Set: Rebase Created 3 years, 9 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "chrome/browser/profiles/guest_mode_policy_handler.h" 5 #include "chrome/browser/profiles/guest_mode_policy_handler.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/common/pref_names.h" 9 #include "chrome/common/pref_names.h"
10 #include "components/policy/core/common/policy_map.h" 10 #include "components/policy/core/common/policy_map.h"
11 #include "components/policy/policy_constants.h" 11 #include "components/policy/policy_constants.h"
12 #include "components/prefs/pref_value_map.h" 12 #include "components/prefs/pref_value_map.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 namespace policy { 15 namespace policy {
16 16
17 class GuestModePolicyHandlerTest : public ::testing::Test { 17 class GuestModePolicyHandlerTest : public ::testing::Test {
18 public: 18 public:
19 void SetUp() override { 19 void SetUp() override {
20 prefs_.Clear(); 20 prefs_.Clear();
21 policies_.Clear(); 21 policies_.Clear();
22 } 22 }
23 23
24 protected: 24 protected:
25 void SetUpPolicy(const char* policy_name, bool value) { 25 void SetUpPolicy(const char* policy_name, bool value) {
26 policies_.Set(policy_name, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, 26 policies_.Set(policy_name, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
27 POLICY_SOURCE_PLATFORM, 27 POLICY_SOURCE_PLATFORM, base::MakeUnique<base::Value>(value),
28 base::MakeUnique<base::FundamentalValue>(value), nullptr); 28 nullptr);
29 } 29 }
30 30
31 void SetUpPolicy(const char* policy_name, int value) { 31 void SetUpPolicy(const char* policy_name, int value) {
32 policies_.Set(policy_name, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, 32 policies_.Set(policy_name, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
33 POLICY_SOURCE_PLATFORM, 33 POLICY_SOURCE_PLATFORM, base::MakeUnique<base::Value>(value),
34 base::MakeUnique<base::FundamentalValue>(value), nullptr); 34 nullptr);
35 } 35 }
36 36
37 PolicyMap policies_; 37 PolicyMap policies_;
38 PrefValueMap prefs_; 38 PrefValueMap prefs_;
39 GuestModePolicyHandler handler_; 39 GuestModePolicyHandler handler_;
40 }; 40 };
41 41
42 TEST_F(GuestModePolicyHandlerTest, ForceSigninNotSet) { 42 TEST_F(GuestModePolicyHandlerTest, ForceSigninNotSet) {
43 handler_.ApplyPolicySettings(policies_, &prefs_); 43 handler_.ApplyPolicySettings(policies_, &prefs_);
44 EXPECT_FALSE(prefs_.GetValue(prefs::kBrowserGuestModeEnabled, nullptr)); 44 EXPECT_FALSE(prefs_.GetValue(prefs::kBrowserGuestModeEnabled, nullptr));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 EXPECT_TRUE(prefs_.GetBoolean(prefs::kBrowserGuestModeEnabled, &value)); 80 EXPECT_TRUE(prefs_.GetBoolean(prefs::kBrowserGuestModeEnabled, &value));
81 EXPECT_TRUE(value); 81 EXPECT_TRUE(value);
82 82
83 SetUpPolicy(key::kBrowserGuestModeEnabled, false); 83 SetUpPolicy(key::kBrowserGuestModeEnabled, false);
84 handler_.ApplyPolicySettings(policies_, &prefs_); 84 handler_.ApplyPolicySettings(policies_, &prefs_);
85 EXPECT_TRUE(prefs_.GetBoolean(prefs::kBrowserGuestModeEnabled, &value)); 85 EXPECT_TRUE(prefs_.GetBoolean(prefs::kBrowserGuestModeEnabled, &value));
86 EXPECT_FALSE(value); 86 EXPECT_FALSE(value);
87 } 87 }
88 88
89 } // namespace policy 89 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698