OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <map> | 5 #include <map> |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
9 #include "base/stl_util-inl.h" | 9 #include "base/stl_util-inl.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
11 #include "base/thread.h" | 11 #include "base/thread.h" |
12 #include "chrome/browser/chrome_thread.h" | 12 #include "chrome/browser/chrome_thread.h" |
13 #include "chrome/browser/extensions/extension_updater.h" | 13 #include "chrome/browser/extensions/extension_updater.h" |
14 #include "chrome/browser/extensions/extensions_service.h" | 14 #include "chrome/browser/extensions/extensions_service.h" |
15 #include "chrome/browser/net/test_url_fetcher_factory.h" | 15 #include "chrome/browser/net/test_url_fetcher_factory.h" |
16 #include "chrome/common/extensions/extension.h" | 16 #include "chrome/common/extensions/extension.h" |
17 #include "chrome/common/extensions/extension_constants.h" | 17 #include "chrome/common/extensions/extension_constants.h" |
18 #include "chrome/common/extensions/extension_error_reporter.h" | 18 #include "chrome/common/extensions/extension_error_reporter.h" |
19 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
20 #include "chrome/common/pref_service.h" | 20 #include "chrome/common/pref_service.h" |
21 #include "net/base/escape.h" | 21 #include "net/base/escape.h" |
22 #include "net/base/load_flags.h" | 22 #include "net/base/load_flags.h" |
23 #include "net/url_request/url_request_status.h" | 23 #include "net/url_request/url_request_status.h" |
24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
25 #include "libxml/globals.h" | 25 #include "libxml/globals.h" |
26 | 26 |
| 27 #if defined(OS_MACOSX) |
| 28 // These tests crash frequently on Mac 10.5 Tests debug. http://crbug.com/26035. |
| 29 #define MAYBE_TestBlacklistDownloading DISABLED_TestBlacklistDownloading |
| 30 #define MAYBE_TestBlacklistUpdateCheckRequests DISABLED_TestBlacklistUpdateCheck
Requests |
| 31 #else |
| 32 #define MAYBE_TestBlacklistDownloading TestBlacklistDownloading |
| 33 #define MAYBE_TestBlacklistUpdateCheckRequests TestBlacklistUpdateCheckRequests |
| 34 #endif |
| 35 |
27 static int expected_load_flags = | 36 static int expected_load_flags = |
28 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES; | 37 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES; |
29 | 38 |
30 // Do-nothing base class for further specialized test classes. | 39 // Do-nothing base class for further specialized test classes. |
31 class MockService : public ExtensionUpdateService { | 40 class MockService : public ExtensionUpdateService { |
32 public: | 41 public: |
33 MockService() {} | 42 MockService() {} |
34 virtual ~MockService() {} | 43 virtual ~MockService() {} |
35 | 44 |
36 virtual const ExtensionList* extensions() const { | 45 virtual const ExtensionList* extensions() const { |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 }; | 590 }; |
582 | 591 |
583 // Because we test some private methods of ExtensionUpdater, it's easer for the | 592 // Because we test some private methods of ExtensionUpdater, it's easer for the |
584 // actual test code to live in ExtenionUpdaterTest methods instead of TEST_F | 593 // actual test code to live in ExtenionUpdaterTest methods instead of TEST_F |
585 // subclasses where friendship with ExtenionUpdater is not inherited. | 594 // subclasses where friendship with ExtenionUpdater is not inherited. |
586 | 595 |
587 TEST(ExtensionUpdaterTest, TestExtensionUpdateCheckRequests) { | 596 TEST(ExtensionUpdaterTest, TestExtensionUpdateCheckRequests) { |
588 ExtensionUpdaterTest::TestExtensionUpdateCheckRequests(); | 597 ExtensionUpdaterTest::TestExtensionUpdateCheckRequests(); |
589 } | 598 } |
590 | 599 |
591 // This test is disabled, see bug 26035 | 600 // This test is disabled on Mac, see http://crbug.com/26035. |
592 TEST(ExtensionUpdaterTest, DISABLED_TestBlacklistUpdateCheckRequests) { | 601 TEST(ExtensionUpdaterTest, MAYBE_TestBlacklistUpdateCheckRequests) { |
593 ExtensionUpdaterTest::TestBlacklistUpdateCheckRequests(); | 602 ExtensionUpdaterTest::TestBlacklistUpdateCheckRequests(); |
594 } | 603 } |
595 | 604 |
596 TEST(ExtensionUpdaterTest, TestDetermineUpdates) { | 605 TEST(ExtensionUpdaterTest, TestDetermineUpdates) { |
597 ExtensionUpdaterTest::TestDetermineUpdates(); | 606 ExtensionUpdaterTest::TestDetermineUpdates(); |
598 } | 607 } |
599 | 608 |
600 TEST(ExtensionUpdaterTest, TestMultipleManifestDownloading) { | 609 TEST(ExtensionUpdaterTest, TestMultipleManifestDownloading) { |
601 ExtensionUpdaterTest::TestMultipleManifestDownloading(); | 610 ExtensionUpdaterTest::TestMultipleManifestDownloading(); |
602 } | 611 } |
603 | 612 |
604 TEST(ExtensionUpdaterTest, TestSingleExtensionDownloading) { | 613 TEST(ExtensionUpdaterTest, TestSingleExtensionDownloading) { |
605 ExtensionUpdaterTest::TestSingleExtensionDownloading(); | 614 ExtensionUpdaterTest::TestSingleExtensionDownloading(); |
606 } | 615 } |
607 | 616 |
608 // This test is disabled, see bug 26035 | 617 // This test is disabled on Mac, see http://crbug.com/26035. |
609 TEST(ExtensionUpdaterTest, DISABLED_TestBlacklistDownloading) { | 618 TEST(ExtensionUpdaterTest, MAYBE_TestBlacklistDownloading) { |
610 ExtensionUpdaterTest::TestBlacklistDownloading(); | 619 ExtensionUpdaterTest::TestBlacklistDownloading(); |
611 } | 620 } |
612 | 621 |
613 TEST(ExtensionUpdaterTest, TestMultipleExtensionDownloading) { | 622 TEST(ExtensionUpdaterTest, TestMultipleExtensionDownloading) { |
614 ExtensionUpdaterTest::TestMultipleExtensionDownloading(); | 623 ExtensionUpdaterTest::TestMultipleExtensionDownloading(); |
615 } | 624 } |
616 | 625 |
617 | 626 |
618 // TODO(asargent) - (http://crbug.com/12780) add tests for: | 627 // TODO(asargent) - (http://crbug.com/12780) add tests for: |
619 // -prodversionmin (shouldn't update if browser version too old) | 628 // -prodversionmin (shouldn't update if browser version too old) |
620 // -manifests & updates arriving out of order / interleaved | 629 // -manifests & updates arriving out of order / interleaved |
621 // -Profile::GetDefaultRequestContext() returning null | 630 // -Profile::GetDefaultRequestContext() returning null |
622 // (should not crash, but just do check later) | 631 // (should not crash, but just do check later) |
623 // -malformed update url (empty, file://, has query, has a # fragment, etc.) | 632 // -malformed update url (empty, file://, has query, has a # fragment, etc.) |
624 // -An extension gets uninstalled while updates are in progress (so it doesn't | 633 // -An extension gets uninstalled while updates are in progress (so it doesn't |
625 // "come back from the dead") | 634 // "come back from the dead") |
626 // -An extension gets manually updated to v3 while we're downloading v2 (ie | 635 // -An extension gets manually updated to v3 while we're downloading v2 (ie |
627 // you don't get downgraded accidentally) | 636 // you don't get downgraded accidentally) |
628 // -An update manifest mentions multiple updates | 637 // -An update manifest mentions multiple updates |
OLD | NEW |