OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/prefs/pref_service.h" | 5 #include "base/prefs/pref_service.h" |
6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
10 #include "chrome/browser/extensions/extension_test_message_listener.h" | 10 #include "chrome/browser/extensions/extension_test_message_listener.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 ASSERT_TRUE(pref); | 37 ASSERT_TRUE(pref); |
38 EXPECT_TRUE(pref->IsExtensionControlled()); | 38 EXPECT_TRUE(pref->IsExtensionControlled()); |
39 EXPECT_TRUE(prefs->GetBoolean(prefs::kAlternateErrorPagesEnabled)); | 39 EXPECT_TRUE(prefs->GetBoolean(prefs::kAlternateErrorPagesEnabled)); |
40 EXPECT_TRUE(prefs->GetBoolean(autofill::prefs::kAutofillEnabled)); | 40 EXPECT_TRUE(prefs->GetBoolean(autofill::prefs::kAutofillEnabled)); |
41 EXPECT_FALSE(prefs->GetBoolean(prefs::kBlockThirdPartyCookies)); | 41 EXPECT_FALSE(prefs->GetBoolean(prefs::kBlockThirdPartyCookies)); |
42 EXPECT_TRUE(prefs->GetBoolean(prefs::kEnableHyperlinkAuditing)); | 42 EXPECT_TRUE(prefs->GetBoolean(prefs::kEnableHyperlinkAuditing)); |
43 EXPECT_TRUE(prefs->GetBoolean(prefs::kEnableReferrers)); | 43 EXPECT_TRUE(prefs->GetBoolean(prefs::kEnableReferrers)); |
44 EXPECT_TRUE(prefs->GetBoolean(prefs::kEnableTranslate)); | 44 EXPECT_TRUE(prefs->GetBoolean(prefs::kEnableTranslate)); |
45 EXPECT_TRUE(prefs->GetBoolean(prefs::kNetworkPredictionEnabled)); | 45 EXPECT_TRUE(prefs->GetBoolean(prefs::kNetworkPredictionEnabled)); |
46 EXPECT_TRUE(prefs->GetBoolean( | 46 EXPECT_TRUE(prefs->GetBoolean( |
47 password_manager::prefs::kPasswordManagerEnabled)); | 47 password_manager::prefs::kPasswordManagerSavingEnabled)); |
48 EXPECT_TRUE(prefs->GetBoolean(prefs::kSafeBrowsingEnabled)); | 48 EXPECT_TRUE(prefs->GetBoolean(prefs::kSafeBrowsingEnabled)); |
49 EXPECT_TRUE(prefs->GetBoolean(prefs::kSearchSuggestEnabled)); | 49 EXPECT_TRUE(prefs->GetBoolean(prefs::kSearchSuggestEnabled)); |
50 } | 50 } |
51 | 51 |
52 void CheckPreferencesCleared() { | 52 void CheckPreferencesCleared() { |
53 PrefService* prefs = profile_->GetPrefs(); | 53 PrefService* prefs = profile_->GetPrefs(); |
54 const PrefService::Preference* pref = prefs->FindPreference( | 54 const PrefService::Preference* pref = prefs->FindPreference( |
55 prefs::kBlockThirdPartyCookies); | 55 prefs::kBlockThirdPartyCookies); |
56 ASSERT_TRUE(pref); | 56 ASSERT_TRUE(pref); |
57 EXPECT_FALSE(pref->IsExtensionControlled()); | 57 EXPECT_FALSE(pref->IsExtensionControlled()); |
58 EXPECT_FALSE(prefs->GetBoolean(prefs::kAlternateErrorPagesEnabled)); | 58 EXPECT_FALSE(prefs->GetBoolean(prefs::kAlternateErrorPagesEnabled)); |
59 EXPECT_FALSE(prefs->GetBoolean(autofill::prefs::kAutofillEnabled)); | 59 EXPECT_FALSE(prefs->GetBoolean(autofill::prefs::kAutofillEnabled)); |
60 EXPECT_TRUE(prefs->GetBoolean(prefs::kBlockThirdPartyCookies)); | 60 EXPECT_TRUE(prefs->GetBoolean(prefs::kBlockThirdPartyCookies)); |
61 EXPECT_FALSE(prefs->GetBoolean(prefs::kEnableHyperlinkAuditing)); | 61 EXPECT_FALSE(prefs->GetBoolean(prefs::kEnableHyperlinkAuditing)); |
62 EXPECT_FALSE(prefs->GetBoolean(prefs::kEnableReferrers)); | 62 EXPECT_FALSE(prefs->GetBoolean(prefs::kEnableReferrers)); |
63 EXPECT_FALSE(prefs->GetBoolean(prefs::kEnableTranslate)); | 63 EXPECT_FALSE(prefs->GetBoolean(prefs::kEnableTranslate)); |
64 EXPECT_FALSE(prefs->GetBoolean(prefs::kNetworkPredictionEnabled)); | 64 EXPECT_FALSE(prefs->GetBoolean(prefs::kNetworkPredictionEnabled)); |
65 EXPECT_FALSE(prefs->GetBoolean( | 65 EXPECT_FALSE(prefs->GetBoolean( |
66 password_manager::prefs::kPasswordManagerEnabled)); | 66 password_manager::prefs::kPasswordManagerSavingEnabled)); |
67 EXPECT_FALSE(prefs->GetBoolean(prefs::kSafeBrowsingEnabled)); | 67 EXPECT_FALSE(prefs->GetBoolean(prefs::kSafeBrowsingEnabled)); |
68 EXPECT_FALSE(prefs->GetBoolean(prefs::kSearchSuggestEnabled)); | 68 EXPECT_FALSE(prefs->GetBoolean(prefs::kSearchSuggestEnabled)); |
69 } | 69 } |
70 | 70 |
71 virtual void SetUpOnMainThread() OVERRIDE { | 71 virtual void SetUpOnMainThread() OVERRIDE { |
72 ExtensionApiTest::SetUpOnMainThread(); | 72 ExtensionApiTest::SetUpOnMainThread(); |
73 | 73 |
74 // The browser might get closed later (and therefore be destroyed), so we | 74 // The browser might get closed later (and therefore be destroyed), so we |
75 // save the profile. | 75 // save the profile. |
76 profile_ = browser()->profile(); | 76 profile_ = browser()->profile(); |
(...skipping 25 matching lines...) Expand all Loading... |
102 #endif | 102 #endif |
103 IN_PROC_BROWSER_TEST_F(ExtensionPreferenceApiTest, MAYBE_Standard) { | 103 IN_PROC_BROWSER_TEST_F(ExtensionPreferenceApiTest, MAYBE_Standard) { |
104 PrefService* prefs = profile_->GetPrefs(); | 104 PrefService* prefs = profile_->GetPrefs(); |
105 prefs->SetBoolean(prefs::kAlternateErrorPagesEnabled, false); | 105 prefs->SetBoolean(prefs::kAlternateErrorPagesEnabled, false); |
106 prefs->SetBoolean(autofill::prefs::kAutofillEnabled, false); | 106 prefs->SetBoolean(autofill::prefs::kAutofillEnabled, false); |
107 prefs->SetBoolean(prefs::kBlockThirdPartyCookies, true); | 107 prefs->SetBoolean(prefs::kBlockThirdPartyCookies, true); |
108 prefs->SetBoolean(prefs::kEnableHyperlinkAuditing, false); | 108 prefs->SetBoolean(prefs::kEnableHyperlinkAuditing, false); |
109 prefs->SetBoolean(prefs::kEnableReferrers, false); | 109 prefs->SetBoolean(prefs::kEnableReferrers, false); |
110 prefs->SetBoolean(prefs::kEnableTranslate, false); | 110 prefs->SetBoolean(prefs::kEnableTranslate, false); |
111 prefs->SetBoolean(prefs::kNetworkPredictionEnabled, false); | 111 prefs->SetBoolean(prefs::kNetworkPredictionEnabled, false); |
112 prefs->SetBoolean(password_manager::prefs::kPasswordManagerEnabled, false); | 112 prefs->SetBoolean(password_manager::prefs::kPasswordManagerSavingEnabled, |
| 113 false); |
113 prefs->SetBoolean(prefs::kSafeBrowsingEnabled, false); | 114 prefs->SetBoolean(prefs::kSafeBrowsingEnabled, false); |
114 prefs->SetBoolean(prefs::kSearchSuggestEnabled, false); | 115 prefs->SetBoolean(prefs::kSearchSuggestEnabled, false); |
115 | 116 |
116 const char kExtensionPath[] = "preference/standard"; | 117 const char kExtensionPath[] = "preference/standard"; |
117 | 118 |
118 EXPECT_TRUE(RunExtensionSubtest(kExtensionPath, "test.html")) << message_; | 119 EXPECT_TRUE(RunExtensionSubtest(kExtensionPath, "test.html")) << message_; |
119 CheckPreferencesSet(); | 120 CheckPreferencesSet(); |
120 | 121 |
121 // The settings should not be reset when the extension is reloaded. | 122 // The settings should not be reset when the extension is reloaded. |
122 ReloadExtension(last_loaded_extension_id()); | 123 ReloadExtension(last_loaded_extension_id()); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 | 317 |
317 // Test 6 - clearDefault | 318 // Test 6 - clearDefault |
318 EXPECT_TRUE(listener10.WaitUntilSatisfied()); // Regular ready | 319 EXPECT_TRUE(listener10.WaitUntilSatisfied()); // Regular ready |
319 EXPECT_TRUE(listener_incognito10.WaitUntilSatisfied()); // Incognito ready | 320 EXPECT_TRUE(listener_incognito10.WaitUntilSatisfied()); // Incognito ready |
320 listener10.Reply("ok"); | 321 listener10.Reply("ok"); |
321 listener_incognito10.Reply("ok"); | 322 listener_incognito10.Reply("ok"); |
322 | 323 |
323 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 324 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
324 EXPECT_TRUE(catcher_incognito.GetNextResult()) << catcher.message(); | 325 EXPECT_TRUE(catcher_incognito.GetNextResult()) << catcher.message(); |
325 } | 326 } |
OLD | NEW |