Index: chrome/browser/prefs/command_line_pref_store_unittest.cc |
diff --git a/chrome/browser/prefs/command_line_pref_store_unittest.cc b/chrome/browser/prefs/command_line_pref_store_unittest.cc |
index ecb81d2e6915280853f13ba1f9a3860f6085a321..712ec4f1e9da2427710fd9ed267d61485d47cfd2 100644 |
--- a/chrome/browser/prefs/command_line_pref_store_unittest.cc |
+++ b/chrome/browser/prefs/command_line_pref_store_unittest.cc |
@@ -9,6 +9,7 @@ |
#include "base/string_util.h" |
#include "base/values.h" |
#include "chrome/browser/prefs/command_line_pref_store.h" |
+#include "chrome/browser/prefs/incognito_mode_availability_prefs.h" |
#include "chrome/browser/prefs/proxy_config_dictionary.h" |
#include "chrome/common/chrome_switches.h" |
#include "chrome/common/pref_names.h" |
@@ -214,3 +215,28 @@ TEST(CommandLinePrefStoreTest, DisableSSLCipherSuites) { |
store3->VerifySSLCipherSuites(expected_ciphers3, |
arraysize(expected_ciphers3)); |
} |
+ |
+// Tests setting incognito mode availability preference using command line |
+// swithces. |
+TEST(CommandLinePrefStoreTest, |
+ SetIncognitoModeAvailabilityPrefViaSwitch) { |
+ CommandLine cl1(CommandLine::NO_PROGRAM); |
+ // No switches. |
+ scoped_refptr<TestCommandLinePrefStore> store1 = |
+ new TestCommandLinePrefStore(&cl1); |
+ const Value* actual = NULL; |
+ EXPECT_EQ(PrefStore::READ_NO_VALUE, |
+ store1->GetValue(prefs::kIncognitoModeAvailability, &actual)); |
+ |
+ CommandLine cl2(CommandLine::NO_PROGRAM); |
+ cl2.AppendSwitch(switches::kIncognito); |
+ // No switches. |
+ scoped_refptr<TestCommandLinePrefStore> store2 = |
+ new TestCommandLinePrefStore(&cl2); |
+ actual = NULL; |
+ ASSERT_EQ(PrefStore::READ_OK, |
+ store2->GetValue(prefs::kIncognitoModeAvailability, &actual)); |
+ int result; |
+ ASSERT_TRUE(actual->GetAsInteger(&result)); |
+ EXPECT_EQ(IncognitoModeAvailabilityPrefs::FORCED, result); |
+} |