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 23 matching lines...) Expand all Loading... |
34 prefs::kBlockThirdPartyCookies); | 34 prefs::kBlockThirdPartyCookies); |
35 ASSERT_TRUE(pref); | 35 ASSERT_TRUE(pref); |
36 EXPECT_TRUE(pref->IsExtensionControlled()); | 36 EXPECT_TRUE(pref->IsExtensionControlled()); |
37 EXPECT_TRUE(prefs->GetBoolean(prefs::kAlternateErrorPagesEnabled)); | 37 EXPECT_TRUE(prefs->GetBoolean(prefs::kAlternateErrorPagesEnabled)); |
38 EXPECT_TRUE(prefs->GetBoolean(autofill::prefs::kAutofillEnabled)); | 38 EXPECT_TRUE(prefs->GetBoolean(autofill::prefs::kAutofillEnabled)); |
39 EXPECT_FALSE(prefs->GetBoolean(prefs::kBlockThirdPartyCookies)); | 39 EXPECT_FALSE(prefs->GetBoolean(prefs::kBlockThirdPartyCookies)); |
40 EXPECT_TRUE(prefs->GetBoolean(prefs::kEnableHyperlinkAuditing)); | 40 EXPECT_TRUE(prefs->GetBoolean(prefs::kEnableHyperlinkAuditing)); |
41 EXPECT_TRUE(prefs->GetBoolean(prefs::kEnableReferrers)); | 41 EXPECT_TRUE(prefs->GetBoolean(prefs::kEnableReferrers)); |
42 EXPECT_TRUE(prefs->GetBoolean(prefs::kEnableTranslate)); | 42 EXPECT_TRUE(prefs->GetBoolean(prefs::kEnableTranslate)); |
43 EXPECT_TRUE(prefs->GetBoolean(prefs::kNetworkPredictionEnabled)); | 43 EXPECT_TRUE(prefs->GetBoolean(prefs::kNetworkPredictionEnabled)); |
| 44 EXPECT_TRUE(prefs->GetBoolean( |
| 45 password_manager::prefs::kPasswordManagerEnabled)); |
44 EXPECT_TRUE(prefs->GetBoolean(prefs::kSafeBrowsingEnabled)); | 46 EXPECT_TRUE(prefs->GetBoolean(prefs::kSafeBrowsingEnabled)); |
45 EXPECT_TRUE(prefs->GetBoolean(prefs::kSearchSuggestEnabled)); | 47 EXPECT_TRUE(prefs->GetBoolean(prefs::kSearchSuggestEnabled)); |
46 } | 48 } |
47 | 49 |
48 void CheckPreferencesCleared() { | 50 void CheckPreferencesCleared() { |
49 PrefService* prefs = profile_->GetPrefs(); | 51 PrefService* prefs = profile_->GetPrefs(); |
50 const PrefService::Preference* pref = prefs->FindPreference( | 52 const PrefService::Preference* pref = prefs->FindPreference( |
51 prefs::kBlockThirdPartyCookies); | 53 prefs::kBlockThirdPartyCookies); |
52 ASSERT_TRUE(pref); | 54 ASSERT_TRUE(pref); |
53 EXPECT_FALSE(pref->IsExtensionControlled()); | 55 EXPECT_FALSE(pref->IsExtensionControlled()); |
54 EXPECT_FALSE(prefs->GetBoolean(prefs::kAlternateErrorPagesEnabled)); | 56 EXPECT_FALSE(prefs->GetBoolean(prefs::kAlternateErrorPagesEnabled)); |
55 EXPECT_FALSE(prefs->GetBoolean(autofill::prefs::kAutofillEnabled)); | 57 EXPECT_FALSE(prefs->GetBoolean(autofill::prefs::kAutofillEnabled)); |
56 EXPECT_TRUE(prefs->GetBoolean(prefs::kBlockThirdPartyCookies)); | 58 EXPECT_TRUE(prefs->GetBoolean(prefs::kBlockThirdPartyCookies)); |
57 EXPECT_FALSE(prefs->GetBoolean(prefs::kEnableHyperlinkAuditing)); | 59 EXPECT_FALSE(prefs->GetBoolean(prefs::kEnableHyperlinkAuditing)); |
58 EXPECT_FALSE(prefs->GetBoolean(prefs::kEnableReferrers)); | 60 EXPECT_FALSE(prefs->GetBoolean(prefs::kEnableReferrers)); |
59 EXPECT_FALSE(prefs->GetBoolean(prefs::kEnableTranslate)); | 61 EXPECT_FALSE(prefs->GetBoolean(prefs::kEnableTranslate)); |
60 EXPECT_FALSE(prefs->GetBoolean(prefs::kNetworkPredictionEnabled)); | 62 EXPECT_FALSE(prefs->GetBoolean(prefs::kNetworkPredictionEnabled)); |
| 63 EXPECT_FALSE(prefs->GetBoolean( |
| 64 password_manager::prefs::kPasswordManagerEnabled)); |
61 EXPECT_FALSE(prefs->GetBoolean(prefs::kSafeBrowsingEnabled)); | 65 EXPECT_FALSE(prefs->GetBoolean(prefs::kSafeBrowsingEnabled)); |
62 EXPECT_FALSE(prefs->GetBoolean(prefs::kSearchSuggestEnabled)); | 66 EXPECT_FALSE(prefs->GetBoolean(prefs::kSearchSuggestEnabled)); |
63 } | 67 } |
64 | 68 |
65 virtual void SetUpOnMainThread() OVERRIDE { | 69 virtual void SetUpOnMainThread() OVERRIDE { |
66 ExtensionApiTest::SetUpOnMainThread(); | 70 ExtensionApiTest::SetUpOnMainThread(); |
67 | 71 |
68 // The browser might get closed later (and therefore be destroyed), so we | 72 // The browser might get closed later (and therefore be destroyed), so we |
69 // save the profile. | 73 // save the profile. |
70 profile_ = browser()->profile(); | 74 profile_ = browser()->profile(); |
(...skipping 25 matching lines...) Expand all Loading... |
96 #endif | 100 #endif |
97 IN_PROC_BROWSER_TEST_F(ExtensionPreferenceApiTest, MAYBE_Standard) { | 101 IN_PROC_BROWSER_TEST_F(ExtensionPreferenceApiTest, MAYBE_Standard) { |
98 PrefService* prefs = profile_->GetPrefs(); | 102 PrefService* prefs = profile_->GetPrefs(); |
99 prefs->SetBoolean(prefs::kAlternateErrorPagesEnabled, false); | 103 prefs->SetBoolean(prefs::kAlternateErrorPagesEnabled, false); |
100 prefs->SetBoolean(autofill::prefs::kAutofillEnabled, false); | 104 prefs->SetBoolean(autofill::prefs::kAutofillEnabled, false); |
101 prefs->SetBoolean(prefs::kBlockThirdPartyCookies, true); | 105 prefs->SetBoolean(prefs::kBlockThirdPartyCookies, true); |
102 prefs->SetBoolean(prefs::kEnableHyperlinkAuditing, false); | 106 prefs->SetBoolean(prefs::kEnableHyperlinkAuditing, false); |
103 prefs->SetBoolean(prefs::kEnableReferrers, false); | 107 prefs->SetBoolean(prefs::kEnableReferrers, false); |
104 prefs->SetBoolean(prefs::kEnableTranslate, false); | 108 prefs->SetBoolean(prefs::kEnableTranslate, false); |
105 prefs->SetBoolean(prefs::kNetworkPredictionEnabled, false); | 109 prefs->SetBoolean(prefs::kNetworkPredictionEnabled, false); |
| 110 prefs->SetBoolean(password_manager::prefs::kPasswordManagerEnabled, false); |
106 prefs->SetBoolean(prefs::kSafeBrowsingEnabled, false); | 111 prefs->SetBoolean(prefs::kSafeBrowsingEnabled, false); |
107 prefs->SetBoolean(prefs::kSearchSuggestEnabled, false); | 112 prefs->SetBoolean(prefs::kSearchSuggestEnabled, false); |
108 | 113 |
109 const char kExtensionPath[] = "preference/standard"; | 114 const char kExtensionPath[] = "preference/standard"; |
110 | 115 |
111 EXPECT_TRUE(RunExtensionSubtest(kExtensionPath, "test.html")) << message_; | 116 EXPECT_TRUE(RunExtensionSubtest(kExtensionPath, "test.html")) << message_; |
112 CheckPreferencesSet(); | 117 CheckPreferencesSet(); |
113 | 118 |
114 // The settings should not be reset when the extension is reloaded. | 119 // The settings should not be reset when the extension is reloaded. |
115 ReloadExtension(last_loaded_extension_id()); | 120 ReloadExtension(last_loaded_extension_id()); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 | 315 |
311 // Test 6 - clearDefault | 316 // Test 6 - clearDefault |
312 EXPECT_TRUE(listener10.WaitUntilSatisfied()); // Regular ready | 317 EXPECT_TRUE(listener10.WaitUntilSatisfied()); // Regular ready |
313 EXPECT_TRUE(listener_incognito10.WaitUntilSatisfied()); // Incognito ready | 318 EXPECT_TRUE(listener_incognito10.WaitUntilSatisfied()); // Incognito ready |
314 listener10.Reply("ok"); | 319 listener10.Reply("ok"); |
315 listener_incognito10.Reply("ok"); | 320 listener_incognito10.Reply("ok"); |
316 | 321 |
317 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 322 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
318 EXPECT_TRUE(catcher_incognito.GetNextResult()) << catcher.message(); | 323 EXPECT_TRUE(catcher_incognito.GetNextResult()) << catcher.message(); |
319 } | 324 } |
OLD | NEW |