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 <list> | 5 #include <list> |
6 #include <map> | 6 #include <map> |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 const bool kIsFromSync = true; | 427 const bool kIsFromSync = true; |
428 const bool kMarkAcknowledged = false; | 428 const bool kMarkAcknowledged = false; |
429 const bool kRemoteInstall = false; | 429 const bool kRemoteInstall = false; |
430 std::string id = | 430 std::string id = |
431 crx_file::id_util::GenerateId(base::StringPrintf("extension%i", i)); | 431 crx_file::id_util::GenerateId(base::StringPrintf("extension%i", i)); |
432 | 432 |
433 pending_extension_manager->AddForTesting( | 433 pending_extension_manager->AddForTesting( |
434 PendingExtensionInfo(id, | 434 PendingExtensionInfo(id, |
435 std::string(), | 435 std::string(), |
436 update_url, | 436 update_url, |
437 base::Version(), | 437 Version(), |
438 should_allow_install, | 438 should_allow_install, |
439 kIsFromSync, | 439 kIsFromSync, |
440 Manifest::INTERNAL, | 440 Manifest::INTERNAL, |
441 Extension::NO_FLAGS, | 441 Extension::NO_FLAGS, |
442 kMarkAcknowledged, | 442 kMarkAcknowledged, |
443 kRemoteInstall)); | 443 kRemoteInstall)); |
444 } | 444 } |
445 } | 445 } |
446 | 446 |
447 class ServiceForManifestTests : public MockService { | 447 class ServiceForManifestTests : public MockService { |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1161 service->OverrideDownloaderDelegate(&delegate); | 1161 service->OverrideDownloaderDelegate(&delegate); |
1162 updater.Start(); | 1162 updater.Start(); |
1163 updater.EnsureDownloaderCreated(); | 1163 updater.EnsureDownloaderCreated(); |
1164 updater.downloader_->extensions_queue_.set_backoff_policy( | 1164 updater.downloader_->extensions_queue_.set_backoff_policy( |
1165 &kNoBackoffPolicy); | 1165 &kNoBackoffPolicy); |
1166 | 1166 |
1167 GURL test_url("http://localhost/extension.crx"); | 1167 GURL test_url("http://localhost/extension.crx"); |
1168 | 1168 |
1169 std::string id = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; | 1169 std::string id = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; |
1170 std::string hash; | 1170 std::string hash; |
1171 base::Version version("0.0.1"); | 1171 Version version("0.0.1"); |
1172 std::set<int> requests; | 1172 std::set<int> requests; |
1173 requests.insert(0); | 1173 requests.insert(0); |
1174 scoped_ptr<ExtensionDownloader::ExtensionFetch> fetch( | 1174 scoped_ptr<ExtensionDownloader::ExtensionFetch> fetch( |
1175 new ExtensionDownloader::ExtensionFetch( | 1175 new ExtensionDownloader::ExtensionFetch( |
1176 id, test_url, hash, version.GetString(), requests)); | 1176 id, test_url, hash, version.GetString(), requests)); |
1177 updater.downloader_->FetchUpdatedExtension(fetch.Pass()); | 1177 updater.downloader_->FetchUpdatedExtension(fetch.Pass()); |
1178 | 1178 |
1179 if (pending) { | 1179 if (pending) { |
1180 const bool kIsFromSync = true; | 1180 const bool kIsFromSync = true; |
1181 const bool kMarkAcknowledged = false; | 1181 const bool kMarkAcknowledged = false; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1271 NULL, | 1271 NULL, |
1272 downloader_factory); | 1272 downloader_factory); |
1273 updater.Start(); | 1273 updater.Start(); |
1274 updater.EnsureDownloaderCreated(); | 1274 updater.EnsureDownloaderCreated(); |
1275 updater.downloader_->extensions_queue_.set_backoff_policy( | 1275 updater.downloader_->extensions_queue_.set_backoff_policy( |
1276 &kNoBackoffPolicy); | 1276 &kNoBackoffPolicy); |
1277 | 1277 |
1278 GURL test_url(base::StringPrintf("%s/extension.crx", url_prefix.c_str())); | 1278 GURL test_url(base::StringPrintf("%s/extension.crx", url_prefix.c_str())); |
1279 std::string id = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; | 1279 std::string id = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; |
1280 std::string hash; | 1280 std::string hash; |
1281 base::Version version("0.0.1"); | 1281 Version version("0.0.1"); |
1282 std::set<int> requests; | 1282 std::set<int> requests; |
1283 requests.insert(0); | 1283 requests.insert(0); |
1284 scoped_ptr<ExtensionDownloader::ExtensionFetch> fetch( | 1284 scoped_ptr<ExtensionDownloader::ExtensionFetch> fetch( |
1285 new ExtensionDownloader::ExtensionFetch( | 1285 new ExtensionDownloader::ExtensionFetch( |
1286 id, test_url, hash, version.GetString(), requests)); | 1286 id, test_url, hash, version.GetString(), requests)); |
1287 updater.downloader_->FetchUpdatedExtension(fetch.Pass()); | 1287 updater.downloader_->FetchUpdatedExtension(fetch.Pass()); |
1288 | 1288 |
1289 fetcher = factory.GetFetcherByID(ExtensionDownloader::kExtensionFetcherId); | 1289 fetcher = factory.GetFetcherByID(ExtensionDownloader::kExtensionFetcherId); |
1290 EXPECT_TRUE(fetcher != NULL && fetcher->delegate() != NULL); | 1290 EXPECT_TRUE(fetcher != NULL && fetcher->delegate() != NULL); |
1291 EXPECT_EQ(kExpectedLoadFlags, fetcher->GetLoadFlags()); | 1291 EXPECT_EQ(kExpectedLoadFlags, fetcher->GetLoadFlags()); |
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2249 // -prodversionmin (shouldn't update if browser version too old) | 2249 // -prodversionmin (shouldn't update if browser version too old) |
2250 // -manifests & updates arriving out of order / interleaved | 2250 // -manifests & updates arriving out of order / interleaved |
2251 // -malformed update url (empty, file://, has query, has a # fragment, etc.) | 2251 // -malformed update url (empty, file://, has query, has a # fragment, etc.) |
2252 // -An extension gets uninstalled while updates are in progress (so it doesn't | 2252 // -An extension gets uninstalled while updates are in progress (so it doesn't |
2253 // "come back from the dead") | 2253 // "come back from the dead") |
2254 // -An extension gets manually updated to v3 while we're downloading v2 (ie | 2254 // -An extension gets manually updated to v3 while we're downloading v2 (ie |
2255 // you don't get downgraded accidentally) | 2255 // you don't get downgraded accidentally) |
2256 // -An update manifest mentions multiple updates | 2256 // -An update manifest mentions multiple updates |
2257 | 2257 |
2258 } // namespace extensions | 2258 } // namespace extensions |
OLD | NEW |