Chromium Code Reviews| Index: chrome/browser/extensions/updater/extension_updater_unittest.cc |
| diff --git a/chrome/browser/extensions/updater/extension_updater_unittest.cc b/chrome/browser/extensions/updater/extension_updater_unittest.cc |
| index 782ee7943d45b651faf5f97aeb5a7992e376b53d..8ded09ca9ca9adae5ee49b8e3235295a73f27b30 100644 |
| --- a/chrome/browser/extensions/updater/extension_updater_unittest.cc |
| +++ b/chrome/browser/extensions/updater/extension_updater_unittest.cc |
| @@ -2,6 +2,7 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| +#include <list> |
| #include <map> |
| #include <set> |
| #include <vector> |
| @@ -234,11 +235,15 @@ bool ShouldAlwaysInstall(const Extension& extension) { |
| } |
| // Loads some pending extension records into a pending extension manager. |
| +// Require that there are no pending extensions in the pending extension manager |
|
Aaron Boodman
2012/05/11 19:23:55
Put this comment above the assertion. Or just kill
|
| +// prior to this function call. |
| void SetupPendingExtensionManagerForTest( |
| int count, |
| const GURL& update_url, |
| PendingExtensionManager* pending_extension_manager) { |
| - for (int i = 1; i <= count; i++) { |
| + ASSERT_EQ(0u, pending_extension_manager->pending_extension_list_.size()); |
| + |
| + for (int i = count; i >= 1; --i) { |
| PendingExtensionInfo::ShouldAllowInstallPredicate should_allow_install = |
| (i % 2 == 0) ? &ShouldInstallThemesOnly : &ShouldInstallExtensionsOnly; |
| const bool kIsFromSync = true; |
| @@ -246,14 +251,23 @@ void SetupPendingExtensionManagerForTest( |
| std::string id = GenerateId(base::StringPrintf("extension%i", i)); |
| pending_extension_manager->AddForTesting( |
| - id, |
| - PendingExtensionInfo(update_url, |
| + PendingExtensionInfo(id, |
| + update_url, |
| Version(), |
| should_allow_install, |
| kIsFromSync, |
| kInstallSilently, |
| Extension::INTERNAL)); |
| } |
| + |
| + // Check to see if the order in which the extensions were added is preserved. |
| + std::list<std::string> pending_ids; |
| + pending_extension_manager->GetPendingIdsForUpdateCheck(&pending_ids); |
| + int i = count; |
| + for (std::list<std::string>::const_iterator it = pending_ids.begin(); |
|
Aaron Boodman
2012/05/11 19:23:55
This is fine, but not sure if it's really worth te
|
| + it != pending_ids.end(); ++it, --i) { |
| + ASSERT_EQ(*it, base::StringPrintf("extension%i", i)); |
| + } |
| } |
| class ServiceForManifestTests : public MockService { |
| @@ -701,11 +715,11 @@ class ExtensionUpdaterTest : public testing::Test { |
| ManifestFetchData fetch_data(GURL("http://localhost/foo")); |
| UpdateManifest::Results updates; |
| - std::set<std::string> ids_for_update_check; |
| + std::list<std::string> ids_for_update_check; |
| pending_extension_manager->GetPendingIdsForUpdateCheck( |
| &ids_for_update_check); |
| - std::set<std::string>::const_iterator it; |
| + std::list<std::string>::const_iterator it; |
| for (it = ids_for_update_check.begin(); |
| it != ids_for_update_check.end(); ++it) { |
| fetch_data.AddExtension(*it, "1.0.0.0", |
| @@ -867,8 +881,7 @@ class ExtensionUpdaterTest : public testing::Test { |
| PendingExtensionManager* pending_extension_manager = |
| service->pending_extension_manager(); |
| pending_extension_manager->AddForTesting( |
| - id, |
| - PendingExtensionInfo(test_url, *version, |
| + PendingExtensionInfo(id, test_url, *version, |
| &ShouldAlwaysInstall, kIsFromSync, |
| kInstallSilently, |
| Extension::INTERNAL)); |