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

Side by Side Diff: chrome/browser/extensions/extension_service_unittest.cc

Issue 8198007: Remove PrefService::ScheduleSavePersistentPrefs and SavePersistentPrefs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 8 years, 12 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 "chrome/browser/extensions/extension_service_unittest.h" 5 #include "chrome/browser/extensions/extension_service_unittest.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 2569 matching lines...) Expand 10 before | Expand all | Expand 10 after
2580 EXPECT_EQ(1u, service_->extensions()->size()); 2580 EXPECT_EQ(1u, service_->extensions()->size());
2581 2581
2582 { // Scope for pref update notification. 2582 { // Scope for pref update notification.
2583 PrefService* prefs = profile_->GetPrefs(); 2583 PrefService* prefs = profile_->GetPrefs();
2584 ListPrefUpdate update(prefs, prefs::kExtensionInstallDenyList); 2584 ListPrefUpdate update(prefs, prefs::kExtensionInstallDenyList);
2585 ListValue* blacklist = update.Get(); 2585 ListValue* blacklist = update.Get();
2586 ASSERT_TRUE(blacklist != NULL); 2586 ASSERT_TRUE(blacklist != NULL);
2587 2587
2588 // Blacklist this extension. 2588 // Blacklist this extension.
2589 blacklist->Append(Value::CreateStringValue(good_crx)); 2589 blacklist->Append(Value::CreateStringValue(good_crx));
2590 prefs->ScheduleSavePersistentPrefs();
2591 } 2590 }
2592 2591
2593 // Extension should not be running now. 2592 // Extension should not be running now.
2594 loop_.RunAllPending(); 2593 loop_.RunAllPending();
2595 EXPECT_EQ(0u, service_->extensions()->size()); 2594 EXPECT_EQ(0u, service_->extensions()->size());
2596 } 2595 }
2597 2596
2598 // Tests that component extensions are not blacklisted by policy. 2597 // Tests that component extensions are not blacklisted by policy.
2599 TEST_F(ExtensionServiceTest, ComponentExtensionWhitelisted) { 2598 TEST_F(ExtensionServiceTest, ComponentExtensionWhitelisted) {
2600 InitializeEmptyExtensionService(); 2599 InitializeEmptyExtensionService();
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
3176 service_->CheckForExternalUpdates(); 3175 service_->CheckForExternalUpdates();
3177 loop_.RunAllPending(); 3176 loop_.RunAllPending();
3178 ASSERT_EQ(0u, loaded_.size()); 3177 ASSERT_EQ(0u, loaded_.size());
3179 ValidatePrefKeyCount(1); 3178 ValidatePrefKeyCount(1);
3180 ValidateIntegerPref(good_crx, "state", 3179 ValidateIntegerPref(good_crx, "state",
3181 Extension::EXTERNAL_EXTENSION_UNINSTALLED); 3180 Extension::EXTERNAL_EXTENSION_UNINSTALLED);
3182 ValidateIntegerPref(good_crx, "location", location); 3181 ValidateIntegerPref(good_crx, "location", location);
3183 3182
3184 // Now clear the preference and reinstall. 3183 // Now clear the preference and reinstall.
3185 SetPrefInteg(good_crx, "state", Extension::ENABLED); 3184 SetPrefInteg(good_crx, "state", Extension::ENABLED);
3186 profile_->GetPrefs()->ScheduleSavePersistentPrefs();
3187 3185
3188 loaded_.clear(); 3186 loaded_.clear();
3189 service_->CheckForExternalUpdates(); 3187 service_->CheckForExternalUpdates();
3190 loop_.RunAllPending(); 3188 loop_.RunAllPending();
3191 ASSERT_EQ(1u, loaded_.size()); 3189 ASSERT_EQ(1u, loaded_.size());
3192 } else { 3190 } else {
3193 // Policy controlled extesions should not have been touched by uninstall. 3191 // Policy controlled extesions should not have been touched by uninstall.
3194 ASSERT_TRUE(file_util::PathExists(install_path)); 3192 ASSERT_TRUE(file_util::PathExists(install_path));
3195 } 3193 }
3196 ValidatePrefKeyCount(1); 3194 ValidatePrefKeyCount(1);
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after
4379 ASSERT_FALSE(AddPendingSyncInstall()); 4377 ASSERT_FALSE(AddPendingSyncInstall());
4380 4378
4381 // Wait for the external source to install. 4379 // Wait for the external source to install.
4382 WaitForCrxInstall(crx_path_, INSTALL_NEW); 4380 WaitForCrxInstall(crx_path_, INSTALL_NEW);
4383 ASSERT_TRUE(IsCrxInstalled()); 4381 ASSERT_TRUE(IsCrxInstalled());
4384 4382
4385 // Now that the extension is installed, sync request should fail 4383 // Now that the extension is installed, sync request should fail
4386 // because the extension is already installed. 4384 // because the extension is already installed.
4387 ASSERT_FALSE(AddPendingSyncInstall()); 4385 ASSERT_FALSE(AddPendingSyncInstall());
4388 } 4386 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_prefs.cc ('k') | chrome/browser/extensions/extension_toolbar_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698