| 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 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 } | 696 } |
| 697 | 697 |
| 698 void TestUpdateUrlDataEmpty() { | 698 void TestUpdateUrlDataEmpty() { |
| 699 const std::string id = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; | 699 const std::string id = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; |
| 700 const std::string version = "1.0"; | 700 const std::string version = "1.0"; |
| 701 | 701 |
| 702 // Make sure that an empty update URL data string does not cause a ap= | 702 // Make sure that an empty update URL data string does not cause a ap= |
| 703 // option to appear in the x= parameter. | 703 // option to appear in the x= parameter. |
| 704 ManifestFetchData fetch_data(GURL("http://localhost/foo"), 0); | 704 ManifestFetchData fetch_data(GURL("http://localhost/foo"), 0); |
| 705 fetch_data.AddExtension( | 705 fetch_data.AddExtension( |
| 706 id, version, &kNeverPingedData, std::string(), std::string(), false); | 706 id, version, &kNeverPingedData, std::string(), std::string()); |
| 707 | 707 |
| 708 std::map<std::string, std::string> params; | 708 std::map<std::string, std::string> params; |
| 709 VerifyQueryAndExtractParameters(fetch_data.full_url().query(), ¶ms); | 709 VerifyQueryAndExtractParameters(fetch_data.full_url().query(), ¶ms); |
| 710 EXPECT_EQ(id, params["id"]); | 710 EXPECT_EQ(id, params["id"]); |
| 711 EXPECT_EQ(version, params["v"]); | 711 EXPECT_EQ(version, params["v"]); |
| 712 EXPECT_EQ(0U, params.count("ap")); | 712 EXPECT_EQ(0U, params.count("ap")); |
| 713 } | 713 } |
| 714 | 714 |
| 715 void TestUpdateUrlDataSimple() { | 715 void TestUpdateUrlDataSimple() { |
| 716 const std::string id = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; | 716 const std::string id = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; |
| 717 const std::string version = "1.0"; | 717 const std::string version = "1.0"; |
| 718 | 718 |
| 719 // Make sure that an update URL data string causes an appropriate ap= | 719 // Make sure that an update URL data string causes an appropriate ap= |
| 720 // option to appear in the x= parameter. | 720 // option to appear in the x= parameter. |
| 721 ManifestFetchData fetch_data(GURL("http://localhost/foo"), 0); | 721 ManifestFetchData fetch_data(GURL("http://localhost/foo"), 0); |
| 722 fetch_data.AddExtension( | 722 fetch_data.AddExtension( |
| 723 id, version, &kNeverPingedData, "bar", std::string(), false); | 723 id, version, &kNeverPingedData, "bar", std::string()); |
| 724 std::map<std::string, std::string> params; | 724 std::map<std::string, std::string> params; |
| 725 VerifyQueryAndExtractParameters(fetch_data.full_url().query(), ¶ms); | 725 VerifyQueryAndExtractParameters(fetch_data.full_url().query(), ¶ms); |
| 726 EXPECT_EQ(id, params["id"]); | 726 EXPECT_EQ(id, params["id"]); |
| 727 EXPECT_EQ(version, params["v"]); | 727 EXPECT_EQ(version, params["v"]); |
| 728 EXPECT_EQ("bar", params["ap"]); | 728 EXPECT_EQ("bar", params["ap"]); |
| 729 } | 729 } |
| 730 | 730 |
| 731 void TestUpdateUrlDataCompound() { | 731 void TestUpdateUrlDataCompound() { |
| 732 const std::string id = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; | 732 const std::string id = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; |
| 733 const std::string version = "1.0"; | 733 const std::string version = "1.0"; |
| 734 | 734 |
| 735 // Make sure that an update URL data string causes an appropriate ap= | 735 // Make sure that an update URL data string causes an appropriate ap= |
| 736 // option to appear in the x= parameter. | 736 // option to appear in the x= parameter. |
| 737 ManifestFetchData fetch_data(GURL("http://localhost/foo"), 0); | 737 ManifestFetchData fetch_data(GURL("http://localhost/foo"), 0); |
| 738 fetch_data.AddExtension( | 738 fetch_data.AddExtension( |
| 739 id, version, &kNeverPingedData, "a=1&b=2&c", std::string(), false); | 739 id, version, &kNeverPingedData, "a=1&b=2&c", std::string()); |
| 740 std::map<std::string, std::string> params; | 740 std::map<std::string, std::string> params; |
| 741 VerifyQueryAndExtractParameters(fetch_data.full_url().query(), ¶ms); | 741 VerifyQueryAndExtractParameters(fetch_data.full_url().query(), ¶ms); |
| 742 EXPECT_EQ(id, params["id"]); | 742 EXPECT_EQ(id, params["id"]); |
| 743 EXPECT_EQ(version, params["v"]); | 743 EXPECT_EQ(version, params["v"]); |
| 744 EXPECT_EQ("a%3D1%26b%3D2%26c", params["ap"]); | 744 EXPECT_EQ("a%3D1%26b%3D2%26c", params["ap"]); |
| 745 } | 745 } |
| 746 | 746 |
| 747 void TestUpdateUrlDataFromGallery(const std::string& gallery_url) { | 747 void TestUpdateUrlDataFromGallery(const std::string& gallery_url) { |
| 748 net::TestURLFetcherFactory factory; | 748 net::TestURLFetcherFactory factory; |
| 749 | 749 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 773 } | 773 } |
| 774 | 774 |
| 775 void TestInstallSource() { | 775 void TestInstallSource() { |
| 776 const std::string id = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; | 776 const std::string id = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; |
| 777 const std::string version = "1.0"; | 777 const std::string version = "1.0"; |
| 778 const std::string install_source = "instally"; | 778 const std::string install_source = "instally"; |
| 779 | 779 |
| 780 // Make sure that an installsource= appears in the x= parameter. | 780 // Make sure that an installsource= appears in the x= parameter. |
| 781 ManifestFetchData fetch_data(GURL("http://localhost/foo"), 0); | 781 ManifestFetchData fetch_data(GURL("http://localhost/foo"), 0); |
| 782 fetch_data.AddExtension(id, version, &kNeverPingedData, | 782 fetch_data.AddExtension(id, version, &kNeverPingedData, |
| 783 kEmptyUpdateUrlData, install_source, false); | 783 kEmptyUpdateUrlData, install_source); |
| 784 std::map<std::string, std::string> params; | 784 std::map<std::string, std::string> params; |
| 785 VerifyQueryAndExtractParameters(fetch_data.full_url().query(), ¶ms); | 785 VerifyQueryAndExtractParameters(fetch_data.full_url().query(), ¶ms); |
| 786 EXPECT_EQ(id, params["id"]); | 786 EXPECT_EQ(id, params["id"]); |
| 787 EXPECT_EQ(version, params["v"]); | 787 EXPECT_EQ(version, params["v"]); |
| 788 EXPECT_EQ(install_source, params["installsource"]); | 788 EXPECT_EQ(install_source, params["installsource"]); |
| 789 } | 789 } |
| 790 | 790 |
| 791 void TestDetermineUpdates() { | 791 void TestDetermineUpdates() { |
| 792 TestingProfile profile; | 792 TestingProfile profile; |
| 793 MockExtensionDownloaderDelegate delegate; | 793 MockExtensionDownloaderDelegate delegate; |
| 794 ExtensionDownloader downloader(&delegate, profile.GetRequestContext()); | 794 ExtensionDownloader downloader(&delegate, profile.GetRequestContext()); |
| 795 | 795 |
| 796 // Check passing an empty list of parse results to DetermineUpdates | 796 // Check passing an empty list of parse results to DetermineUpdates |
| 797 ManifestFetchData fetch_data(GURL("http://localhost/foo"), 0); | 797 ManifestFetchData fetch_data(GURL("http://localhost/foo"), 0); |
| 798 UpdateManifest::Results updates; | 798 UpdateManifest::Results updates; |
| 799 std::vector<int> updateable; | 799 std::vector<int> updateable; |
| 800 downloader.DetermineUpdates(fetch_data, updates, &updateable); | 800 downloader.DetermineUpdates(fetch_data, updates, &updateable); |
| 801 EXPECT_TRUE(updateable.empty()); | 801 EXPECT_TRUE(updateable.empty()); |
| 802 | 802 |
| 803 // Create two updates - expect that DetermineUpdates will return the first | 803 // Create two updates - expect that DetermineUpdates will return the first |
| 804 // one (v1.0 installed, v1.1 available) but not the second one (both | 804 // one (v1.0 installed, v1.1 available) but not the second one (both |
| 805 // installed and available at v2.0). | 805 // installed and available at v2.0). |
| 806 const std::string id1 = crx_file::id_util::GenerateId("1"); | 806 const std::string id1 = crx_file::id_util::GenerateId("1"); |
| 807 const std::string id2 = crx_file::id_util::GenerateId("2"); | 807 const std::string id2 = crx_file::id_util::GenerateId("2"); |
| 808 fetch_data.AddExtension( | 808 fetch_data.AddExtension( |
| 809 id1, "1.0.0.0", &kNeverPingedData, kEmptyUpdateUrlData, std::string(), | 809 id1, "1.0.0.0", &kNeverPingedData, kEmptyUpdateUrlData, std::string()); |
| 810 false); | |
| 811 AddParseResult(id1, "1.1", "http://localhost/e1_1.1.crx", &updates); | 810 AddParseResult(id1, "1.1", "http://localhost/e1_1.1.crx", &updates); |
| 812 fetch_data.AddExtension( | 811 fetch_data.AddExtension( |
| 813 id2, "2.0.0.0", &kNeverPingedData, kEmptyUpdateUrlData, std::string(), | 812 id2, "2.0.0.0", &kNeverPingedData, kEmptyUpdateUrlData, std::string()); |
| 814 false); | |
| 815 AddParseResult(id2, "2.0.0.0", "http://localhost/e2_2.0.crx", &updates); | 813 AddParseResult(id2, "2.0.0.0", "http://localhost/e2_2.0.crx", &updates); |
| 816 | 814 |
| 817 EXPECT_CALL(delegate, IsExtensionPending(_)).WillRepeatedly(Return(false)); | 815 EXPECT_CALL(delegate, IsExtensionPending(_)).WillRepeatedly(Return(false)); |
| 818 EXPECT_CALL(delegate, GetExtensionExistingVersion(id1, _)) | 816 EXPECT_CALL(delegate, GetExtensionExistingVersion(id1, _)) |
| 819 .WillOnce(DoAll(SetArgPointee<1>("1.0.0.0"), | 817 .WillOnce(DoAll(SetArgPointee<1>("1.0.0.0"), |
| 820 Return(true))); | 818 Return(true))); |
| 821 EXPECT_CALL(delegate, GetExtensionExistingVersion(id2, _)) | 819 EXPECT_CALL(delegate, GetExtensionExistingVersion(id2, _)) |
| 822 .WillOnce(DoAll(SetArgPointee<1>("2.0.0.0"), | 820 .WillOnce(DoAll(SetArgPointee<1>("2.0.0.0"), |
| 823 Return(true))); | 821 Return(true))); |
| 824 | 822 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 845 pending_extension_manager->GetPendingIdsForUpdateCheck( | 843 pending_extension_manager->GetPendingIdsForUpdateCheck( |
| 846 &ids_for_update_check); | 844 &ids_for_update_check); |
| 847 | 845 |
| 848 std::list<std::string>::const_iterator it; | 846 std::list<std::string>::const_iterator it; |
| 849 for (it = ids_for_update_check.begin(); | 847 for (it = ids_for_update_check.begin(); |
| 850 it != ids_for_update_check.end(); ++it) { | 848 it != ids_for_update_check.end(); ++it) { |
| 851 fetch_data.AddExtension(*it, | 849 fetch_data.AddExtension(*it, |
| 852 "1.0.0.0", | 850 "1.0.0.0", |
| 853 &kNeverPingedData, | 851 &kNeverPingedData, |
| 854 kEmptyUpdateUrlData, | 852 kEmptyUpdateUrlData, |
| 855 std::string(), | 853 std::string()); |
| 856 false); | |
| 857 AddParseResult(*it, "1.1", "http://localhost/e1_1.1.crx", &updates); | 854 AddParseResult(*it, "1.1", "http://localhost/e1_1.1.crx", &updates); |
| 858 } | 855 } |
| 859 | 856 |
| 860 // The delegate will tell the downloader that all the extensions are | 857 // The delegate will tell the downloader that all the extensions are |
| 861 // pending. | 858 // pending. |
| 862 EXPECT_CALL(delegate, IsExtensionPending(_)).WillRepeatedly(Return(true)); | 859 EXPECT_CALL(delegate, IsExtensionPending(_)).WillRepeatedly(Return(true)); |
| 863 | 860 |
| 864 std::vector<int> updateable; | 861 std::vector<int> updateable; |
| 865 downloader.DetermineUpdates(fetch_data, updates, &updateable); | 862 downloader.DetermineUpdates(fetch_data, updates, &updateable); |
| 866 // All the apps should be updateable. | 863 // All the apps should be updateable. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 880 downloader.manifests_queue_.set_backoff_policy(&kNoBackoffPolicy); | 877 downloader.manifests_queue_.set_backoff_policy(&kNoBackoffPolicy); |
| 881 | 878 |
| 882 GURL kUpdateUrl("http://localhost/manifest1"); | 879 GURL kUpdateUrl("http://localhost/manifest1"); |
| 883 | 880 |
| 884 scoped_ptr<ManifestFetchData> fetch1(new ManifestFetchData(kUpdateUrl, 0)); | 881 scoped_ptr<ManifestFetchData> fetch1(new ManifestFetchData(kUpdateUrl, 0)); |
| 885 scoped_ptr<ManifestFetchData> fetch2(new ManifestFetchData(kUpdateUrl, 0)); | 882 scoped_ptr<ManifestFetchData> fetch2(new ManifestFetchData(kUpdateUrl, 0)); |
| 886 scoped_ptr<ManifestFetchData> fetch3(new ManifestFetchData(kUpdateUrl, 0)); | 883 scoped_ptr<ManifestFetchData> fetch3(new ManifestFetchData(kUpdateUrl, 0)); |
| 887 scoped_ptr<ManifestFetchData> fetch4(new ManifestFetchData(kUpdateUrl, 0)); | 884 scoped_ptr<ManifestFetchData> fetch4(new ManifestFetchData(kUpdateUrl, 0)); |
| 888 ManifestFetchData::PingData zeroDays(0, 0, true); | 885 ManifestFetchData::PingData zeroDays(0, 0, true); |
| 889 fetch1->AddExtension( | 886 fetch1->AddExtension( |
| 890 "1111", "1.0", &zeroDays, kEmptyUpdateUrlData, std::string(), false); | 887 "1111", "1.0", &zeroDays, kEmptyUpdateUrlData, std::string()); |
| 891 fetch2->AddExtension( | 888 fetch2->AddExtension( |
| 892 "2222", "2.0", &zeroDays, kEmptyUpdateUrlData, std::string(), false); | 889 "2222", "2.0", &zeroDays, kEmptyUpdateUrlData, std::string()); |
| 893 fetch3->AddExtension( | 890 fetch3->AddExtension( |
| 894 "3333", "3.0", &zeroDays, kEmptyUpdateUrlData, std::string(), false); | 891 "3333", "3.0", &zeroDays, kEmptyUpdateUrlData, std::string()); |
| 895 fetch4->AddExtension( | 892 fetch4->AddExtension( |
| 896 "4444", "4.0", &zeroDays, kEmptyUpdateUrlData, std::string(), false); | 893 "4444", "4.0", &zeroDays, kEmptyUpdateUrlData, std::string()); |
| 897 | 894 |
| 898 // This will start the first fetcher and queue the others. The next in queue | 895 // This will start the first fetcher and queue the others. The next in queue |
| 899 // is started as each fetcher receives its response. Note that the fetchers | 896 // is started as each fetcher receives its response. Note that the fetchers |
| 900 // don't necessarily run in the order that they are started from here. | 897 // don't necessarily run in the order that they are started from here. |
| 901 GURL fetch1_url = fetch1->full_url(); | 898 GURL fetch1_url = fetch1->full_url(); |
| 902 GURL fetch2_url = fetch2->full_url(); | 899 GURL fetch2_url = fetch2->full_url(); |
| 903 GURL fetch3_url = fetch3->full_url(); | 900 GURL fetch3_url = fetch3->full_url(); |
| 904 GURL fetch4_url = fetch4->full_url(); | 901 GURL fetch4_url = fetch4->full_url(); |
| 905 downloader.StartUpdateCheck(fetch1.Pass()); | 902 downloader.StartUpdateCheck(fetch1.Pass()); |
| 906 downloader.StartUpdateCheck(fetch2.Pass()); | 903 downloader.StartUpdateCheck(fetch2.Pass()); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 MockService service(prefs_.get()); | 1014 MockService service(prefs_.get()); |
| 1018 MockExtensionDownloaderDelegate delegate; | 1015 MockExtensionDownloaderDelegate delegate; |
| 1019 ExtensionDownloader downloader(&delegate, service.request_context()); | 1016 ExtensionDownloader downloader(&delegate, service.request_context()); |
| 1020 downloader.manifests_queue_.set_backoff_policy(&kNoBackoffPolicy); | 1017 downloader.manifests_queue_.set_backoff_policy(&kNoBackoffPolicy); |
| 1021 | 1018 |
| 1022 GURL kUpdateUrl("http://localhost/manifest1"); | 1019 GURL kUpdateUrl("http://localhost/manifest1"); |
| 1023 | 1020 |
| 1024 scoped_ptr<ManifestFetchData> fetch(new ManifestFetchData(kUpdateUrl, 0)); | 1021 scoped_ptr<ManifestFetchData> fetch(new ManifestFetchData(kUpdateUrl, 0)); |
| 1025 ManifestFetchData::PingData zeroDays(0, 0, true); | 1022 ManifestFetchData::PingData zeroDays(0, 0, true); |
| 1026 fetch->AddExtension( | 1023 fetch->AddExtension( |
| 1027 "1111", "1.0", &zeroDays, kEmptyUpdateUrlData, std::string(), false); | 1024 "1111", "1.0", &zeroDays, kEmptyUpdateUrlData, std::string()); |
| 1028 | 1025 |
| 1029 // This will start the first fetcher. | 1026 // This will start the first fetcher. |
| 1030 downloader.StartUpdateCheck(fetch.Pass()); | 1027 downloader.StartUpdateCheck(fetch.Pass()); |
| 1031 RunUntilIdle(); | 1028 RunUntilIdle(); |
| 1032 | 1029 |
| 1033 // ExtensionDownloader should retry kMaxRetries times and then fail. | 1030 // ExtensionDownloader should retry kMaxRetries times and then fail. |
| 1034 EXPECT_CALL(delegate, OnExtensionDownloadFailed( | 1031 EXPECT_CALL(delegate, OnExtensionDownloadFailed( |
| 1035 "1111", ExtensionDownloaderDelegate::MANIFEST_FETCH_FAILED, _, _)); | 1032 "1111", ExtensionDownloaderDelegate::MANIFEST_FETCH_FAILED, _, _)); |
| 1036 for (int i = 0; i <= ExtensionDownloader::kMaxRetries; ++i) { | 1033 for (int i = 0; i <= ExtensionDownloader::kMaxRetries; ++i) { |
| 1037 // All fetches will fail. | 1034 // All fetches will fail. |
| 1038 fetcher = factory.GetFetcherByID(ExtensionDownloader::kManifestFetcherId); | 1035 fetcher = factory.GetFetcherByID(ExtensionDownloader::kManifestFetcherId); |
| 1039 EXPECT_TRUE(fetcher != NULL && fetcher->delegate() != NULL); | 1036 EXPECT_TRUE(fetcher != NULL && fetcher->delegate() != NULL); |
| 1040 EXPECT_TRUE(fetcher->GetLoadFlags() == kExpectedLoadFlags); | 1037 EXPECT_TRUE(fetcher->GetLoadFlags() == kExpectedLoadFlags); |
| 1041 fetcher->set_url(kUpdateUrl); | 1038 fetcher->set_url(kUpdateUrl); |
| 1042 fetcher->set_status(net::URLRequestStatus()); | 1039 fetcher->set_status(net::URLRequestStatus()); |
| 1043 // Code 5xx causes ExtensionDownloader to retry. | 1040 // Code 5xx causes ExtensionDownloader to retry. |
| 1044 fetcher->set_response_code(500); | 1041 fetcher->set_response_code(500); |
| 1045 fetcher->delegate()->OnURLFetchComplete(fetcher); | 1042 fetcher->delegate()->OnURLFetchComplete(fetcher); |
| 1046 RunUntilIdle(); | 1043 RunUntilIdle(); |
| 1047 } | 1044 } |
| 1048 Mock::VerifyAndClearExpectations(&delegate); | 1045 Mock::VerifyAndClearExpectations(&delegate); |
| 1049 | 1046 |
| 1050 | 1047 |
| 1051 // For response codes that are not in the 5xx range ExtensionDownloader | 1048 // For response codes that are not in the 5xx range ExtensionDownloader |
| 1052 // should not retry. | 1049 // should not retry. |
| 1053 fetch.reset(new ManifestFetchData(kUpdateUrl, 0)); | 1050 fetch.reset(new ManifestFetchData(kUpdateUrl, 0)); |
| 1054 fetch->AddExtension( | 1051 fetch->AddExtension( |
| 1055 "1111", "1.0", &zeroDays, kEmptyUpdateUrlData, std::string(), false); | 1052 "1111", "1.0", &zeroDays, kEmptyUpdateUrlData, std::string()); |
| 1056 | 1053 |
| 1057 // This will start the first fetcher. | 1054 // This will start the first fetcher. |
| 1058 downloader.StartUpdateCheck(fetch.Pass()); | 1055 downloader.StartUpdateCheck(fetch.Pass()); |
| 1059 RunUntilIdle(); | 1056 RunUntilIdle(); |
| 1060 | 1057 |
| 1061 EXPECT_CALL(delegate, OnExtensionDownloadFailed( | 1058 EXPECT_CALL(delegate, OnExtensionDownloadFailed( |
| 1062 "1111", ExtensionDownloaderDelegate::MANIFEST_FETCH_FAILED, _, _)); | 1059 "1111", ExtensionDownloaderDelegate::MANIFEST_FETCH_FAILED, _, _)); |
| 1063 // The first fetch will fail, and require retrying. | 1060 // The first fetch will fail, and require retrying. |
| 1064 fetcher = factory.GetFetcherByID(ExtensionDownloader::kManifestFetcherId); | 1061 fetcher = factory.GetFetcherByID(ExtensionDownloader::kManifestFetcherId); |
| 1065 EXPECT_TRUE(fetcher != NULL && fetcher->delegate() != NULL); | 1062 EXPECT_TRUE(fetcher != NULL && fetcher->delegate() != NULL); |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1703 service.GetDownloaderFactory()); | 1700 service.GetDownloaderFactory()); |
| 1704 updater.Start(); | 1701 updater.Start(); |
| 1705 updater.EnsureDownloaderCreated(); | 1702 updater.EnsureDownloaderCreated(); |
| 1706 | 1703 |
| 1707 ManifestFetchData fetch_data(update_url, 0); | 1704 ManifestFetchData fetch_data(update_url, 0); |
| 1708 const Extension* extension = tmp[0].get(); | 1705 const Extension* extension = tmp[0].get(); |
| 1709 fetch_data.AddExtension(extension->id(), | 1706 fetch_data.AddExtension(extension->id(), |
| 1710 extension->VersionString(), | 1707 extension->VersionString(), |
| 1711 &kNeverPingedData, | 1708 &kNeverPingedData, |
| 1712 kEmptyUpdateUrlData, | 1709 kEmptyUpdateUrlData, |
| 1713 std::string(), | 1710 std::string()); |
| 1714 false); | |
| 1715 UpdateManifest::Results results; | 1711 UpdateManifest::Results results; |
| 1716 results.daystart_elapsed_seconds = 750; | 1712 results.daystart_elapsed_seconds = 750; |
| 1717 | 1713 |
| 1718 updater.downloader_->HandleManifestResults(fetch_data, &results); | 1714 updater.downloader_->HandleManifestResults(fetch_data, &results); |
| 1719 Time last_ping_day = | 1715 Time last_ping_day = |
| 1720 service.extension_prefs()->LastPingDay(extension->id()); | 1716 service.extension_prefs()->LastPingDay(extension->id()); |
| 1721 EXPECT_FALSE(last_ping_day.is_null()); | 1717 EXPECT_FALSE(last_ping_day.is_null()); |
| 1722 int64 seconds_diff = (Time::Now() - last_ping_day).InSeconds(); | 1718 int64 seconds_diff = (Time::Now() - last_ping_day).InSeconds(); |
| 1723 EXPECT_LT(seconds_diff - results.daystart_elapsed_seconds, 5); | 1719 EXPECT_LT(seconds_diff - results.daystart_elapsed_seconds, 5); |
| 1724 } | 1720 } |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2046 // -prodversionmin (shouldn't update if browser version too old) | 2042 // -prodversionmin (shouldn't update if browser version too old) |
| 2047 // -manifests & updates arriving out of order / interleaved | 2043 // -manifests & updates arriving out of order / interleaved |
| 2048 // -malformed update url (empty, file://, has query, has a # fragment, etc.) | 2044 // -malformed update url (empty, file://, has query, has a # fragment, etc.) |
| 2049 // -An extension gets uninstalled while updates are in progress (so it doesn't | 2045 // -An extension gets uninstalled while updates are in progress (so it doesn't |
| 2050 // "come back from the dead") | 2046 // "come back from the dead") |
| 2051 // -An extension gets manually updated to v3 while we're downloading v2 (ie | 2047 // -An extension gets manually updated to v3 while we're downloading v2 (ie |
| 2052 // you don't get downgraded accidentally) | 2048 // you don't get downgraded accidentally) |
| 2053 // -An update manifest mentions multiple updates | 2049 // -An update manifest mentions multiple updates |
| 2054 | 2050 |
| 2055 } // namespace extensions | 2051 } // namespace extensions |
| OLD | NEW |