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

Side by Side Diff: chrome/browser/prefs/command_line_pref_store_unittest.cc

Issue 7520023: Converted IncognitoForced boolean policy into IncognitoModeAvailability enum policy. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <gtest/gtest.h> 5 #include <gtest/gtest.h>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "chrome/browser/prefs/command_line_pref_store.h" 11 #include "chrome/browser/prefs/command_line_pref_store.h"
12 #include "chrome/browser/prefs/incognito_mode_availability_prefs.h"
12 #include "chrome/browser/prefs/proxy_config_dictionary.h" 13 #include "chrome/browser/prefs/proxy_config_dictionary.h"
13 #include "chrome/common/chrome_switches.h" 14 #include "chrome/common/chrome_switches.h"
14 #include "chrome/common/pref_names.h" 15 #include "chrome/common/pref_names.h"
15 #include "ui/base/ui_base_switches.h" 16 #include "ui/base/ui_base_switches.h"
16 17
17 namespace { 18 namespace {
18 19
19 class TestCommandLinePrefStore : public CommandLinePrefStore { 20 class TestCommandLinePrefStore : public CommandLinePrefStore {
20 public: 21 public:
21 explicit TestCommandLinePrefStore(CommandLine* cl) 22 explicit TestCommandLinePrefStore(CommandLine* cl)
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 cl3.AppendSwitchASCII(switches::kCipherSuiteBlacklist, 208 cl3.AppendSwitchASCII(switches::kCipherSuiteBlacklist,
208 "0x0004;MOAR;0x0005"); 209 "0x0004;MOAR;0x0005");
209 scoped_refptr<TestCommandLinePrefStore> store3 = 210 scoped_refptr<TestCommandLinePrefStore> store3 =
210 new TestCommandLinePrefStore(&cl3); 211 new TestCommandLinePrefStore(&cl3);
211 const char* const expected_ciphers3[] = { 212 const char* const expected_ciphers3[] = {
212 "0x0004;MOAR;0x0005" 213 "0x0004;MOAR;0x0005"
213 }; 214 };
214 store3->VerifySSLCipherSuites(expected_ciphers3, 215 store3->VerifySSLCipherSuites(expected_ciphers3,
215 arraysize(expected_ciphers3)); 216 arraysize(expected_ciphers3));
216 } 217 }
218
219 // Tests setting incognito mode availability preference using command line
220 // swithces.
221 TEST(CommandLinePrefStoreTest,
222 SetIncognitoModeAvailabilityPrefViaSwitch) {
223 CommandLine cl1(CommandLine::NO_PROGRAM);
224 // No switches.
225 scoped_refptr<TestCommandLinePrefStore> store1 =
226 new TestCommandLinePrefStore(&cl1);
227 const Value* actual = NULL;
228 EXPECT_EQ(PrefStore::READ_NO_VALUE,
229 store1->GetValue(prefs::kIncognitoModeAvailability, &actual));
230
231 CommandLine cl2(CommandLine::NO_PROGRAM);
232 cl2.AppendSwitch(switches::kIncognito);
233 // No switches.
234 scoped_refptr<TestCommandLinePrefStore> store2 =
235 new TestCommandLinePrefStore(&cl2);
236 actual = NULL;
237 ASSERT_EQ(PrefStore::READ_OK,
238 store2->GetValue(prefs::kIncognitoModeAvailability, &actual));
239 int result;
240 ASSERT_TRUE(actual->GetAsInteger(&result));
241 EXPECT_EQ(IncognitoModeAvailabilityPrefs::FORCED, result);
242 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698