| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 | 567 |
| 568 void SetNewJobFactory(net::URLRequestJobFactory* job_factory) { | 568 void SetNewJobFactory(net::URLRequestJobFactory* job_factory) { |
| 569 DCHECK(job_factory); | 569 DCHECK(job_factory); |
| 570 job_factory_.reset(job_factory); | 570 job_factory_.reset(job_factory); |
| 571 request_context_->set_job_factory(job_factory_.get()); | 571 request_context_->set_job_factory(job_factory_.get()); |
| 572 } | 572 } |
| 573 | 573 |
| 574 void Init() override { | 574 void Init() override { |
| 575 scoped_ptr<net::URLRequestJobFactoryImpl> factory( | 575 scoped_ptr<net::URLRequestJobFactoryImpl> factory( |
| 576 new net::URLRequestJobFactoryImpl()); | 576 new net::URLRequestJobFactoryImpl()); |
| 577 factory->SetProtocolHandler("http", new MockHttpServerJobFactory); | 577 factory->SetProtocolHandler("http", |
| 578 factory->SetProtocolHandler("https", new MockHttpServerJobFactory); | 578 make_scoped_ptr(new MockHttpServerJobFactory)); |
| 579 factory->SetProtocolHandler("https", |
| 580 make_scoped_ptr(new MockHttpServerJobFactory)); |
| 579 job_factory_ = factory.Pass(); | 581 job_factory_ = factory.Pass(); |
| 580 request_context_.reset(new net::TestURLRequestContext()); | 582 request_context_.reset(new net::TestURLRequestContext()); |
| 581 request_context_->set_job_factory(job_factory_.get()); | 583 request_context_->set_job_factory(job_factory_.get()); |
| 582 } | 584 } |
| 583 | 585 |
| 584 void CleanUp() override { | 586 void CleanUp() override { |
| 585 request_context_.reset(); | 587 request_context_.reset(); |
| 586 job_factory_.reset(); | 588 job_factory_.reset(); |
| 587 } | 589 } |
| 588 | 590 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 frontend2->AddExpectedEvent(ids2, APPCACHE_ERROR_EVENT); | 791 frontend2->AddExpectedEvent(ids2, APPCACHE_ERROR_EVENT); |
| 790 | 792 |
| 791 WaitForUpdateToFinish(); | 793 WaitForUpdateToFinish(); |
| 792 } | 794 } |
| 793 | 795 |
| 794 void ManifestRedirectTest() { | 796 void ManifestRedirectTest() { |
| 795 ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); | 797 ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); |
| 796 | 798 |
| 797 net::URLRequestJobFactoryImpl* new_factory( | 799 net::URLRequestJobFactoryImpl* new_factory( |
| 798 new net::URLRequestJobFactoryImpl); | 800 new net::URLRequestJobFactoryImpl); |
| 799 new_factory->SetProtocolHandler("http", new RedirectFactory); | 801 new_factory->SetProtocolHandler("http", |
| 802 make_scoped_ptr(new RedirectFactory)); |
| 800 io_thread_->SetNewJobFactory(new_factory); | 803 io_thread_->SetNewJobFactory(new_factory); |
| 801 | 804 |
| 802 MakeService(); | 805 MakeService(); |
| 803 group_ = new AppCacheGroup(service_->storage(), GURL("http://testme"), | 806 group_ = new AppCacheGroup(service_->storage(), GURL("http://testme"), |
| 804 service_->storage()->NewGroupId()); | 807 service_->storage()->NewGroupId()); |
| 805 AppCacheUpdateJob* update = | 808 AppCacheUpdateJob* update = |
| 806 new AppCacheUpdateJob(service_.get(), group_.get()); | 809 new AppCacheUpdateJob(service_.get(), group_.get()); |
| 807 group_->update_job_ = update; | 810 group_->update_job_ = update; |
| 808 | 811 |
| 809 MockFrontend* frontend = MakeMockFrontend(); | 812 MockFrontend* frontend = MakeMockFrontend(); |
| (...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1675 } | 1678 } |
| 1676 | 1679 |
| 1677 void RetryRequestTest() { | 1680 void RetryRequestTest() { |
| 1678 ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); | 1681 ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); |
| 1679 | 1682 |
| 1680 // Set some large number of times to return retry. | 1683 // Set some large number of times to return retry. |
| 1681 // Expect 1 manifest fetch and 3 retries. | 1684 // Expect 1 manifest fetch and 3 retries. |
| 1682 RetryRequestTestJob::Initialize(5, RetryRequestTestJob::RETRY_AFTER_0, 4); | 1685 RetryRequestTestJob::Initialize(5, RetryRequestTestJob::RETRY_AFTER_0, 4); |
| 1683 net::URLRequestJobFactoryImpl* new_factory( | 1686 net::URLRequestJobFactoryImpl* new_factory( |
| 1684 new net::URLRequestJobFactoryImpl); | 1687 new net::URLRequestJobFactoryImpl); |
| 1685 new_factory->SetProtocolHandler("http", new RetryRequestTestJobFactory); | 1688 new_factory->SetProtocolHandler( |
| 1689 "http", make_scoped_ptr(new RetryRequestTestJobFactory)); |
| 1686 io_thread_->SetNewJobFactory(new_factory); | 1690 io_thread_->SetNewJobFactory(new_factory); |
| 1687 | 1691 |
| 1688 MakeService(); | 1692 MakeService(); |
| 1689 group_ = new AppCacheGroup(service_->storage(), | 1693 group_ = new AppCacheGroup(service_->storage(), |
| 1690 RetryRequestTestJob::kRetryUrl, | 1694 RetryRequestTestJob::kRetryUrl, |
| 1691 service_->storage()->NewGroupId()); | 1695 service_->storage()->NewGroupId()); |
| 1692 AppCacheUpdateJob* update = | 1696 AppCacheUpdateJob* update = |
| 1693 new AppCacheUpdateJob(service_.get(), group_.get()); | 1697 new AppCacheUpdateJob(service_.get(), group_.get()); |
| 1694 group_->update_job_ = update; | 1698 group_->update_job_ = update; |
| 1695 | 1699 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1708 } | 1712 } |
| 1709 | 1713 |
| 1710 void RetryNoRetryAfterTest() { | 1714 void RetryNoRetryAfterTest() { |
| 1711 ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); | 1715 ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); |
| 1712 | 1716 |
| 1713 // Set some large number of times to return retry. | 1717 // Set some large number of times to return retry. |
| 1714 // Expect 1 manifest fetch and 0 retries. | 1718 // Expect 1 manifest fetch and 0 retries. |
| 1715 RetryRequestTestJob::Initialize(5, RetryRequestTestJob::NO_RETRY_AFTER, 1); | 1719 RetryRequestTestJob::Initialize(5, RetryRequestTestJob::NO_RETRY_AFTER, 1); |
| 1716 net::URLRequestJobFactoryImpl* new_factory( | 1720 net::URLRequestJobFactoryImpl* new_factory( |
| 1717 new net::URLRequestJobFactoryImpl); | 1721 new net::URLRequestJobFactoryImpl); |
| 1718 new_factory->SetProtocolHandler("http", new RetryRequestTestJobFactory); | 1722 new_factory->SetProtocolHandler( |
| 1723 "http", make_scoped_ptr(new RetryRequestTestJobFactory)); |
| 1719 io_thread_->SetNewJobFactory(new_factory); | 1724 io_thread_->SetNewJobFactory(new_factory); |
| 1720 | 1725 |
| 1721 MakeService(); | 1726 MakeService(); |
| 1722 group_ = new AppCacheGroup(service_->storage(), | 1727 group_ = new AppCacheGroup(service_->storage(), |
| 1723 RetryRequestTestJob::kRetryUrl, | 1728 RetryRequestTestJob::kRetryUrl, |
| 1724 service_->storage()->NewGroupId()); | 1729 service_->storage()->NewGroupId()); |
| 1725 AppCacheUpdateJob* update = | 1730 AppCacheUpdateJob* update = |
| 1726 new AppCacheUpdateJob(service_.get(), group_.get()); | 1731 new AppCacheUpdateJob(service_.get(), group_.get()); |
| 1727 group_->update_job_ = update; | 1732 group_->update_job_ = update; |
| 1728 | 1733 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1742 | 1747 |
| 1743 void RetryNonzeroRetryAfterTest() { | 1748 void RetryNonzeroRetryAfterTest() { |
| 1744 ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); | 1749 ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); |
| 1745 | 1750 |
| 1746 // Set some large number of times to return retry. | 1751 // Set some large number of times to return retry. |
| 1747 // Expect 1 request and 0 retry attempts. | 1752 // Expect 1 request and 0 retry attempts. |
| 1748 RetryRequestTestJob::Initialize( | 1753 RetryRequestTestJob::Initialize( |
| 1749 5, RetryRequestTestJob::NONZERO_RETRY_AFTER, 1); | 1754 5, RetryRequestTestJob::NONZERO_RETRY_AFTER, 1); |
| 1750 net::URLRequestJobFactoryImpl* new_factory( | 1755 net::URLRequestJobFactoryImpl* new_factory( |
| 1751 new net::URLRequestJobFactoryImpl); | 1756 new net::URLRequestJobFactoryImpl); |
| 1752 new_factory->SetProtocolHandler("http", new RetryRequestTestJobFactory); | 1757 new_factory->SetProtocolHandler( |
| 1758 "http", make_scoped_ptr(new RetryRequestTestJobFactory)); |
| 1753 io_thread_->SetNewJobFactory(new_factory); | 1759 io_thread_->SetNewJobFactory(new_factory); |
| 1754 | 1760 |
| 1755 MakeService(); | 1761 MakeService(); |
| 1756 group_ = new AppCacheGroup(service_->storage(), | 1762 group_ = new AppCacheGroup(service_->storage(), |
| 1757 RetryRequestTestJob::kRetryUrl, | 1763 RetryRequestTestJob::kRetryUrl, |
| 1758 service_->storage()->NewGroupId()); | 1764 service_->storage()->NewGroupId()); |
| 1759 AppCacheUpdateJob* update = | 1765 AppCacheUpdateJob* update = |
| 1760 new AppCacheUpdateJob(service_.get(), group_.get()); | 1766 new AppCacheUpdateJob(service_.get(), group_.get()); |
| 1761 group_->update_job_ = update; | 1767 group_->update_job_ = update; |
| 1762 | 1768 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1775 } | 1781 } |
| 1776 | 1782 |
| 1777 void RetrySuccessTest() { | 1783 void RetrySuccessTest() { |
| 1778 ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); | 1784 ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); |
| 1779 | 1785 |
| 1780 // Set 2 as the retry limit (does not exceed the max). | 1786 // Set 2 as the retry limit (does not exceed the max). |
| 1781 // Expect 1 manifest fetch, 2 retries, 1 url fetch, 1 manifest refetch. | 1787 // Expect 1 manifest fetch, 2 retries, 1 url fetch, 1 manifest refetch. |
| 1782 RetryRequestTestJob::Initialize(2, RetryRequestTestJob::RETRY_AFTER_0, 5); | 1788 RetryRequestTestJob::Initialize(2, RetryRequestTestJob::RETRY_AFTER_0, 5); |
| 1783 net::URLRequestJobFactoryImpl* new_factory( | 1789 net::URLRequestJobFactoryImpl* new_factory( |
| 1784 new net::URLRequestJobFactoryImpl); | 1790 new net::URLRequestJobFactoryImpl); |
| 1785 new_factory->SetProtocolHandler("http", new RetryRequestTestJobFactory); | 1791 new_factory->SetProtocolHandler( |
| 1792 "http", make_scoped_ptr(new RetryRequestTestJobFactory)); |
| 1786 io_thread_->SetNewJobFactory(new_factory); | 1793 io_thread_->SetNewJobFactory(new_factory); |
| 1787 | 1794 |
| 1788 MakeService(); | 1795 MakeService(); |
| 1789 group_ = new AppCacheGroup(service_->storage(), | 1796 group_ = new AppCacheGroup(service_->storage(), |
| 1790 RetryRequestTestJob::kRetryUrl, | 1797 RetryRequestTestJob::kRetryUrl, |
| 1791 service_->storage()->NewGroupId()); | 1798 service_->storage()->NewGroupId()); |
| 1792 AppCacheUpdateJob* update = | 1799 AppCacheUpdateJob* update = |
| 1793 new AppCacheUpdateJob(service_.get(), group_.get()); | 1800 new AppCacheUpdateJob(service_.get(), group_.get()); |
| 1794 group_->update_job_ = update; | 1801 group_->update_job_ = update; |
| 1795 | 1802 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1808 } | 1815 } |
| 1809 | 1816 |
| 1810 void RetryUrlTest() { | 1817 void RetryUrlTest() { |
| 1811 ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); | 1818 ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); |
| 1812 | 1819 |
| 1813 // Set 1 as the retry limit (does not exceed the max). | 1820 // Set 1 as the retry limit (does not exceed the max). |
| 1814 // Expect 1 manifest fetch, 1 url fetch, 1 url retry, 1 manifest refetch. | 1821 // Expect 1 manifest fetch, 1 url fetch, 1 url retry, 1 manifest refetch. |
| 1815 RetryRequestTestJob::Initialize(1, RetryRequestTestJob::RETRY_AFTER_0, 4); | 1822 RetryRequestTestJob::Initialize(1, RetryRequestTestJob::RETRY_AFTER_0, 4); |
| 1816 net::URLRequestJobFactoryImpl* new_factory( | 1823 net::URLRequestJobFactoryImpl* new_factory( |
| 1817 new net::URLRequestJobFactoryImpl); | 1824 new net::URLRequestJobFactoryImpl); |
| 1818 new_factory->SetProtocolHandler("http", new RetryRequestTestJobFactory); | 1825 new_factory->SetProtocolHandler( |
| 1826 "http", make_scoped_ptr(new RetryRequestTestJobFactory)); |
| 1819 io_thread_->SetNewJobFactory(new_factory); | 1827 io_thread_->SetNewJobFactory(new_factory); |
| 1820 | 1828 |
| 1821 MakeService(); | 1829 MakeService(); |
| 1822 group_ = new AppCacheGroup(service_->storage(), GURL("http://retryurl"), | 1830 group_ = new AppCacheGroup(service_->storage(), GURL("http://retryurl"), |
| 1823 service_->storage()->NewGroupId()); | 1831 service_->storage()->NewGroupId()); |
| 1824 AppCacheUpdateJob* update = | 1832 AppCacheUpdateJob* update = |
| 1825 new AppCacheUpdateJob(service_.get(), group_.get()); | 1833 new AppCacheUpdateJob(service_.get(), group_.get()); |
| 1826 group_->update_job_ = update; | 1834 group_->update_job_ = update; |
| 1827 | 1835 |
| 1828 MockFrontend* frontend = MakeMockFrontend(); | 1836 MockFrontend* frontend = MakeMockFrontend(); |
| (...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2673 // Group status will be APPCACHE_STATUS_IDLE so cannot call | 2681 // Group status will be APPCACHE_STATUS_IDLE so cannot call |
| 2674 // WaitForUpdateToFinish. | 2682 // WaitForUpdateToFinish. |
| 2675 group_->AddUpdateObserver(this); | 2683 group_->AddUpdateObserver(this); |
| 2676 } | 2684 } |
| 2677 | 2685 |
| 2678 void IfModifiedSinceTest() { | 2686 void IfModifiedSinceTest() { |
| 2679 ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); | 2687 ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); |
| 2680 | 2688 |
| 2681 net::URLRequestJobFactoryImpl* new_factory( | 2689 net::URLRequestJobFactoryImpl* new_factory( |
| 2682 new net::URLRequestJobFactoryImpl); | 2690 new net::URLRequestJobFactoryImpl); |
| 2683 new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory); | 2691 new_factory->SetProtocolHandler( |
| 2692 "http", make_scoped_ptr(new IfModifiedSinceJobFactory)); |
| 2684 io_thread_->SetNewJobFactory(new_factory); | 2693 io_thread_->SetNewJobFactory(new_factory); |
| 2685 | 2694 |
| 2686 MakeService(); | 2695 MakeService(); |
| 2687 group_ = new AppCacheGroup( | 2696 group_ = new AppCacheGroup( |
| 2688 service_->storage(), GURL("http://headertest"), 111); | 2697 service_->storage(), GURL("http://headertest"), 111); |
| 2689 AppCacheUpdateJob* update = | 2698 AppCacheUpdateJob* update = |
| 2690 new AppCacheUpdateJob(service_.get(), group_.get()); | 2699 new AppCacheUpdateJob(service_.get(), group_.get()); |
| 2691 group_->update_job_ = update; | 2700 group_->update_job_ = update; |
| 2692 | 2701 |
| 2693 // First test against a cache attempt. Will start manifest fetch | 2702 // First test against a cache attempt. Will start manifest fetch |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2744 UpdateFinished(); | 2753 UpdateFinished(); |
| 2745 } | 2754 } |
| 2746 | 2755 |
| 2747 void IfModifiedSinceUpgradeTest() { | 2756 void IfModifiedSinceUpgradeTest() { |
| 2748 ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); | 2757 ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); |
| 2749 | 2758 |
| 2750 HttpHeadersRequestTestJob::Initialize("Sat, 29 Oct 1994 19:43:31 GMT", | 2759 HttpHeadersRequestTestJob::Initialize("Sat, 29 Oct 1994 19:43:31 GMT", |
| 2751 std::string()); | 2760 std::string()); |
| 2752 net::URLRequestJobFactoryImpl* new_factory( | 2761 net::URLRequestJobFactoryImpl* new_factory( |
| 2753 new net::URLRequestJobFactoryImpl); | 2762 new net::URLRequestJobFactoryImpl); |
| 2754 new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory); | 2763 new_factory->SetProtocolHandler( |
| 2764 "http", make_scoped_ptr(new IfModifiedSinceJobFactory)); |
| 2755 io_thread_->SetNewJobFactory(new_factory); | 2765 io_thread_->SetNewJobFactory(new_factory); |
| 2756 | 2766 |
| 2757 MakeService(); | 2767 MakeService(); |
| 2758 group_ = new AppCacheGroup( | 2768 group_ = new AppCacheGroup( |
| 2759 service_->storage(), | 2769 service_->storage(), |
| 2760 MockHttpServer::GetMockUrl("files/manifest1"), | 2770 MockHttpServer::GetMockUrl("files/manifest1"), |
| 2761 111); | 2771 111); |
| 2762 AppCacheUpdateJob* update = | 2772 AppCacheUpdateJob* update = |
| 2763 new AppCacheUpdateJob(service_.get(), group_.get()); | 2773 new AppCacheUpdateJob(service_.get(), group_.get()); |
| 2764 group_->update_job_ = update; | 2774 group_->update_job_ = update; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2807 | 2817 |
| 2808 // Start update after data write completes asynchronously. | 2818 // Start update after data write completes asynchronously. |
| 2809 } | 2819 } |
| 2810 | 2820 |
| 2811 void IfNoneMatchUpgradeTest() { | 2821 void IfNoneMatchUpgradeTest() { |
| 2812 ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); | 2822 ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); |
| 2813 | 2823 |
| 2814 HttpHeadersRequestTestJob::Initialize(std::string(), "\"LadeDade\""); | 2824 HttpHeadersRequestTestJob::Initialize(std::string(), "\"LadeDade\""); |
| 2815 net::URLRequestJobFactoryImpl* new_factory( | 2825 net::URLRequestJobFactoryImpl* new_factory( |
| 2816 new net::URLRequestJobFactoryImpl); | 2826 new net::URLRequestJobFactoryImpl); |
| 2817 new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory); | 2827 new_factory->SetProtocolHandler( |
| 2828 "http", make_scoped_ptr(new IfModifiedSinceJobFactory)); |
| 2818 io_thread_->SetNewJobFactory(new_factory); | 2829 io_thread_->SetNewJobFactory(new_factory); |
| 2819 | 2830 |
| 2820 MakeService(); | 2831 MakeService(); |
| 2821 group_ = new AppCacheGroup( | 2832 group_ = new AppCacheGroup( |
| 2822 service_->storage(), | 2833 service_->storage(), |
| 2823 MockHttpServer::GetMockUrl("files/manifest1"), | 2834 MockHttpServer::GetMockUrl("files/manifest1"), |
| 2824 111); | 2835 111); |
| 2825 AppCacheUpdateJob* update = | 2836 AppCacheUpdateJob* update = |
| 2826 new AppCacheUpdateJob(service_.get(), group_.get()); | 2837 new AppCacheUpdateJob(service_.get(), group_.get()); |
| 2827 group_->update_job_ = update; | 2838 group_->update_job_ = update; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2870 | 2881 |
| 2871 // Start update after data write completes asynchronously. | 2882 // Start update after data write completes asynchronously. |
| 2872 } | 2883 } |
| 2873 | 2884 |
| 2874 void IfNoneMatchRefetchTest() { | 2885 void IfNoneMatchRefetchTest() { |
| 2875 ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); | 2886 ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); |
| 2876 | 2887 |
| 2877 HttpHeadersRequestTestJob::Initialize(std::string(), "\"LadeDade\""); | 2888 HttpHeadersRequestTestJob::Initialize(std::string(), "\"LadeDade\""); |
| 2878 net::URLRequestJobFactoryImpl* new_factory( | 2889 net::URLRequestJobFactoryImpl* new_factory( |
| 2879 new net::URLRequestJobFactoryImpl); | 2890 new net::URLRequestJobFactoryImpl); |
| 2880 new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory); | 2891 new_factory->SetProtocolHandler( |
| 2892 "http", make_scoped_ptr(new IfModifiedSinceJobFactory)); |
| 2881 io_thread_->SetNewJobFactory(new_factory); | 2893 io_thread_->SetNewJobFactory(new_factory); |
| 2882 | 2894 |
| 2883 MakeService(); | 2895 MakeService(); |
| 2884 group_ = new AppCacheGroup( | 2896 group_ = new AppCacheGroup( |
| 2885 service_->storage(), GURL("http://headertest"), 111); | 2897 service_->storage(), GURL("http://headertest"), 111); |
| 2886 AppCacheUpdateJob* update = | 2898 AppCacheUpdateJob* update = |
| 2887 new AppCacheUpdateJob(service_.get(), group_.get()); | 2899 new AppCacheUpdateJob(service_.get(), group_.get()); |
| 2888 group_->update_job_ = update; | 2900 group_->update_job_ = update; |
| 2889 | 2901 |
| 2890 // Simulate a refetch manifest request that uses an ETag header. | 2902 // Simulate a refetch manifest request that uses an ETag header. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2908 } | 2920 } |
| 2909 | 2921 |
| 2910 void MultipleHeadersRefetchTest() { | 2922 void MultipleHeadersRefetchTest() { |
| 2911 ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); | 2923 ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); |
| 2912 | 2924 |
| 2913 // Verify that code is correct when building multiple extra headers. | 2925 // Verify that code is correct when building multiple extra headers. |
| 2914 HttpHeadersRequestTestJob::Initialize( | 2926 HttpHeadersRequestTestJob::Initialize( |
| 2915 "Sat, 29 Oct 1994 19:43:31 GMT", "\"LadeDade\""); | 2927 "Sat, 29 Oct 1994 19:43:31 GMT", "\"LadeDade\""); |
| 2916 net::URLRequestJobFactoryImpl* new_factory( | 2928 net::URLRequestJobFactoryImpl* new_factory( |
| 2917 new net::URLRequestJobFactoryImpl); | 2929 new net::URLRequestJobFactoryImpl); |
| 2918 new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory); | 2930 new_factory->SetProtocolHandler( |
| 2931 "http", make_scoped_ptr(new IfModifiedSinceJobFactory)); |
| 2919 io_thread_->SetNewJobFactory(new_factory); | 2932 io_thread_->SetNewJobFactory(new_factory); |
| 2920 | 2933 |
| 2921 MakeService(); | 2934 MakeService(); |
| 2922 group_ = new AppCacheGroup( | 2935 group_ = new AppCacheGroup( |
| 2923 service_->storage(), GURL("http://headertest"), 111); | 2936 service_->storage(), GURL("http://headertest"), 111); |
| 2924 AppCacheUpdateJob* update = | 2937 AppCacheUpdateJob* update = |
| 2925 new AppCacheUpdateJob(service_.get(), group_.get()); | 2938 new AppCacheUpdateJob(service_.get(), group_.get()); |
| 2926 group_->update_job_ = update; | 2939 group_->update_job_ = update; |
| 2927 | 2940 |
| 2928 // Simulate a refetch manifest request that uses an ETag header. | 2941 // Simulate a refetch manifest request that uses an ETag header. |
| (...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3708 | 3721 |
| 3709 TEST_F(AppCacheUpdateJobTest, CrossOriginHttpsSuccess) { | 3722 TEST_F(AppCacheUpdateJobTest, CrossOriginHttpsSuccess) { |
| 3710 RunTestOnIOThread(&AppCacheUpdateJobTest::CrossOriginHttpsSuccessTest); | 3723 RunTestOnIOThread(&AppCacheUpdateJobTest::CrossOriginHttpsSuccessTest); |
| 3711 } | 3724 } |
| 3712 | 3725 |
| 3713 TEST_F(AppCacheUpdateJobTest, CrossOriginHttpsDenied) { | 3726 TEST_F(AppCacheUpdateJobTest, CrossOriginHttpsDenied) { |
| 3714 RunTestOnIOThread(&AppCacheUpdateJobTest::CrossOriginHttpsDeniedTest); | 3727 RunTestOnIOThread(&AppCacheUpdateJobTest::CrossOriginHttpsDeniedTest); |
| 3715 } | 3728 } |
| 3716 | 3729 |
| 3717 } // namespace content | 3730 } // namespace content |
| OLD | NEW |