Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: webkit/appcache/appcache_update_job_unittest.cc

Issue 10836248: Turned job_factory into a pure virtual class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Latest merge Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
11 #include "base/synchronization/waitable_event.h" 11 #include "base/synchronization/waitable_event.h"
12 #include "net/base/net_errors.h" 12 #include "net/base/net_errors.h"
13 #include "net/http/http_response_headers.h" 13 #include "net/http/http_response_headers.h"
14 #include "net/url_request/url_request_error_job.h" 14 #include "net/url_request/url_request_error_job.h"
15 #include "net/url_request/url_request_job_factory.h" 15 #include "net/url_request/url_request_job_factory_impl.h"
16 #include "net/url_request/url_request_test_job.h" 16 #include "net/url_request/url_request_test_job.h"
17 #include "net/url_request/url_request_test_util.h" 17 #include "net/url_request/url_request_test_util.h"
18 #include "webkit/appcache/appcache_group.h" 18 #include "webkit/appcache/appcache_group.h"
19 #include "webkit/appcache/appcache_host.h" 19 #include "webkit/appcache/appcache_host.h"
20 #include "webkit/appcache/appcache_response.h" 20 #include "webkit/appcache/appcache_response.h"
21 #include "webkit/appcache/appcache_update_job.h" 21 #include "webkit/appcache/appcache_update_job.h"
22 #include "webkit/appcache/mock_appcache_service.h" 22 #include "webkit/appcache/mock_appcache_service.h"
23 23
24 namespace appcache { 24 namespace appcache {
25 class AppCacheUpdateJobTest; 25 class AppCacheUpdateJobTest;
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 return request_context_.get(); 554 return request_context_.get();
555 } 555 }
556 556
557 void SetNewJobFactory(net::URLRequestJobFactory* job_factory) { 557 void SetNewJobFactory(net::URLRequestJobFactory* job_factory) {
558 DCHECK(job_factory); 558 DCHECK(job_factory);
559 job_factory_.reset(job_factory); 559 job_factory_.reset(job_factory);
560 request_context_->set_job_factory(job_factory_.get()); 560 request_context_->set_job_factory(job_factory_.get());
561 } 561 }
562 562
563 virtual void Init() { 563 virtual void Init() {
564 job_factory_.reset(new net::URLRequestJobFactory); 564 job_factory_.reset(new net::URLRequestJobFactoryImpl);
565 job_factory_->SetProtocolHandler("http", new MockHttpServerJobFactory); 565 job_factory_->SetProtocolHandler("http", new MockHttpServerJobFactory);
566 job_factory_->SetProtocolHandler("https", new MockHttpServerJobFactory); 566 job_factory_->SetProtocolHandler("https", new MockHttpServerJobFactory);
567 request_context_.reset(new TestURLRequestContext()); 567 request_context_.reset(new TestURLRequestContext());
568 request_context_->set_job_factory(job_factory_.get()); 568 request_context_->set_job_factory(job_factory_.get());
569 } 569 }
570 570
571 virtual void CleanUp() { 571 virtual void CleanUp() {
572 request_context_.reset(); 572 request_context_.reset();
573 job_factory_.reset(); 573 job_factory_.reset();
574 } 574 }
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 MockFrontend::HostIds ids2(1, host2->host_id()); 766 MockFrontend::HostIds ids2(1, host2->host_id());
767 frontend2->AddExpectedEvent(ids2, CHECKING_EVENT); 767 frontend2->AddExpectedEvent(ids2, CHECKING_EVENT);
768 frontend2->AddExpectedEvent(ids2, ERROR_EVENT); 768 frontend2->AddExpectedEvent(ids2, ERROR_EVENT);
769 769
770 WaitForUpdateToFinish(); 770 WaitForUpdateToFinish();
771 } 771 }
772 772
773 void ManifestRedirectTest() { 773 void ManifestRedirectTest() {
774 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); 774 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type());
775 775
776 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactory); 776 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl);
777 new_factory->SetProtocolHandler("http", new RedirectFactory); 777 new_factory->SetProtocolHandler("http", new RedirectFactory);
778 io_thread_->SetNewJobFactory(new_factory); 778 io_thread_->SetNewJobFactory(new_factory);
779 779
780 MakeService(); 780 MakeService();
781 group_ = new AppCacheGroup(service_.get(), GURL("http://testme"), 781 group_ = new AppCacheGroup(service_.get(), GURL("http://testme"),
782 service_->storage()->NewGroupId()); 782 service_->storage()->NewGroupId());
783 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); 783 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
784 group_->update_job_ = update; 784 group_->update_job_ = update;
785 785
786 MockFrontend* frontend = MakeMockFrontend(); 786 MockFrontend* frontend = MakeMockFrontend();
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
1629 1629
1630 WaitForUpdateToFinish(); 1630 WaitForUpdateToFinish();
1631 } 1631 }
1632 1632
1633 void RetryRequestTest() { 1633 void RetryRequestTest() {
1634 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); 1634 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type());
1635 1635
1636 // Set some large number of times to return retry. 1636 // Set some large number of times to return retry.
1637 // Expect 1 manifest fetch and 3 retries. 1637 // Expect 1 manifest fetch and 3 retries.
1638 RetryRequestTestJob::Initialize(5, RetryRequestTestJob::RETRY_AFTER_0, 4); 1638 RetryRequestTestJob::Initialize(5, RetryRequestTestJob::RETRY_AFTER_0, 4);
1639 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactory); 1639 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl);
1640 new_factory->SetProtocolHandler("http", new RetryRequestTestJobFactory); 1640 new_factory->SetProtocolHandler("http", new RetryRequestTestJobFactory);
1641 io_thread_->SetNewJobFactory(new_factory); 1641 io_thread_->SetNewJobFactory(new_factory);
1642 1642
1643 MakeService(); 1643 MakeService();
1644 group_ = new AppCacheGroup(service_.get(), RetryRequestTestJob::kRetryUrl, 1644 group_ = new AppCacheGroup(service_.get(), RetryRequestTestJob::kRetryUrl,
1645 service_->storage()->NewGroupId()); 1645 service_->storage()->NewGroupId());
1646 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); 1646 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
1647 group_->update_job_ = update; 1647 group_->update_job_ = update;
1648 1648
1649 MockFrontend* frontend = MakeMockFrontend(); 1649 MockFrontend* frontend = MakeMockFrontend();
(...skipping 10 matching lines...) Expand all
1660 1660
1661 WaitForUpdateToFinish(); 1661 WaitForUpdateToFinish();
1662 } 1662 }
1663 1663
1664 void RetryNoRetryAfterTest() { 1664 void RetryNoRetryAfterTest() {
1665 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); 1665 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type());
1666 1666
1667 // Set some large number of times to return retry. 1667 // Set some large number of times to return retry.
1668 // Expect 1 manifest fetch and 0 retries. 1668 // Expect 1 manifest fetch and 0 retries.
1669 RetryRequestTestJob::Initialize(5, RetryRequestTestJob::NO_RETRY_AFTER, 1); 1669 RetryRequestTestJob::Initialize(5, RetryRequestTestJob::NO_RETRY_AFTER, 1);
1670 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactory); 1670 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl);
1671 new_factory->SetProtocolHandler("http", new RetryRequestTestJobFactory); 1671 new_factory->SetProtocolHandler("http", new RetryRequestTestJobFactory);
1672 io_thread_->SetNewJobFactory(new_factory); 1672 io_thread_->SetNewJobFactory(new_factory);
1673 1673
1674 MakeService(); 1674 MakeService();
1675 group_ = new AppCacheGroup(service_.get(), RetryRequestTestJob::kRetryUrl, 1675 group_ = new AppCacheGroup(service_.get(), RetryRequestTestJob::kRetryUrl,
1676 service_->storage()->NewGroupId()); 1676 service_->storage()->NewGroupId());
1677 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); 1677 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
1678 group_->update_job_ = update; 1678 group_->update_job_ = update;
1679 1679
1680 MockFrontend* frontend = MakeMockFrontend(); 1680 MockFrontend* frontend = MakeMockFrontend();
(...skipping 11 matching lines...) Expand all
1692 WaitForUpdateToFinish(); 1692 WaitForUpdateToFinish();
1693 } 1693 }
1694 1694
1695 void RetryNonzeroRetryAfterTest() { 1695 void RetryNonzeroRetryAfterTest() {
1696 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); 1696 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type());
1697 1697
1698 // Set some large number of times to return retry. 1698 // Set some large number of times to return retry.
1699 // Expect 1 request and 0 retry attempts. 1699 // Expect 1 request and 0 retry attempts.
1700 RetryRequestTestJob::Initialize( 1700 RetryRequestTestJob::Initialize(
1701 5, RetryRequestTestJob::NONZERO_RETRY_AFTER, 1); 1701 5, RetryRequestTestJob::NONZERO_RETRY_AFTER, 1);
1702 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactory); 1702 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl);
1703 new_factory->SetProtocolHandler("http", new RetryRequestTestJobFactory); 1703 new_factory->SetProtocolHandler("http", new RetryRequestTestJobFactory);
1704 io_thread_->SetNewJobFactory(new_factory); 1704 io_thread_->SetNewJobFactory(new_factory);
1705 1705
1706 MakeService(); 1706 MakeService();
1707 group_ = new AppCacheGroup(service_.get(), RetryRequestTestJob::kRetryUrl, 1707 group_ = new AppCacheGroup(service_.get(), RetryRequestTestJob::kRetryUrl,
1708 service_->storage()->NewGroupId()); 1708 service_->storage()->NewGroupId());
1709 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); 1709 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
1710 group_->update_job_ = update; 1710 group_->update_job_ = update;
1711 1711
1712 MockFrontend* frontend = MakeMockFrontend(); 1712 MockFrontend* frontend = MakeMockFrontend();
(...skipping 10 matching lines...) Expand all
1723 1723
1724 WaitForUpdateToFinish(); 1724 WaitForUpdateToFinish();
1725 } 1725 }
1726 1726
1727 void RetrySuccessTest() { 1727 void RetrySuccessTest() {
1728 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); 1728 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type());
1729 1729
1730 // Set 2 as the retry limit (does not exceed the max). 1730 // Set 2 as the retry limit (does not exceed the max).
1731 // Expect 1 manifest fetch, 2 retries, 1 url fetch, 1 manifest refetch. 1731 // Expect 1 manifest fetch, 2 retries, 1 url fetch, 1 manifest refetch.
1732 RetryRequestTestJob::Initialize(2, RetryRequestTestJob::RETRY_AFTER_0, 5); 1732 RetryRequestTestJob::Initialize(2, RetryRequestTestJob::RETRY_AFTER_0, 5);
1733 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactory); 1733 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl);
1734 new_factory->SetProtocolHandler("http", new RetryRequestTestJobFactory); 1734 new_factory->SetProtocolHandler("http", new RetryRequestTestJobFactory);
1735 io_thread_->SetNewJobFactory(new_factory); 1735 io_thread_->SetNewJobFactory(new_factory);
1736 1736
1737 MakeService(); 1737 MakeService();
1738 group_ = new AppCacheGroup(service_.get(), RetryRequestTestJob::kRetryUrl, 1738 group_ = new AppCacheGroup(service_.get(), RetryRequestTestJob::kRetryUrl,
1739 service_->storage()->NewGroupId()); 1739 service_->storage()->NewGroupId());
1740 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); 1740 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
1741 group_->update_job_ = update; 1741 group_->update_job_ = update;
1742 1742
1743 MockFrontend* frontend = MakeMockFrontend(); 1743 MockFrontend* frontend = MakeMockFrontend();
(...skipping 10 matching lines...) Expand all
1754 1754
1755 WaitForUpdateToFinish(); 1755 WaitForUpdateToFinish();
1756 } 1756 }
1757 1757
1758 void RetryUrlTest() { 1758 void RetryUrlTest() {
1759 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); 1759 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type());
1760 1760
1761 // Set 1 as the retry limit (does not exceed the max). 1761 // Set 1 as the retry limit (does not exceed the max).
1762 // Expect 1 manifest fetch, 1 url fetch, 1 url retry, 1 manifest refetch. 1762 // Expect 1 manifest fetch, 1 url fetch, 1 url retry, 1 manifest refetch.
1763 RetryRequestTestJob::Initialize(1, RetryRequestTestJob::RETRY_AFTER_0, 4); 1763 RetryRequestTestJob::Initialize(1, RetryRequestTestJob::RETRY_AFTER_0, 4);
1764 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactory); 1764 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl);
1765 new_factory->SetProtocolHandler("http", new RetryRequestTestJobFactory); 1765 new_factory->SetProtocolHandler("http", new RetryRequestTestJobFactory);
1766 io_thread_->SetNewJobFactory(new_factory); 1766 io_thread_->SetNewJobFactory(new_factory);
1767 1767
1768 MakeService(); 1768 MakeService();
1769 group_ = new AppCacheGroup(service_.get(), GURL("http://retryurl"), 1769 group_ = new AppCacheGroup(service_.get(), GURL("http://retryurl"),
1770 service_->storage()->NewGroupId()); 1770 service_->storage()->NewGroupId());
1771 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); 1771 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
1772 group_->update_job_ = update; 1772 group_->update_job_ = update;
1773 1773
1774 MockFrontend* frontend = MakeMockFrontend(); 1774 MockFrontend* frontend = MakeMockFrontend();
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after
2596 frontend->AddExpectedEvent(ids1, PROGRESS_EVENT); // final 2596 frontend->AddExpectedEvent(ids1, PROGRESS_EVENT); // final
2597 frontend->AddExpectedEvent(ids1, CACHED_EVENT); 2597 frontend->AddExpectedEvent(ids1, CACHED_EVENT);
2598 2598
2599 // Group status will be IDLE so cannot call WaitForUpdateToFinish. 2599 // Group status will be IDLE so cannot call WaitForUpdateToFinish.
2600 group_->AddUpdateObserver(this); 2600 group_->AddUpdateObserver(this);
2601 } 2601 }
2602 2602
2603 void IfModifiedSinceTest() { 2603 void IfModifiedSinceTest() {
2604 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); 2604 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type());
2605 2605
2606 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactory); 2606 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl);
2607 new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory); 2607 new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory);
2608 io_thread_->SetNewJobFactory(new_factory); 2608 io_thread_->SetNewJobFactory(new_factory);
2609 2609
2610 MakeService(); 2610 MakeService();
2611 group_ = new AppCacheGroup(service_.get(), GURL("http://headertest"), 111); 2611 group_ = new AppCacheGroup(service_.get(), GURL("http://headertest"), 111);
2612 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); 2612 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
2613 group_->update_job_ = update; 2613 group_->update_job_ = update;
2614 2614
2615 // First test against a cache attempt. Will start manifest fetch 2615 // First test against a cache attempt. Will start manifest fetch
2616 // synchronously. 2616 // synchronously.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
2662 HttpHeadersRequestTestJob::Verify(); 2662 HttpHeadersRequestTestJob::Verify();
2663 delete update; 2663 delete update;
2664 2664
2665 UpdateFinished(); 2665 UpdateFinished();
2666 } 2666 }
2667 2667
2668 void IfModifiedSinceUpgradeTest() { 2668 void IfModifiedSinceUpgradeTest() {
2669 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); 2669 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type());
2670 2670
2671 HttpHeadersRequestTestJob::Initialize("Sat, 29 Oct 1994 19:43:31 GMT", ""); 2671 HttpHeadersRequestTestJob::Initialize("Sat, 29 Oct 1994 19:43:31 GMT", "");
2672 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactory); 2672 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl);
2673 new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory); 2673 new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory);
2674 io_thread_->SetNewJobFactory(new_factory); 2674 io_thread_->SetNewJobFactory(new_factory);
2675 2675
2676 MakeService(); 2676 MakeService();
2677 group_ = new AppCacheGroup( 2677 group_ = new AppCacheGroup(
2678 service_.get(), MockHttpServer::GetMockUrl("files/manifest1"), 111); 2678 service_.get(), MockHttpServer::GetMockUrl("files/manifest1"), 111);
2679 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); 2679 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
2680 group_->update_job_ = update; 2680 group_->update_job_ = update;
2681 2681
2682 // Give the newest cache a manifest enry that is in storage. 2682 // Give the newest cache a manifest enry that is in storage.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
2721 base::Bind(&AppCacheUpdateJobTest::StartUpdateAfterSeedingStorageData, 2721 base::Bind(&AppCacheUpdateJobTest::StartUpdateAfterSeedingStorageData,
2722 base::Unretained(this))); 2722 base::Unretained(this)));
2723 2723
2724 // Start update after data write completes asynchronously. 2724 // Start update after data write completes asynchronously.
2725 } 2725 }
2726 2726
2727 void IfNoneMatchUpgradeTest() { 2727 void IfNoneMatchUpgradeTest() {
2728 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); 2728 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type());
2729 2729
2730 HttpHeadersRequestTestJob::Initialize("", "\"LadeDade\""); 2730 HttpHeadersRequestTestJob::Initialize("", "\"LadeDade\"");
2731 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactory); 2731 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl);
2732 new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory); 2732 new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory);
2733 io_thread_->SetNewJobFactory(new_factory); 2733 io_thread_->SetNewJobFactory(new_factory);
2734 2734
2735 MakeService(); 2735 MakeService();
2736 group_ = new AppCacheGroup( 2736 group_ = new AppCacheGroup(
2737 service_.get(), MockHttpServer::GetMockUrl("files/manifest1"), 111); 2737 service_.get(), MockHttpServer::GetMockUrl("files/manifest1"), 111);
2738 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); 2738 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
2739 group_->update_job_ = update; 2739 group_->update_job_ = update;
2740 2740
2741 // Give the newest cache a manifest enry that is in storage. 2741 // Give the newest cache a manifest enry that is in storage.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
2780 base::Bind(&AppCacheUpdateJobTest::StartUpdateAfterSeedingStorageData, 2780 base::Bind(&AppCacheUpdateJobTest::StartUpdateAfterSeedingStorageData,
2781 base::Unretained(this))); 2781 base::Unretained(this)));
2782 2782
2783 // Start update after data write completes asynchronously. 2783 // Start update after data write completes asynchronously.
2784 } 2784 }
2785 2785
2786 void IfNoneMatchRefetchTest() { 2786 void IfNoneMatchRefetchTest() {
2787 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); 2787 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type());
2788 2788
2789 HttpHeadersRequestTestJob::Initialize("", "\"LadeDade\""); 2789 HttpHeadersRequestTestJob::Initialize("", "\"LadeDade\"");
2790 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactory); 2790 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl);
2791 new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory); 2791 new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory);
2792 io_thread_->SetNewJobFactory(new_factory); 2792 io_thread_->SetNewJobFactory(new_factory);
2793 2793
2794 MakeService(); 2794 MakeService();
2795 group_ = new AppCacheGroup(service_.get(), GURL("http://headertest"), 111); 2795 group_ = new AppCacheGroup(service_.get(), GURL("http://headertest"), 111);
2796 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); 2796 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
2797 group_->update_job_ = update; 2797 group_->update_job_ = update;
2798 2798
2799 // Simulate a refetch manifest request that uses an ETag header. 2799 // Simulate a refetch manifest request that uses an ETag header.
2800 const char data[] = 2800 const char data[] =
(...skipping 14 matching lines...) Expand all
2815 2815
2816 UpdateFinished(); 2816 UpdateFinished();
2817 } 2817 }
2818 2818
2819 void MultipleHeadersRefetchTest() { 2819 void MultipleHeadersRefetchTest() {
2820 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); 2820 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type());
2821 2821
2822 // Verify that code is correct when building multiple extra headers. 2822 // Verify that code is correct when building multiple extra headers.
2823 HttpHeadersRequestTestJob::Initialize( 2823 HttpHeadersRequestTestJob::Initialize(
2824 "Sat, 29 Oct 1994 19:43:31 GMT", "\"LadeDade\""); 2824 "Sat, 29 Oct 1994 19:43:31 GMT", "\"LadeDade\"");
2825 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactory); 2825 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl);
2826 new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory); 2826 new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory);
2827 io_thread_->SetNewJobFactory(new_factory); 2827 io_thread_->SetNewJobFactory(new_factory);
2828 2828
2829 MakeService(); 2829 MakeService();
2830 group_ = new AppCacheGroup(service_.get(), GURL("http://headertest"), 111); 2830 group_ = new AppCacheGroup(service_.get(), GURL("http://headertest"), 111);
2831 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); 2831 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
2832 group_->update_job_ = update; 2832 group_->update_job_ = update;
2833 2833
2834 // Simulate a refetch manifest request that uses an ETag header. 2834 // Simulate a refetch manifest request that uses an ETag header.
2835 const char data[] = 2835 const char data[] =
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
3581 3581
3582 TEST_F(AppCacheUpdateJobTest, CrossOriginHttpsSuccess) { 3582 TEST_F(AppCacheUpdateJobTest, CrossOriginHttpsSuccess) {
3583 RunTestOnIOThread(&AppCacheUpdateJobTest::CrossOriginHttpsSuccessTest); 3583 RunTestOnIOThread(&AppCacheUpdateJobTest::CrossOriginHttpsSuccessTest);
3584 } 3584 }
3585 3585
3586 TEST_F(AppCacheUpdateJobTest, CrossOriginHttpsDenied) { 3586 TEST_F(AppCacheUpdateJobTest, CrossOriginHttpsDenied) {
3587 RunTestOnIOThread(&AppCacheUpdateJobTest::CrossOriginHttpsDeniedTest); 3587 RunTestOnIOThread(&AppCacheUpdateJobTest::CrossOriginHttpsDeniedTest);
3588 } 3588 }
3589 3589
3590 } // namespace appcache 3590 } // namespace appcache
OLDNEW
« no previous file with comments | « net/url_request/url_request_unittest.cc ('k') | webkit/fileapi/local_file_system_operation_write_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698