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/sessions/restore_on_startup_policy_handler_unittest.cc

Issue 2921903002: Remove handling of ClearSiteDataOnExit policy (Closed)
Patch Set: Remove unit test Created 3 years, 6 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
« no previous file with comments | « chrome/browser/sessions/restore_on_startup_policy_handler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/sessions/restore_on_startup_policy_handler.h" 5 #include "chrome/browser/sessions/restore_on_startup_policy_handler.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 SetPolicyValue(key::kRestoreOnStartup, 123 SetPolicyValue(key::kRestoreOnStartup,
124 base::MakeUnique<base::Value>(not_home_page)); 124 base::MakeUnique<base::Value>(not_home_page));
125 ApplyPolicySettings(); 125 ApplyPolicySettings();
126 // The resulting prefs should have the value we specified. 126 // The resulting prefs should have the value we specified.
127 int result; 127 int result;
128 EXPECT_TRUE(prefs().GetInteger(prefs::kRestoreOnStartup, &result)); 128 EXPECT_TRUE(prefs().GetInteger(prefs::kRestoreOnStartup, &result));
129 EXPECT_EQ(not_home_page, result); 129 EXPECT_EQ(not_home_page, result);
130 } 130 }
131 131
132 TEST_F(RestoreOnStartupPolicyHandlerTest, 132 TEST_F(RestoreOnStartupPolicyHandlerTest,
133 CheckPolicySettings_RestoreLastSession_ClearDataOnExit) {
134 // Specify the Last value and the Clear-Data-On-Exit value.
135 SetPolicyValue(
136 key::kRestoreOnStartup,
137 base::WrapUnique(new base::Value(SessionStartupPref::kPrefValueLast)));
138 SetPolicyValue(key::kClearSiteDataOnExit,
139 base::MakeUnique<base::Value>(true));
140 // Checking should succeed but add an error to the error map.
141 EXPECT_TRUE(CheckPolicySettings());
142 ASSERT_EQ(1U, errors().size());
143 EXPECT_EQ(key::kClearSiteDataOnExit, errors().begin()->first);
144 EXPECT_EQ(l10n_util::GetStringFUTF16(
145 IDS_POLICY_OVERRIDDEN,
146 base::ASCIIToUTF16(key::kRestoreOnStartup)),
147 errors().begin()->second);
148 }
149
150 TEST_F(RestoreOnStartupPolicyHandlerTest,
151 CheckPolicySettings_RestoreLastSession) { 133 CheckPolicySettings_RestoreLastSession) {
152 // Specify the Last value without the conflicts. 134 // Specify the Last value without the conflicts.
153 SetPolicyValue( 135 SetPolicyValue(
154 key::kRestoreOnStartup, 136 key::kRestoreOnStartup,
155 base::WrapUnique(new base::Value(SessionStartupPref::kPrefValueLast))); 137 base::WrapUnique(new base::Value(SessionStartupPref::kPrefValueLast)));
156 // Checking should succeed with no errors. 138 // Checking should succeed with no errors.
157 EXPECT_TRUE(CheckPolicySettings()); 139 EXPECT_TRUE(CheckPolicySettings());
158 EXPECT_TRUE(errors().empty()); 140 EXPECT_TRUE(errors().empty());
159 } 141 }
160 142
(...skipping 25 matching lines...) Expand all
186 } 168 }
187 169
188 TEST_F(RestoreOnStartupPolicyHandlerTest, ApplyPolicySettings_WrongType) { 170 TEST_F(RestoreOnStartupPolicyHandlerTest, ApplyPolicySettings_WrongType) {
189 // Handler expects an int; pass it a bool. 171 // Handler expects an int; pass it a bool.
190 SetPolicyValue(key::kRestoreOnStartup, base::MakeUnique<base::Value>(false)); 172 SetPolicyValue(key::kRestoreOnStartup, base::MakeUnique<base::Value>(false));
191 // The resulting prefs should be empty. 173 // The resulting prefs should be empty.
192 EXPECT_TRUE(prefs().empty()); 174 EXPECT_TRUE(prefs().empty());
193 } 175 }
194 176
195 } // namespace policy 177 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/sessions/restore_on_startup_policy_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698