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/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
16 #include "base/string_number_conversions.h" | 16 #include "base/string_number_conversions.h" |
17 #include "base/string_split.h" | 17 #include "base/string_split.h" |
18 #include "base/string_util.h" | 18 #include "base/string_util.h" |
19 #include "base/stringprintf.h" | 19 #include "base/stringprintf.h" |
20 #include "base/threading/sequenced_worker_pool.h" | |
20 #include "base/threading/thread.h" | 21 #include "base/threading/thread.h" |
21 #include "base/version.h" | 22 #include "base/version.h" |
22 #include "chrome/browser/extensions/crx_installer.h" | 23 #include "chrome/browser/extensions/crx_installer.h" |
23 #include "chrome/browser/extensions/extension_error_reporter.h" | 24 #include "chrome/browser/extensions/extension_error_reporter.h" |
24 #include "chrome/browser/extensions/extension_sync_data.h" | 25 #include "chrome/browser/extensions/extension_sync_data.h" |
25 #include "chrome/browser/extensions/extension_system.h" | 26 #include "chrome/browser/extensions/extension_system.h" |
26 #include "chrome/browser/extensions/test_extension_prefs.h" | 27 #include "chrome/browser/extensions/test_extension_prefs.h" |
27 #include "chrome/browser/extensions/test_extension_service.h" | 28 #include "chrome/browser/extensions/test_extension_service.h" |
28 #include "chrome/browser/extensions/test_extension_system.h" | 29 #include "chrome/browser/extensions/test_extension_system.h" |
29 #include "chrome/browser/extensions/updater/extension_downloader.h" | 30 #include "chrome/browser/extensions/updater/extension_downloader.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
155 std::set<std::string> updated_; | 156 std::set<std::string> updated_; |
156 | 157 |
157 DISALLOW_COPY_AND_ASSIGN(NotificationsObserver); | 158 DISALLOW_COPY_AND_ASSIGN(NotificationsObserver); |
158 }; | 159 }; |
159 | 160 |
160 } // namespace | 161 } // namespace |
161 | 162 |
162 // Base class for further specialized test classes. | 163 // Base class for further specialized test classes. |
163 class MockService : public TestExtensionService { | 164 class MockService : public TestExtensionService { |
164 public: | 165 public: |
165 MockService() | 166 explicit MockService(TestExtensionPrefs* prefs) |
166 : pending_extension_manager_(ALLOW_THIS_IN_INITIALIZER_LIST(*this)) { | 167 : prefs_(prefs), |
168 pending_extension_manager_(ALLOW_THIS_IN_INITIALIZER_LIST(*this)) { | |
167 profile_.CreateRequestContext(); | 169 profile_.CreateRequestContext(); |
168 } | 170 } |
171 | |
169 virtual ~MockService() {} | 172 virtual ~MockService() {} |
170 | 173 |
171 virtual PendingExtensionManager* pending_extension_manager() OVERRIDE { | 174 virtual PendingExtensionManager* pending_extension_manager() OVERRIDE { |
172 ADD_FAILURE() << "Subclass should override this if it will " | 175 ADD_FAILURE() << "Subclass should override this if it will " |
173 << "be accessed by a test."; | 176 << "be accessed by a test."; |
174 return &pending_extension_manager_; | 177 return &pending_extension_manager_; |
175 } | 178 } |
176 | 179 |
177 Profile* profile() { return &profile_; } | 180 Profile* profile() { return &profile_; } |
178 | 181 |
179 net::URLRequestContextGetter* request_context() { | 182 net::URLRequestContextGetter* request_context() { |
180 return profile_.GetRequestContext(); | 183 return profile_.GetRequestContext(); |
181 } | 184 } |
182 | 185 |
183 ExtensionPrefs* extension_prefs() { return prefs_.prefs(); } | 186 ExtensionPrefs* extension_prefs() { return prefs_->prefs(); } |
184 | 187 |
185 PrefService* pref_service() { return prefs_.pref_service(); } | 188 PrefService* pref_service() { return prefs_->pref_service(); } |
186 | 189 |
187 // Creates test extensions and inserts them into list. The name and | 190 // Creates test extensions and inserts them into list. The name and |
188 // version are all based on their index. If |update_url| is non-null, it | 191 // version are all based on their index. If |update_url| is non-null, it |
189 // will be used as the update_url for each extension. | 192 // will be used as the update_url for each extension. |
190 // The |id| is used to distinguish extension names and make sure that | 193 // The |id| is used to distinguish extension names and make sure that |
191 // no two extensions share the same name. | 194 // no two extensions share the same name. |
192 void CreateTestExtensions(int id, int count, ExtensionList *list, | 195 void CreateTestExtensions(int id, int count, ExtensionList *list, |
193 const std::string* update_url, | 196 const std::string* update_url, |
194 Extension::Location location) { | 197 Extension::Location location) { |
195 for (int i = 1; i <= count; i++) { | 198 for (int i = 1; i <= count; i++) { |
196 DictionaryValue manifest; | 199 DictionaryValue manifest; |
197 manifest.SetString(extension_manifest_keys::kVersion, | 200 manifest.SetString(extension_manifest_keys::kVersion, |
198 base::StringPrintf("%d.0.0.0", i)); | 201 base::StringPrintf("%d.0.0.0", i)); |
199 manifest.SetString(extension_manifest_keys::kName, | 202 manifest.SetString(extension_manifest_keys::kName, |
200 base::StringPrintf("Extension %d.%d", id, i)); | 203 base::StringPrintf("Extension %d.%d", id, i)); |
201 if (update_url) | 204 if (update_url) |
202 manifest.SetString(extension_manifest_keys::kUpdateURL, *update_url); | 205 manifest.SetString(extension_manifest_keys::kUpdateURL, *update_url); |
203 scoped_refptr<Extension> e = | 206 scoped_refptr<Extension> e = |
204 prefs_.AddExtensionWithManifest(manifest, location); | 207 prefs_->AddExtensionWithManifest(manifest, location); |
205 ASSERT_TRUE(e != NULL); | 208 ASSERT_TRUE(e != NULL); |
206 list->push_back(e); | 209 list->push_back(e); |
207 } | 210 } |
208 } | 211 } |
209 | 212 |
210 protected: | 213 protected: |
214 TestExtensionPrefs* prefs_; | |
211 PendingExtensionManager pending_extension_manager_; | 215 PendingExtensionManager pending_extension_manager_; |
212 TestExtensionPrefs prefs_; | |
213 TestingProfile profile_; | 216 TestingProfile profile_; |
214 | 217 |
215 private: | 218 private: |
216 DISALLOW_COPY_AND_ASSIGN(MockService); | 219 DISALLOW_COPY_AND_ASSIGN(MockService); |
217 }; | 220 }; |
218 | 221 |
219 | 222 |
220 std::string GenerateId(std::string input) { | 223 std::string GenerateId(std::string input) { |
221 std::string result; | 224 std::string result; |
222 EXPECT_TRUE(Extension::GenerateId(input, &result)); | 225 EXPECT_TRUE(Extension::GenerateId(input, &result)); |
(...skipping 30 matching lines...) Expand all Loading... | |
253 Version(), | 256 Version(), |
254 should_allow_install, | 257 should_allow_install, |
255 kIsFromSync, | 258 kIsFromSync, |
256 kInstallSilently, | 259 kInstallSilently, |
257 Extension::INTERNAL)); | 260 Extension::INTERNAL)); |
258 } | 261 } |
259 } | 262 } |
260 | 263 |
261 class ServiceForManifestTests : public MockService { | 264 class ServiceForManifestTests : public MockService { |
262 public: | 265 public: |
263 ServiceForManifestTests() {} | 266 explicit ServiceForManifestTests(TestExtensionPrefs* prefs) |
267 : MockService(prefs) { | |
268 } | |
264 | 269 |
265 virtual ~ServiceForManifestTests() {} | 270 virtual ~ServiceForManifestTests() {} |
266 | 271 |
267 virtual const Extension* GetExtensionById( | 272 virtual const Extension* GetExtensionById( |
268 const std::string& id, bool include_disabled) const OVERRIDE { | 273 const std::string& id, bool include_disabled) const OVERRIDE { |
269 const Extension* result = extensions_.GetByID(id); | 274 const Extension* result = extensions_.GetByID(id); |
270 if (result || !include_disabled) | 275 if (result || !include_disabled) |
271 return result; | 276 return result; |
272 return disabled_extensions_.GetByID(id); | 277 return disabled_extensions_.GetByID(id); |
273 } | 278 } |
(...skipping 24 matching lines...) Expand all Loading... | |
298 } | 303 } |
299 } | 304 } |
300 | 305 |
301 private: | 306 private: |
302 ExtensionSet extensions_; | 307 ExtensionSet extensions_; |
303 ExtensionSet disabled_extensions_; | 308 ExtensionSet disabled_extensions_; |
304 }; | 309 }; |
305 | 310 |
306 class ServiceForDownloadTests : public MockService { | 311 class ServiceForDownloadTests : public MockService { |
307 public: | 312 public: |
308 ServiceForDownloadTests() | 313 explicit ServiceForDownloadTests(TestExtensionPrefs* prefs) |
309 : MockService() { | 314 : MockService(prefs) { |
310 } | 315 } |
311 | 316 |
312 // Add a fake crx installer to be returned by a call to UpdateExtension() | 317 // Add a fake crx installer to be returned by a call to UpdateExtension() |
313 // with a specific ID. Caller keeps ownership of |crx_installer|. | 318 // with a specific ID. Caller keeps ownership of |crx_installer|. |
314 void AddFakeCrxInstaller(const std::string& id, CrxInstaller* crx_installer) { | 319 void AddFakeCrxInstaller(const std::string& id, CrxInstaller* crx_installer) { |
315 fake_crx_installers_[id] = crx_installer; | 320 fake_crx_installers_[id] = crx_installer; |
316 } | 321 } |
317 | 322 |
318 bool UpdateExtension( | 323 bool UpdateExtension( |
319 const std::string& id, | 324 const std::string& id, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
362 | 367 |
363 // The last extension ID that GetExtensionById was called with. | 368 // The last extension ID that GetExtensionById was called with. |
364 // Mutable because the method that sets it (GetExtensionById) is const | 369 // Mutable because the method that sets it (GetExtensionById) is const |
365 // in the actual extension service, but must record the last extension | 370 // in the actual extension service, but must record the last extension |
366 // ID in this test class. | 371 // ID in this test class. |
367 mutable std::string last_inquired_extension_id_; | 372 mutable std::string last_inquired_extension_id_; |
368 }; | 373 }; |
369 | 374 |
370 class ServiceForBlacklistTests : public MockService { | 375 class ServiceForBlacklistTests : public MockService { |
371 public: | 376 public: |
372 ServiceForBlacklistTests() | 377 explicit ServiceForBlacklistTests(TestExtensionPrefs* prefs) |
373 : MockService(), | 378 : MockService(prefs), |
374 processed_blacklist_(false) { | 379 processed_blacklist_(false) { |
375 } | 380 } |
376 virtual void UpdateExtensionBlacklist( | 381 virtual void UpdateExtensionBlacklist( |
377 const std::vector<std::string>& blacklist) OVERRIDE { | 382 const std::vector<std::string>& blacklist) OVERRIDE { |
378 processed_blacklist_ = true; | 383 processed_blacklist_ = true; |
379 return; | 384 return; |
380 } | 385 } |
381 bool processed_blacklist() { return processed_blacklist_; } | 386 bool processed_blacklist() { return processed_blacklist_; } |
382 const std::string& extension_id() { return extension_id_; } | 387 const std::string& extension_id() { return extension_id_; } |
383 | 388 |
(...skipping 26 matching lines...) Expand all Loading... | |
410 } | 415 } |
411 } | 416 } |
412 | 417 |
413 // All of our tests that need to use private APIs of ExtensionUpdater live | 418 // All of our tests that need to use private APIs of ExtensionUpdater live |
414 // inside this class (which is a friend to ExtensionUpdater). | 419 // inside this class (which is a friend to ExtensionUpdater). |
415 class ExtensionUpdaterTest : public testing::Test { | 420 class ExtensionUpdaterTest : public testing::Test { |
416 public: | 421 public: |
417 ExtensionUpdaterTest() | 422 ExtensionUpdaterTest() |
418 : ui_thread_(BrowserThread::UI, &loop_), | 423 : ui_thread_(BrowserThread::UI, &loop_), |
419 file_thread_(BrowserThread::FILE, &loop_), | 424 file_thread_(BrowserThread::FILE, &loop_), |
420 io_thread_(BrowserThread::IO, &loop_) {} | 425 io_thread_(BrowserThread::IO, &loop_) { |
426 blocking_pool_ = new base::SequencedWorkerPool(3, "MockServiceBlocking"); | |
427 } | |
428 | |
429 virtual ~ExtensionUpdaterTest() { | |
430 blocking_pool_->Shutdown(); | |
431 } | |
432 | |
433 virtual void SetUp() OVERRIDE { | |
434 prefs_.reset(new TestExtensionPrefs(blocking_pool_)); | |
akalin
2012/10/18 23:52:24
can pass in an loop_.message_loop_proxy() instead
| |
435 } | |
421 | 436 |
422 virtual void TearDown() OVERRIDE { | 437 virtual void TearDown() OVERRIDE { |
423 // Some tests create URLRequestContextGetters, whose destruction must run | 438 // Some tests create URLRequestContextGetters, whose destruction must run |
424 // on the IO thread. Make sure the IO loop spins before shutdown so that | 439 // on the IO thread. Make sure the IO loop spins before shutdown so that |
425 // those objects are released. | 440 // those objects are released. |
441 RunAllPending(); | |
442 prefs_.reset(NULL); | |
443 } | |
444 | |
445 void RunAllPending() { | |
446 prefs_->pref_service()->CommitPendingWrite(); | |
447 blocking_pool_->FlushForTesting(); | |
akalin
2012/10/18 23:52:24
see similar comment in TestExtensionPrefs
| |
426 loop_.RunAllPending(); | 448 loop_.RunAllPending(); |
427 } | 449 } |
428 | 450 |
429 void RunAllPending() { | |
430 loop_.RunAllPending(); | |
431 } | |
432 | |
433 void SimulateTimerFired(ExtensionUpdater* updater) { | 451 void SimulateTimerFired(ExtensionUpdater* updater) { |
434 EXPECT_TRUE(updater->timer_.IsRunning()); | 452 EXPECT_TRUE(updater->timer_.IsRunning()); |
435 updater->timer_.Stop(); | 453 updater->timer_.Stop(); |
436 updater->TimerFired(); | 454 updater->TimerFired(); |
437 } | 455 } |
438 | 456 |
439 // Adds a Result with the given data to results. | 457 // Adds a Result with the given data to results. |
440 void AddParseResult(const std::string& id, | 458 void AddParseResult(const std::string& id, |
441 const std::string& version, | 459 const std::string& version, |
442 const std::string& url, | 460 const std::string& url, |
(...skipping 16 matching lines...) Expand all Loading... | |
459 downloader->StartUpdateCheck(fetch_data); | 477 downloader->StartUpdateCheck(fetch_data); |
460 } | 478 } |
461 | 479 |
462 size_t ManifestFetchersCount(ExtensionDownloader* downloader) { | 480 size_t ManifestFetchersCount(ExtensionDownloader* downloader) { |
463 return downloader->manifests_pending_.size() + | 481 return downloader->manifests_pending_.size() + |
464 (downloader->manifest_fetcher_.get() ? 1 : 0); | 482 (downloader->manifest_fetcher_.get() ? 1 : 0); |
465 } | 483 } |
466 | 484 |
467 void TestExtensionUpdateCheckRequests(bool pending) { | 485 void TestExtensionUpdateCheckRequests(bool pending) { |
468 // Create an extension with an update_url. | 486 // Create an extension with an update_url. |
469 ServiceForManifestTests service; | 487 ServiceForManifestTests service(prefs_.get()); |
470 std::string update_url("http://foo.com/bar"); | 488 std::string update_url("http://foo.com/bar"); |
471 ExtensionList extensions; | 489 ExtensionList extensions; |
472 PendingExtensionManager* pending_extension_manager = | 490 PendingExtensionManager* pending_extension_manager = |
473 service.pending_extension_manager(); | 491 service.pending_extension_manager(); |
474 if (pending) { | 492 if (pending) { |
475 SetupPendingExtensionManagerForTest(1, GURL(update_url), | 493 SetupPendingExtensionManagerForTest(1, GURL(update_url), |
476 pending_extension_manager); | 494 pending_extension_manager); |
477 } else { | 495 } else { |
478 service.CreateTestExtensions(1, 1, &extensions, &update_url, | 496 service.CreateTestExtensions(1, 1, &extensions, &update_url, |
479 Extension::INTERNAL); | 497 Extension::INTERNAL); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
519 EXPECT_EQ("0.0.0.0", params["v"]); | 537 EXPECT_EQ("0.0.0.0", params["v"]); |
520 } else { | 538 } else { |
521 EXPECT_EQ(extensions[0]->id(), params["id"]); | 539 EXPECT_EQ(extensions[0]->id(), params["id"]); |
522 EXPECT_EQ(extensions[0]->VersionString(), params["v"]); | 540 EXPECT_EQ(extensions[0]->VersionString(), params["v"]); |
523 } | 541 } |
524 EXPECT_EQ("", params["uc"]); | 542 EXPECT_EQ("", params["uc"]); |
525 } | 543 } |
526 | 544 |
527 void TestBlacklistUpdateCheckRequests() { | 545 void TestBlacklistUpdateCheckRequests() { |
528 // Setup and start the updater. | 546 // Setup and start the updater. |
529 ServiceForManifestTests service; | 547 ServiceForManifestTests service(prefs_.get()); |
530 | 548 |
531 net::TestURLFetcherFactory factory; | 549 net::TestURLFetcherFactory factory; |
532 ExtensionUpdater updater( | 550 ExtensionUpdater updater( |
533 &service, service.extension_prefs(), service.pref_service(), | 551 &service, service.extension_prefs(), service.pref_service(), |
534 service.profile(), 60*60*24); | 552 service.profile(), 60*60*24); |
535 updater.Start(); | 553 updater.Start(); |
536 | 554 |
537 // Tell the updater that it's time to do update checks. | 555 // Tell the updater that it's time to do update checks. |
538 SimulateTimerFired(&updater); | 556 SimulateTimerFired(&updater); |
539 | 557 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
601 ManifestFetchData fetch_data(GURL("http://localhost/foo")); | 619 ManifestFetchData fetch_data(GURL("http://localhost/foo")); |
602 fetch_data.AddExtension(id, version, &kNeverPingedData, "a=1&b=2&c", ""); | 620 fetch_data.AddExtension(id, version, &kNeverPingedData, "a=1&b=2&c", ""); |
603 EXPECT_EQ("http://localhost/foo\?x=id%3Daaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | 621 EXPECT_EQ("http://localhost/foo\?x=id%3Daaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
604 "%26v%3D1.0%26uc%26ap%3Da%253D1%2526b%253D2%2526c", | 622 "%26v%3D1.0%26uc%26ap%3Da%253D1%2526b%253D2%2526c", |
605 fetch_data.full_url().spec()); | 623 fetch_data.full_url().spec()); |
606 } | 624 } |
607 | 625 |
608 void TestUpdateUrlDataFromGallery(const std::string& gallery_url) { | 626 void TestUpdateUrlDataFromGallery(const std::string& gallery_url) { |
609 net::TestURLFetcherFactory factory; | 627 net::TestURLFetcherFactory factory; |
610 | 628 |
611 MockService service; | 629 MockService service(prefs_.get()); |
612 MockExtensionDownloaderDelegate delegate; | 630 MockExtensionDownloaderDelegate delegate; |
613 ExtensionDownloader downloader(&delegate, service.request_context()); | 631 ExtensionDownloader downloader(&delegate, service.request_context()); |
614 ExtensionList extensions; | 632 ExtensionList extensions; |
615 std::string url(gallery_url); | 633 std::string url(gallery_url); |
616 | 634 |
617 service.CreateTestExtensions(1, 1, &extensions, &url, Extension::INTERNAL); | 635 service.CreateTestExtensions(1, 1, &extensions, &url, Extension::INTERNAL); |
618 | 636 |
619 const std::string& id = extensions[0]->id(); | 637 const std::string& id = extensions[0]->id(); |
620 EXPECT_CALL(delegate, GetPingDataForExtension(id, _)); | 638 EXPECT_CALL(delegate, GetPingDataForExtension(id, _)); |
621 | 639 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
682 .WillOnce(DoAll(SetArgPointee<1>("2.0.0.0"), | 700 .WillOnce(DoAll(SetArgPointee<1>("2.0.0.0"), |
683 Return(true))); | 701 Return(true))); |
684 | 702 |
685 downloader.DetermineUpdates(fetch_data, updates, &updateable); | 703 downloader.DetermineUpdates(fetch_data, updates, &updateable); |
686 EXPECT_EQ(1u, updateable.size()); | 704 EXPECT_EQ(1u, updateable.size()); |
687 EXPECT_EQ(0, updateable[0]); | 705 EXPECT_EQ(0, updateable[0]); |
688 } | 706 } |
689 | 707 |
690 void TestDetermineUpdatesPending() { | 708 void TestDetermineUpdatesPending() { |
691 // Create a set of test extensions | 709 // Create a set of test extensions |
692 ServiceForManifestTests service; | 710 ServiceForManifestTests service(prefs_.get()); |
693 PendingExtensionManager* pending_extension_manager = | 711 PendingExtensionManager* pending_extension_manager = |
694 service.pending_extension_manager(); | 712 service.pending_extension_manager(); |
695 SetupPendingExtensionManagerForTest(3, GURL(), pending_extension_manager); | 713 SetupPendingExtensionManagerForTest(3, GURL(), pending_extension_manager); |
696 | 714 |
697 TestingProfile profile; | 715 TestingProfile profile; |
698 profile.CreateRequestContext(); | 716 profile.CreateRequestContext(); |
699 MockExtensionDownloaderDelegate delegate; | 717 MockExtensionDownloaderDelegate delegate; |
700 ExtensionDownloader downloader(&delegate, profile.GetRequestContext()); | 718 ExtensionDownloader downloader(&delegate, profile.GetRequestContext()); |
701 | 719 |
702 ManifestFetchData fetch_data(GURL("http://localhost/foo")); | 720 ManifestFetchData fetch_data(GURL("http://localhost/foo")); |
(...skipping 21 matching lines...) Expand all Loading... | |
724 EXPECT_EQ(3u, updateable.size()); | 742 EXPECT_EQ(3u, updateable.size()); |
725 for (std::vector<int>::size_type i = 0; i < updateable.size(); ++i) { | 743 for (std::vector<int>::size_type i = 0; i < updateable.size(); ++i) { |
726 EXPECT_EQ(static_cast<int>(i), updateable[i]); | 744 EXPECT_EQ(static_cast<int>(i), updateable[i]); |
727 } | 745 } |
728 } | 746 } |
729 | 747 |
730 void TestMultipleManifestDownloading() { | 748 void TestMultipleManifestDownloading() { |
731 net::TestURLFetcherFactory factory; | 749 net::TestURLFetcherFactory factory; |
732 net::TestURLFetcher* fetcher = NULL; | 750 net::TestURLFetcher* fetcher = NULL; |
733 NotificationsObserver observer; | 751 NotificationsObserver observer; |
734 MockService service; | 752 MockService service(prefs_.get()); |
735 MockExtensionDownloaderDelegate delegate; | 753 MockExtensionDownloaderDelegate delegate; |
736 ExtensionDownloader downloader(&delegate, service.request_context()); | 754 ExtensionDownloader downloader(&delegate, service.request_context()); |
737 | 755 |
738 GURL kUpdateUrl("http://localhost/manifest1"); | 756 GURL kUpdateUrl("http://localhost/manifest1"); |
739 | 757 |
740 ManifestFetchData* fetch1 = new ManifestFetchData(kUpdateUrl); | 758 ManifestFetchData* fetch1 = new ManifestFetchData(kUpdateUrl); |
741 ManifestFetchData* fetch2 = new ManifestFetchData(kUpdateUrl); | 759 ManifestFetchData* fetch2 = new ManifestFetchData(kUpdateUrl); |
742 ManifestFetchData* fetch3 = new ManifestFetchData(kUpdateUrl); | 760 ManifestFetchData* fetch3 = new ManifestFetchData(kUpdateUrl); |
743 ManifestFetchData* fetch4 = new ManifestFetchData(kUpdateUrl); | 761 ManifestFetchData* fetch4 = new ManifestFetchData(kUpdateUrl); |
744 ManifestFetchData::PingData zeroDays(0, 0); | 762 ManifestFetchData::PingData zeroDays(0, 0); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
836 Mock::VerifyAndClearExpectations(&delegate); | 854 Mock::VerifyAndClearExpectations(&delegate); |
837 | 855 |
838 // Verify that the downloader decided to update this extension. | 856 // Verify that the downloader decided to update this extension. |
839 EXPECT_EQ(1u, observer.UpdatedCount()); | 857 EXPECT_EQ(1u, observer.UpdatedCount()); |
840 EXPECT_TRUE(observer.Updated("4444")); | 858 EXPECT_TRUE(observer.Updated("4444")); |
841 } | 859 } |
842 | 860 |
843 void TestSingleExtensionDownloading(bool pending) { | 861 void TestSingleExtensionDownloading(bool pending) { |
844 net::TestURLFetcherFactory factory; | 862 net::TestURLFetcherFactory factory; |
845 net::TestURLFetcher* fetcher = NULL; | 863 net::TestURLFetcher* fetcher = NULL; |
846 scoped_ptr<ServiceForDownloadTests> service(new ServiceForDownloadTests); | 864 scoped_ptr<ServiceForDownloadTests> service( |
865 new ServiceForDownloadTests(prefs_.get())); | |
847 ExtensionUpdater updater(service.get(), service->extension_prefs(), | 866 ExtensionUpdater updater(service.get(), service->extension_prefs(), |
848 service->pref_service(), | 867 service->pref_service(), |
849 service->profile(), | 868 service->profile(), |
850 kUpdateFrequencySecs); | 869 kUpdateFrequencySecs); |
851 updater.Start(); | 870 updater.Start(); |
852 ResetDownloader( | 871 ResetDownloader( |
853 &updater, | 872 &updater, |
854 new ExtensionDownloader(&updater, service->request_context())); | 873 new ExtensionDownloader(&updater, service->request_context())); |
855 | 874 |
856 GURL test_url("http://localhost/extension.crx"); | 875 GURL test_url("http://localhost/extension.crx"); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
892 EXPECT_EQ(id, service->extension_id()); | 911 EXPECT_EQ(id, service->extension_id()); |
893 FilePath tmpfile_path = service->install_path(); | 912 FilePath tmpfile_path = service->install_path(); |
894 EXPECT_FALSE(tmpfile_path.empty()); | 913 EXPECT_FALSE(tmpfile_path.empty()); |
895 EXPECT_EQ(test_url, service->download_url()); | 914 EXPECT_EQ(test_url, service->download_url()); |
896 EXPECT_EQ(extension_file_path, tmpfile_path); | 915 EXPECT_EQ(extension_file_path, tmpfile_path); |
897 } | 916 } |
898 | 917 |
899 void TestBlacklistDownloading() { | 918 void TestBlacklistDownloading() { |
900 net::TestURLFetcherFactory factory; | 919 net::TestURLFetcherFactory factory; |
901 net::TestURLFetcher* fetcher = NULL; | 920 net::TestURLFetcher* fetcher = NULL; |
902 ServiceForBlacklistTests service; | 921 ServiceForBlacklistTests service(prefs_.get()); |
903 ExtensionUpdater updater( | 922 ExtensionUpdater updater( |
904 &service, service.extension_prefs(), service.pref_service(), | 923 &service, service.extension_prefs(), service.pref_service(), |
905 service.profile(), kUpdateFrequencySecs); | 924 service.profile(), kUpdateFrequencySecs); |
906 updater.Start(); | 925 updater.Start(); |
907 ResetDownloader( | 926 ResetDownloader( |
908 &updater, | 927 &updater, |
909 new ExtensionDownloader(&updater, service.request_context())); | 928 new ExtensionDownloader(&updater, service.request_context())); |
910 GURL test_url("http://localhost/extension.crx"); | 929 GURL test_url("http://localhost/extension.crx"); |
911 | 930 |
912 std::string id = "com.google.crx.blacklist"; | 931 std::string id = "com.google.crx.blacklist"; |
(...skipping 27 matching lines...) Expand all Loading... | |
940 GetString(prefs::kExtensionBlacklistUpdateVersion)); | 959 GetString(prefs::kExtensionBlacklistUpdateVersion)); |
941 } | 960 } |
942 | 961 |
943 // Two extensions are updated. If |updates_start_running| is true, the | 962 // Two extensions are updated. If |updates_start_running| is true, the |
944 // mock extensions service has UpdateExtension(...) return true, and | 963 // mock extensions service has UpdateExtension(...) return true, and |
945 // the test is responsible for creating fake CrxInstallers. Otherwise, | 964 // the test is responsible for creating fake CrxInstallers. Otherwise, |
946 // UpdateExtension() returns false, signaling install failures. | 965 // UpdateExtension() returns false, signaling install failures. |
947 void TestMultipleExtensionDownloading(bool updates_start_running) { | 966 void TestMultipleExtensionDownloading(bool updates_start_running) { |
948 net::TestURLFetcherFactory factory; | 967 net::TestURLFetcherFactory factory; |
949 net::TestURLFetcher* fetcher = NULL; | 968 net::TestURLFetcher* fetcher = NULL; |
950 ServiceForDownloadTests service; | 969 ServiceForDownloadTests service(prefs_.get()); |
951 ExtensionUpdater updater( | 970 ExtensionUpdater updater( |
952 &service, service.extension_prefs(), service.pref_service(), | 971 &service, service.extension_prefs(), service.pref_service(), |
953 service.profile(), kUpdateFrequencySecs); | 972 service.profile(), kUpdateFrequencySecs); |
954 updater.Start(); | 973 updater.Start(); |
955 ResetDownloader( | 974 ResetDownloader( |
956 &updater, | 975 &updater, |
957 new ExtensionDownloader(&updater, service.request_context())); | 976 new ExtensionDownloader(&updater, service.request_context())); |
958 | 977 |
959 EXPECT_FALSE(updater.crx_install_is_running_); | 978 EXPECT_FALSE(updater.crx_install_is_running_); |
960 | 979 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1109 // on the delta between now and the last ping time (or in the case of active | 1128 // on the delta between now and the last ping time (or in the case of active |
1110 // pings, that delta plus whether the app has been active). | 1129 // pings, that delta plus whether the app has been active). |
1111 void TestGalleryRequests(int rollcall_ping_days, | 1130 void TestGalleryRequests(int rollcall_ping_days, |
1112 int active_ping_days, | 1131 int active_ping_days, |
1113 bool active_bit, | 1132 bool active_bit, |
1114 bool expect_brand_code) { | 1133 bool expect_brand_code) { |
1115 net::TestURLFetcherFactory factory; | 1134 net::TestURLFetcherFactory factory; |
1116 | 1135 |
1117 // Set up 2 mock extensions, one with a google.com update url and one | 1136 // Set up 2 mock extensions, one with a google.com update url and one |
1118 // without. | 1137 // without. |
1119 ServiceForManifestTests service; | 1138 prefs_.reset(new TestExtensionPrefs(blocking_pool_)); |
1139 ServiceForManifestTests service(prefs_.get()); | |
1120 ExtensionList tmp; | 1140 ExtensionList tmp; |
1121 GURL url1("http://clients2.google.com/service/update2/crx"); | 1141 GURL url1("http://clients2.google.com/service/update2/crx"); |
1122 GURL url2("http://www.somewebsite.com"); | 1142 GURL url2("http://www.somewebsite.com"); |
1123 service.CreateTestExtensions(1, 1, &tmp, &url1.possibly_invalid_spec(), | 1143 service.CreateTestExtensions(1, 1, &tmp, &url1.possibly_invalid_spec(), |
1124 Extension::INTERNAL); | 1144 Extension::INTERNAL); |
1125 service.CreateTestExtensions(2, 1, &tmp, &url2.possibly_invalid_spec(), | 1145 service.CreateTestExtensions(2, 1, &tmp, &url2.possibly_invalid_spec(), |
1126 Extension::INTERNAL); | 1146 Extension::INTERNAL); |
1127 EXPECT_EQ(2u, tmp.size()); | 1147 EXPECT_EQ(2u, tmp.size()); |
1128 service.set_extensions(tmp); | 1148 service.set_extensions(tmp); |
1129 | 1149 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1221 if (expect_brand_code) { | 1241 if (expect_brand_code) { |
1222 EXPECT_TRUE(url1_query.find(brand_string) != std::string::npos); | 1242 EXPECT_TRUE(url1_query.find(brand_string) != std::string::npos); |
1223 } else { | 1243 } else { |
1224 EXPECT_TRUE(url1_query.find(brand_string) == std::string::npos); | 1244 EXPECT_TRUE(url1_query.find(brand_string) == std::string::npos); |
1225 } | 1245 } |
1226 #else | 1246 #else |
1227 // Chromium builds never add the brand to the parameter, even for google | 1247 // Chromium builds never add the brand to the parameter, even for google |
1228 // queries. | 1248 // queries. |
1229 EXPECT_TRUE(url1_query.find(brand_string) == std::string::npos); | 1249 EXPECT_TRUE(url1_query.find(brand_string) == std::string::npos); |
1230 #endif | 1250 #endif |
1251 | |
1252 RunAllPending(); | |
1231 } | 1253 } |
1232 | 1254 |
1233 // This makes sure that the extension updater properly stores the results | 1255 // This makes sure that the extension updater properly stores the results |
1234 // of a <daystart> tag from a manifest fetch in one of two cases: 1) This is | 1256 // of a <daystart> tag from a manifest fetch in one of two cases: 1) This is |
1235 // the first time we fetched the extension, or 2) We sent a ping value of | 1257 // the first time we fetched the extension, or 2) We sent a ping value of |
1236 // >= 1 day for the extension. | 1258 // >= 1 day for the extension. |
1237 void TestHandleManifestResults() { | 1259 void TestHandleManifestResults() { |
1238 ServiceForManifestTests service; | 1260 ServiceForManifestTests service(prefs_.get()); |
1239 GURL update_url("http://www.google.com/manifest"); | 1261 GURL update_url("http://www.google.com/manifest"); |
1240 ExtensionList tmp; | 1262 ExtensionList tmp; |
1241 service.CreateTestExtensions(1, 1, &tmp, &update_url.spec(), | 1263 service.CreateTestExtensions(1, 1, &tmp, &update_url.spec(), |
1242 Extension::INTERNAL); | 1264 Extension::INTERNAL); |
1243 service.set_extensions(tmp); | 1265 service.set_extensions(tmp); |
1244 | 1266 |
1245 ExtensionUpdater updater( | 1267 ExtensionUpdater updater( |
1246 &service, service.extension_prefs(), service.pref_service(), | 1268 &service, service.extension_prefs(), service.pref_service(), |
1247 service.profile(), kUpdateFrequencySecs); | 1269 service.profile(), kUpdateFrequencySecs); |
1248 updater.Start(); | 1270 updater.Start(); |
1249 ResetDownloader( | 1271 ResetDownloader( |
1250 &updater, | 1272 &updater, |
1251 new ExtensionDownloader(&updater, service.request_context())); | 1273 new ExtensionDownloader(&updater, service.request_context())); |
1252 | 1274 |
1253 ManifestFetchData fetch_data(update_url); | 1275 ManifestFetchData fetch_data(update_url); |
1254 const Extension* extension = tmp[0]; | 1276 const Extension* extension = tmp[0]; |
1255 fetch_data.AddExtension(extension->id(), extension->VersionString(), | 1277 fetch_data.AddExtension(extension->id(), extension->VersionString(), |
1256 &kNeverPingedData, kEmptyUpdateUrlData, ""); | 1278 &kNeverPingedData, kEmptyUpdateUrlData, ""); |
1257 UpdateManifest::Results results; | 1279 UpdateManifest::Results results; |
1258 results.daystart_elapsed_seconds = 750; | 1280 results.daystart_elapsed_seconds = 750; |
1259 | 1281 |
1260 updater.downloader_->HandleManifestResults(fetch_data, &results); | 1282 updater.downloader_->HandleManifestResults(fetch_data, &results); |
1261 Time last_ping_day = | 1283 Time last_ping_day = |
1262 service.extension_prefs()->LastPingDay(extension->id()); | 1284 service.extension_prefs()->LastPingDay(extension->id()); |
1263 EXPECT_FALSE(last_ping_day.is_null()); | 1285 EXPECT_FALSE(last_ping_day.is_null()); |
1264 int64 seconds_diff = (Time::Now() - last_ping_day).InSeconds(); | 1286 int64 seconds_diff = (Time::Now() - last_ping_day).InSeconds(); |
1265 EXPECT_LT(seconds_diff - results.daystart_elapsed_seconds, 5); | 1287 EXPECT_LT(seconds_diff - results.daystart_elapsed_seconds, 5); |
1266 } | 1288 } |
1267 | 1289 |
1290 protected: | |
1291 scoped_refptr<base::SequencedWorkerPool> blocking_pool_; | |
1292 scoped_ptr<TestExtensionPrefs> prefs_; | |
1293 | |
1268 private: | 1294 private: |
1269 MessageLoop loop_; | 1295 MessageLoop loop_; |
1270 content::TestBrowserThread ui_thread_; | 1296 content::TestBrowserThread ui_thread_; |
1271 content::TestBrowserThread file_thread_; | 1297 content::TestBrowserThread file_thread_; |
1272 content::TestBrowserThread io_thread_; | 1298 content::TestBrowserThread io_thread_; |
1273 }; | 1299 }; |
1274 | 1300 |
1275 // Because we test some private methods of ExtensionUpdater, it's easier for the | 1301 // Because we test some private methods of ExtensionUpdater, it's easier for the |
1276 // actual test code to live in ExtenionUpdaterTest methods instead of TEST_F | 1302 // actual test code to live in ExtenionUpdaterTest methods instead of TEST_F |
1277 // subclasses where friendship with ExtenionUpdater is not inherited. | 1303 // subclasses where friendship with ExtenionUpdater is not inherited. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1338 TEST_F(ExtensionUpdaterTest, TestGalleryRequestsWithNonOrganicBrand) { | 1364 TEST_F(ExtensionUpdaterTest, TestGalleryRequestsWithNonOrganicBrand) { |
1339 TestGalleryRequestsWithBrand(false); | 1365 TestGalleryRequestsWithBrand(false); |
1340 } | 1366 } |
1341 | 1367 |
1342 TEST_F(ExtensionUpdaterTest, TestHandleManifestResults) { | 1368 TEST_F(ExtensionUpdaterTest, TestHandleManifestResults) { |
1343 TestHandleManifestResults(); | 1369 TestHandleManifestResults(); |
1344 } | 1370 } |
1345 | 1371 |
1346 TEST_F(ExtensionUpdaterTest, TestNonAutoUpdateableLocations) { | 1372 TEST_F(ExtensionUpdaterTest, TestNonAutoUpdateableLocations) { |
1347 net::TestURLFetcherFactory factory; | 1373 net::TestURLFetcherFactory factory; |
1348 ServiceForManifestTests service; | 1374 ServiceForManifestTests service(prefs_.get()); |
1349 ExtensionUpdater updater(&service, service.extension_prefs(), | 1375 ExtensionUpdater updater(&service, service.extension_prefs(), |
1350 service.pref_service(), service.profile(), | 1376 service.pref_service(), service.profile(), |
1351 kUpdateFrequencySecs); | 1377 kUpdateFrequencySecs); |
1352 MockExtensionDownloaderDelegate delegate; | 1378 MockExtensionDownloaderDelegate delegate; |
1353 // Set the downloader directly, so that all its events end up in the mock | 1379 // Set the downloader directly, so that all its events end up in the mock |
1354 // |delegate|. | 1380 // |delegate|. |
1355 ExtensionDownloader* downloader = | 1381 ExtensionDownloader* downloader = |
1356 new ExtensionDownloader(&delegate, service.request_context()); | 1382 new ExtensionDownloader(&delegate, service.request_context()); |
1357 ResetDownloader(&updater, downloader); | 1383 ResetDownloader(&updater, downloader); |
1358 | 1384 |
(...skipping 10 matching lines...) Expand all Loading... | |
1369 EXPECT_CALL(delegate, GetPingDataForExtension(updateable_id, _)); | 1395 EXPECT_CALL(delegate, GetPingDataForExtension(updateable_id, _)); |
1370 | 1396 |
1371 service.set_extensions(extensions); | 1397 service.set_extensions(extensions); |
1372 updater.set_blacklist_checks_enabled(false); | 1398 updater.set_blacklist_checks_enabled(false); |
1373 updater.Start(); | 1399 updater.Start(); |
1374 updater.CheckNow(); | 1400 updater.CheckNow(); |
1375 } | 1401 } |
1376 | 1402 |
1377 TEST_F(ExtensionUpdaterTest, TestUpdatingDisabledExtensions) { | 1403 TEST_F(ExtensionUpdaterTest, TestUpdatingDisabledExtensions) { |
1378 net::TestURLFetcherFactory factory; | 1404 net::TestURLFetcherFactory factory; |
1379 ServiceForManifestTests service; | 1405 ServiceForManifestTests service(prefs_.get()); |
1380 ExtensionUpdater updater(&service, service.extension_prefs(), | 1406 ExtensionUpdater updater(&service, service.extension_prefs(), |
1381 service.pref_service(), service.profile(), | 1407 service.pref_service(), service.profile(), |
1382 kUpdateFrequencySecs); | 1408 kUpdateFrequencySecs); |
1383 MockExtensionDownloaderDelegate delegate; | 1409 MockExtensionDownloaderDelegate delegate; |
1384 // Set the downloader directly, so that all its events end up in the mock | 1410 // Set the downloader directly, so that all its events end up in the mock |
1385 // |delegate|. | 1411 // |delegate|. |
1386 ExtensionDownloader* downloader = | 1412 ExtensionDownloader* downloader = |
1387 new ExtensionDownloader(&delegate, service.request_context()); | 1413 new ExtensionDownloader(&delegate, service.request_context()); |
1388 ResetDownloader(&updater, downloader); | 1414 ResetDownloader(&updater, downloader); |
1389 | 1415 |
(...skipping 17 matching lines...) Expand all Loading... | |
1407 | 1433 |
1408 service.set_extensions(enabled_extensions); | 1434 service.set_extensions(enabled_extensions); |
1409 service.set_disabled_extensions(disabled_extensions); | 1435 service.set_disabled_extensions(disabled_extensions); |
1410 updater.set_blacklist_checks_enabled(false); | 1436 updater.set_blacklist_checks_enabled(false); |
1411 updater.Start(); | 1437 updater.Start(); |
1412 updater.CheckNow(); | 1438 updater.CheckNow(); |
1413 } | 1439 } |
1414 | 1440 |
1415 TEST_F(ExtensionUpdaterTest, TestManifestFetchesBuilderAddExtension) { | 1441 TEST_F(ExtensionUpdaterTest, TestManifestFetchesBuilderAddExtension) { |
1416 net::TestURLFetcherFactory factory; | 1442 net::TestURLFetcherFactory factory; |
1417 MockService service; | 1443 MockService service(prefs_.get()); |
1418 MockExtensionDownloaderDelegate delegate; | 1444 MockExtensionDownloaderDelegate delegate; |
1419 scoped_ptr<ExtensionDownloader> downloader( | 1445 scoped_ptr<ExtensionDownloader> downloader( |
1420 new ExtensionDownloader(&delegate, service.request_context())); | 1446 new ExtensionDownloader(&delegate, service.request_context())); |
1421 EXPECT_EQ(0u, ManifestFetchersCount(downloader.get())); | 1447 EXPECT_EQ(0u, ManifestFetchersCount(downloader.get())); |
1422 | 1448 |
1423 // First, verify that adding valid extensions does invoke the callbacks on | 1449 // First, verify that adding valid extensions does invoke the callbacks on |
1424 // the delegate. | 1450 // the delegate. |
1425 std::string id = GenerateId("foo"); | 1451 std::string id = GenerateId("foo"); |
1426 EXPECT_CALL(delegate, GetPingDataForExtension(id, _)).WillOnce(Return(false)); | 1452 EXPECT_CALL(delegate, GetPingDataForExtension(id, _)).WillOnce(Return(false)); |
1427 EXPECT_TRUE( | 1453 EXPECT_TRUE( |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1459 EXPECT_EQ(1u, ManifestFetchersCount(downloader.get())); | 1485 EXPECT_EQ(1u, ManifestFetchersCount(downloader.get())); |
1460 | 1486 |
1461 net::TestURLFetcher* fetcher = | 1487 net::TestURLFetcher* fetcher = |
1462 factory.GetFetcherByID(ExtensionDownloader::kManifestFetcherId); | 1488 factory.GetFetcherByID(ExtensionDownloader::kManifestFetcherId); |
1463 ASSERT_TRUE(fetcher); | 1489 ASSERT_TRUE(fetcher); |
1464 EXPECT_FALSE(fetcher->GetOriginalURL().is_empty()); | 1490 EXPECT_FALSE(fetcher->GetOriginalURL().is_empty()); |
1465 } | 1491 } |
1466 | 1492 |
1467 TEST_F(ExtensionUpdaterTest, TestStartUpdateCheckMemory) { | 1493 TEST_F(ExtensionUpdaterTest, TestStartUpdateCheckMemory) { |
1468 net::TestURLFetcherFactory factory; | 1494 net::TestURLFetcherFactory factory; |
1469 MockService service; | 1495 MockService service(prefs_.get()); |
1470 MockExtensionDownloaderDelegate delegate; | 1496 MockExtensionDownloaderDelegate delegate; |
1471 ExtensionDownloader downloader(&delegate, service.request_context()); | 1497 ExtensionDownloader downloader(&delegate, service.request_context()); |
1472 | 1498 |
1473 StartUpdateCheck(&downloader, new ManifestFetchData(GURL())); | 1499 StartUpdateCheck(&downloader, new ManifestFetchData(GURL())); |
1474 // This should delete the newly-created ManifestFetchData. | 1500 // This should delete the newly-created ManifestFetchData. |
1475 StartUpdateCheck(&downloader, new ManifestFetchData(GURL())); | 1501 StartUpdateCheck(&downloader, new ManifestFetchData(GURL())); |
1476 // This should add into |manifests_pending_|. | 1502 // This should add into |manifests_pending_|. |
1477 StartUpdateCheck(&downloader, new ManifestFetchData(GURL( | 1503 StartUpdateCheck(&downloader, new ManifestFetchData(GURL( |
1478 GURL("http://www.google.com")))); | 1504 GURL("http://www.google.com")))); |
1479 // The dtor of |downloader| should delete the pending fetchers. | 1505 // The dtor of |downloader| should delete the pending fetchers. |
1480 } | 1506 } |
1481 | 1507 |
1482 TEST_F(ExtensionUpdaterTest, TestCheckSoon) { | 1508 TEST_F(ExtensionUpdaterTest, TestCheckSoon) { |
1483 ServiceForManifestTests service; | 1509 ServiceForManifestTests service(prefs_.get()); |
1484 net::TestURLFetcherFactory factory; | 1510 net::TestURLFetcherFactory factory; |
1485 ExtensionUpdater updater( | 1511 ExtensionUpdater updater( |
1486 &service, service.extension_prefs(), service.pref_service(), | 1512 &service, service.extension_prefs(), service.pref_service(), |
1487 service.profile(), kUpdateFrequencySecs); | 1513 service.profile(), kUpdateFrequencySecs); |
1488 EXPECT_FALSE(updater.WillCheckSoon()); | 1514 EXPECT_FALSE(updater.WillCheckSoon()); |
1489 updater.Start(); | 1515 updater.Start(); |
1490 EXPECT_FALSE(updater.WillCheckSoon()); | 1516 EXPECT_FALSE(updater.WillCheckSoon()); |
1491 updater.CheckSoon(); | 1517 updater.CheckSoon(); |
1492 EXPECT_TRUE(updater.WillCheckSoon()); | 1518 EXPECT_TRUE(updater.WillCheckSoon()); |
1493 updater.CheckSoon(); | 1519 updater.CheckSoon(); |
(...skipping 10 matching lines...) Expand all Loading... | |
1504 // -prodversionmin (shouldn't update if browser version too old) | 1530 // -prodversionmin (shouldn't update if browser version too old) |
1505 // -manifests & updates arriving out of order / interleaved | 1531 // -manifests & updates arriving out of order / interleaved |
1506 // -malformed update url (empty, file://, has query, has a # fragment, etc.) | 1532 // -malformed update url (empty, file://, has query, has a # fragment, etc.) |
1507 // -An extension gets uninstalled while updates are in progress (so it doesn't | 1533 // -An extension gets uninstalled while updates are in progress (so it doesn't |
1508 // "come back from the dead") | 1534 // "come back from the dead") |
1509 // -An extension gets manually updated to v3 while we're downloading v2 (ie | 1535 // -An extension gets manually updated to v3 while we're downloading v2 (ie |
1510 // you don't get downgraded accidentally) | 1536 // you don't get downgraded accidentally) |
1511 // -An update manifest mentions multiple updates | 1537 // -An update manifest mentions multiple updates |
1512 | 1538 |
1513 } // namespace extensions | 1539 } // namespace extensions |
OLD | NEW |