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

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: Removed includes Created 8 years, 4 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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 return request_context_.get(); 540 return request_context_.get();
541 } 541 }
542 542
543 void SetNewJobFactory(net::URLRequestJobFactory* job_factory) { 543 void SetNewJobFactory(net::URLRequestJobFactory* job_factory) {
544 DCHECK(job_factory); 544 DCHECK(job_factory);
545 job_factory_.reset(job_factory); 545 job_factory_.reset(job_factory);
546 request_context_->set_job_factory(job_factory_.get()); 546 request_context_->set_job_factory(job_factory_.get());
547 } 547 }
548 548
549 virtual void Init() { 549 virtual void Init() {
550 job_factory_.reset(new net::URLRequestJobFactory); 550 job_factory_.reset(new net::URLRequestJobFactoryImpl);
551 job_factory_->SetProtocolHandler("http", new MockHttpServerJobFactory); 551 job_factory_->SetProtocolHandler("http", new MockHttpServerJobFactory);
552 job_factory_->SetProtocolHandler("https", new MockHttpServerJobFactory); 552 job_factory_->SetProtocolHandler("https", new MockHttpServerJobFactory);
553 request_context_.reset(new TestURLRequestContext()); 553 request_context_.reset(new TestURLRequestContext());
554 request_context_->set_job_factory(job_factory_.get()); 554 request_context_->set_job_factory(job_factory_.get());
555 } 555 }
556 556
557 virtual void CleanUp() { 557 virtual void CleanUp() {
558 request_context_.reset(); 558 request_context_.reset();
559 job_factory_.reset(); 559 job_factory_.reset();
560 } 560 }
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 MockFrontend::HostIds ids2(1, host2->host_id()); 752 MockFrontend::HostIds ids2(1, host2->host_id());
753 frontend2->AddExpectedEvent(ids2, CHECKING_EVENT); 753 frontend2->AddExpectedEvent(ids2, CHECKING_EVENT);
754 frontend2->AddExpectedEvent(ids2, ERROR_EVENT); 754 frontend2->AddExpectedEvent(ids2, ERROR_EVENT);
755 755
756 WaitForUpdateToFinish(); 756 WaitForUpdateToFinish();
757 } 757 }
758 758
759 void ManifestRedirectTest() { 759 void ManifestRedirectTest() {
760 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); 760 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type());
761 761
762 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactory); 762 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl);
763 new_factory->SetProtocolHandler("http", new RedirectFactory); 763 new_factory->SetProtocolHandler("http", new RedirectFactory);
764 io_thread_->SetNewJobFactory(new_factory); 764 io_thread_->SetNewJobFactory(new_factory);
765 765
766 MakeService(); 766 MakeService();
767 group_ = new AppCacheGroup(service_.get(), GURL("http://testme"), 767 group_ = new AppCacheGroup(service_.get(), GURL("http://testme"),
768 service_->storage()->NewGroupId()); 768 service_->storage()->NewGroupId());
769 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); 769 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
770 group_->update_job_ = update; 770 group_->update_job_ = update;
771 771
772 MockFrontend* frontend = MakeMockFrontend(); 772 MockFrontend* frontend = MakeMockFrontend();
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
1615 1615
1616 WaitForUpdateToFinish(); 1616 WaitForUpdateToFinish();
1617 } 1617 }
1618 1618
1619 void RetryRequestTest() { 1619 void RetryRequestTest() {
1620 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); 1620 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type());
1621 1621
1622 // Set some large number of times to return retry. 1622 // Set some large number of times to return retry.
1623 // Expect 1 manifest fetch and 3 retries. 1623 // Expect 1 manifest fetch and 3 retries.
1624 RetryRequestTestJob::Initialize(5, RetryRequestTestJob::RETRY_AFTER_0, 4); 1624 RetryRequestTestJob::Initialize(5, RetryRequestTestJob::RETRY_AFTER_0, 4);
1625 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactory); 1625 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl);
1626 new_factory->SetProtocolHandler("http", new RetryRequestTestJobFactory); 1626 new_factory->SetProtocolHandler("http", new RetryRequestTestJobFactory);
1627 io_thread_->SetNewJobFactory(new_factory); 1627 io_thread_->SetNewJobFactory(new_factory);
1628 1628
1629 MakeService(); 1629 MakeService();
1630 group_ = new AppCacheGroup(service_.get(), RetryRequestTestJob::kRetryUrl, 1630 group_ = new AppCacheGroup(service_.get(), RetryRequestTestJob::kRetryUrl,
1631 service_->storage()->NewGroupId()); 1631 service_->storage()->NewGroupId());
1632 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); 1632 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
1633 group_->update_job_ = update; 1633 group_->update_job_ = update;
1634 1634
1635 MockFrontend* frontend = MakeMockFrontend(); 1635 MockFrontend* frontend = MakeMockFrontend();
(...skipping 10 matching lines...) Expand all
1646 1646
1647 WaitForUpdateToFinish(); 1647 WaitForUpdateToFinish();
1648 } 1648 }
1649 1649
1650 void RetryNoRetryAfterTest() { 1650 void RetryNoRetryAfterTest() {
1651 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); 1651 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type());
1652 1652
1653 // Set some large number of times to return retry. 1653 // Set some large number of times to return retry.
1654 // Expect 1 manifest fetch and 0 retries. 1654 // Expect 1 manifest fetch and 0 retries.
1655 RetryRequestTestJob::Initialize(5, RetryRequestTestJob::NO_RETRY_AFTER, 1); 1655 RetryRequestTestJob::Initialize(5, RetryRequestTestJob::NO_RETRY_AFTER, 1);
1656 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactory); 1656 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl);
1657 new_factory->SetProtocolHandler("http", new RetryRequestTestJobFactory); 1657 new_factory->SetProtocolHandler("http", new RetryRequestTestJobFactory);
1658 io_thread_->SetNewJobFactory(new_factory); 1658 io_thread_->SetNewJobFactory(new_factory);
1659 1659
1660 MakeService(); 1660 MakeService();
1661 group_ = new AppCacheGroup(service_.get(), RetryRequestTestJob::kRetryUrl, 1661 group_ = new AppCacheGroup(service_.get(), RetryRequestTestJob::kRetryUrl,
1662 service_->storage()->NewGroupId()); 1662 service_->storage()->NewGroupId());
1663 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); 1663 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
1664 group_->update_job_ = update; 1664 group_->update_job_ = update;
1665 1665
1666 MockFrontend* frontend = MakeMockFrontend(); 1666 MockFrontend* frontend = MakeMockFrontend();
(...skipping 11 matching lines...) Expand all
1678 WaitForUpdateToFinish(); 1678 WaitForUpdateToFinish();
1679 } 1679 }
1680 1680
1681 void RetryNonzeroRetryAfterTest() { 1681 void RetryNonzeroRetryAfterTest() {
1682 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); 1682 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type());
1683 1683
1684 // Set some large number of times to return retry. 1684 // Set some large number of times to return retry.
1685 // Expect 1 request and 0 retry attempts. 1685 // Expect 1 request and 0 retry attempts.
1686 RetryRequestTestJob::Initialize( 1686 RetryRequestTestJob::Initialize(
1687 5, RetryRequestTestJob::NONZERO_RETRY_AFTER, 1); 1687 5, RetryRequestTestJob::NONZERO_RETRY_AFTER, 1);
1688 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactory); 1688 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl);
1689 new_factory->SetProtocolHandler("http", new RetryRequestTestJobFactory); 1689 new_factory->SetProtocolHandler("http", new RetryRequestTestJobFactory);
1690 io_thread_->SetNewJobFactory(new_factory); 1690 io_thread_->SetNewJobFactory(new_factory);
1691 1691
1692 MakeService(); 1692 MakeService();
1693 group_ = new AppCacheGroup(service_.get(), RetryRequestTestJob::kRetryUrl, 1693 group_ = new AppCacheGroup(service_.get(), RetryRequestTestJob::kRetryUrl,
1694 service_->storage()->NewGroupId()); 1694 service_->storage()->NewGroupId());
1695 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); 1695 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
1696 group_->update_job_ = update; 1696 group_->update_job_ = update;
1697 1697
1698 MockFrontend* frontend = MakeMockFrontend(); 1698 MockFrontend* frontend = MakeMockFrontend();
(...skipping 10 matching lines...) Expand all
1709 1709
1710 WaitForUpdateToFinish(); 1710 WaitForUpdateToFinish();
1711 } 1711 }
1712 1712
1713 void RetrySuccessTest() { 1713 void RetrySuccessTest() {
1714 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); 1714 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type());
1715 1715
1716 // Set 2 as the retry limit (does not exceed the max). 1716 // Set 2 as the retry limit (does not exceed the max).
1717 // Expect 1 manifest fetch, 2 retries, 1 url fetch, 1 manifest refetch. 1717 // Expect 1 manifest fetch, 2 retries, 1 url fetch, 1 manifest refetch.
1718 RetryRequestTestJob::Initialize(2, RetryRequestTestJob::RETRY_AFTER_0, 5); 1718 RetryRequestTestJob::Initialize(2, RetryRequestTestJob::RETRY_AFTER_0, 5);
1719 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactory); 1719 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl);
1720 new_factory->SetProtocolHandler("http", new RetryRequestTestJobFactory); 1720 new_factory->SetProtocolHandler("http", new RetryRequestTestJobFactory);
1721 io_thread_->SetNewJobFactory(new_factory); 1721 io_thread_->SetNewJobFactory(new_factory);
1722 1722
1723 MakeService(); 1723 MakeService();
1724 group_ = new AppCacheGroup(service_.get(), RetryRequestTestJob::kRetryUrl, 1724 group_ = new AppCacheGroup(service_.get(), RetryRequestTestJob::kRetryUrl,
1725 service_->storage()->NewGroupId()); 1725 service_->storage()->NewGroupId());
1726 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); 1726 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
1727 group_->update_job_ = update; 1727 group_->update_job_ = update;
1728 1728
1729 MockFrontend* frontend = MakeMockFrontend(); 1729 MockFrontend* frontend = MakeMockFrontend();
(...skipping 10 matching lines...) Expand all
1740 1740
1741 WaitForUpdateToFinish(); 1741 WaitForUpdateToFinish();
1742 } 1742 }
1743 1743
1744 void RetryUrlTest() { 1744 void RetryUrlTest() {
1745 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); 1745 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type());
1746 1746
1747 // Set 1 as the retry limit (does not exceed the max). 1747 // Set 1 as the retry limit (does not exceed the max).
1748 // Expect 1 manifest fetch, 1 url fetch, 1 url retry, 1 manifest refetch. 1748 // Expect 1 manifest fetch, 1 url fetch, 1 url retry, 1 manifest refetch.
1749 RetryRequestTestJob::Initialize(1, RetryRequestTestJob::RETRY_AFTER_0, 4); 1749 RetryRequestTestJob::Initialize(1, RetryRequestTestJob::RETRY_AFTER_0, 4);
1750 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactory); 1750 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl);
1751 new_factory->SetProtocolHandler("http", new RetryRequestTestJobFactory); 1751 new_factory->SetProtocolHandler("http", new RetryRequestTestJobFactory);
1752 io_thread_->SetNewJobFactory(new_factory); 1752 io_thread_->SetNewJobFactory(new_factory);
1753 1753
1754 MakeService(); 1754 MakeService();
1755 group_ = new AppCacheGroup(service_.get(), GURL("http://retryurl"), 1755 group_ = new AppCacheGroup(service_.get(), GURL("http://retryurl"),
1756 service_->storage()->NewGroupId()); 1756 service_->storage()->NewGroupId());
1757 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); 1757 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
1758 group_->update_job_ = update; 1758 group_->update_job_ = update;
1759 1759
1760 MockFrontend* frontend = MakeMockFrontend(); 1760 MockFrontend* frontend = MakeMockFrontend();
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after
2582 frontend->AddExpectedEvent(ids1, PROGRESS_EVENT); // final 2582 frontend->AddExpectedEvent(ids1, PROGRESS_EVENT); // final
2583 frontend->AddExpectedEvent(ids1, CACHED_EVENT); 2583 frontend->AddExpectedEvent(ids1, CACHED_EVENT);
2584 2584
2585 // Group status will be IDLE so cannot call WaitForUpdateToFinish. 2585 // Group status will be IDLE so cannot call WaitForUpdateToFinish.
2586 group_->AddUpdateObserver(this); 2586 group_->AddUpdateObserver(this);
2587 } 2587 }
2588 2588
2589 void IfModifiedSinceTest() { 2589 void IfModifiedSinceTest() {
2590 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); 2590 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type());
2591 2591
2592 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactory); 2592 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl);
2593 new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory); 2593 new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory);
2594 io_thread_->SetNewJobFactory(new_factory); 2594 io_thread_->SetNewJobFactory(new_factory);
2595 2595
2596 MakeService(); 2596 MakeService();
2597 group_ = new AppCacheGroup(service_.get(), GURL("http://headertest"), 111); 2597 group_ = new AppCacheGroup(service_.get(), GURL("http://headertest"), 111);
2598 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); 2598 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
2599 group_->update_job_ = update; 2599 group_->update_job_ = update;
2600 2600
2601 // First test against a cache attempt. Will start manifest fetch 2601 // First test against a cache attempt. Will start manifest fetch
2602 // synchronously. 2602 // synchronously.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
2648 HttpHeadersRequestTestJob::Verify(); 2648 HttpHeadersRequestTestJob::Verify();
2649 delete update; 2649 delete update;
2650 2650
2651 UpdateFinished(); 2651 UpdateFinished();
2652 } 2652 }
2653 2653
2654 void IfModifiedSinceUpgradeTest() { 2654 void IfModifiedSinceUpgradeTest() {
2655 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); 2655 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type());
2656 2656
2657 HttpHeadersRequestTestJob::Initialize("Sat, 29 Oct 1994 19:43:31 GMT", ""); 2657 HttpHeadersRequestTestJob::Initialize("Sat, 29 Oct 1994 19:43:31 GMT", "");
2658 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactory); 2658 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl);
2659 new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory); 2659 new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory);
2660 io_thread_->SetNewJobFactory(new_factory); 2660 io_thread_->SetNewJobFactory(new_factory);
2661 2661
2662 MakeService(); 2662 MakeService();
2663 group_ = new AppCacheGroup( 2663 group_ = new AppCacheGroup(
2664 service_.get(), MockHttpServer::GetMockUrl("files/manifest1"), 111); 2664 service_.get(), MockHttpServer::GetMockUrl("files/manifest1"), 111);
2665 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); 2665 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
2666 group_->update_job_ = update; 2666 group_->update_job_ = update;
2667 2667
2668 // Give the newest cache a manifest enry that is in storage. 2668 // Give the newest cache a manifest enry that is in storage.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
2707 base::Bind(&AppCacheUpdateJobTest::StartUpdateAfterSeedingStorageData, 2707 base::Bind(&AppCacheUpdateJobTest::StartUpdateAfterSeedingStorageData,
2708 base::Unretained(this))); 2708 base::Unretained(this)));
2709 2709
2710 // Start update after data write completes asynchronously. 2710 // Start update after data write completes asynchronously.
2711 } 2711 }
2712 2712
2713 void IfNoneMatchUpgradeTest() { 2713 void IfNoneMatchUpgradeTest() {
2714 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); 2714 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type());
2715 2715
2716 HttpHeadersRequestTestJob::Initialize("", "\"LadeDade\""); 2716 HttpHeadersRequestTestJob::Initialize("", "\"LadeDade\"");
2717 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactory); 2717 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl);
2718 new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory); 2718 new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory);
2719 io_thread_->SetNewJobFactory(new_factory); 2719 io_thread_->SetNewJobFactory(new_factory);
2720 2720
2721 MakeService(); 2721 MakeService();
2722 group_ = new AppCacheGroup( 2722 group_ = new AppCacheGroup(
2723 service_.get(), MockHttpServer::GetMockUrl("files/manifest1"), 111); 2723 service_.get(), MockHttpServer::GetMockUrl("files/manifest1"), 111);
2724 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); 2724 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
2725 group_->update_job_ = update; 2725 group_->update_job_ = update;
2726 2726
2727 // Give the newest cache a manifest enry that is in storage. 2727 // Give the newest cache a manifest enry that is in storage.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
2766 base::Bind(&AppCacheUpdateJobTest::StartUpdateAfterSeedingStorageData, 2766 base::Bind(&AppCacheUpdateJobTest::StartUpdateAfterSeedingStorageData,
2767 base::Unretained(this))); 2767 base::Unretained(this)));
2768 2768
2769 // Start update after data write completes asynchronously. 2769 // Start update after data write completes asynchronously.
2770 } 2770 }
2771 2771
2772 void IfNoneMatchRefetchTest() { 2772 void IfNoneMatchRefetchTest() {
2773 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); 2773 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type());
2774 2774
2775 HttpHeadersRequestTestJob::Initialize("", "\"LadeDade\""); 2775 HttpHeadersRequestTestJob::Initialize("", "\"LadeDade\"");
2776 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactory); 2776 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl);
2777 new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory); 2777 new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory);
2778 io_thread_->SetNewJobFactory(new_factory); 2778 io_thread_->SetNewJobFactory(new_factory);
2779 2779
2780 MakeService(); 2780 MakeService();
2781 group_ = new AppCacheGroup(service_.get(), GURL("http://headertest"), 111); 2781 group_ = new AppCacheGroup(service_.get(), GURL("http://headertest"), 111);
2782 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); 2782 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
2783 group_->update_job_ = update; 2783 group_->update_job_ = update;
2784 2784
2785 // Simulate a refetch manifest request that uses an ETag header. 2785 // Simulate a refetch manifest request that uses an ETag header.
2786 const char data[] = 2786 const char data[] =
(...skipping 14 matching lines...) Expand all
2801 2801
2802 UpdateFinished(); 2802 UpdateFinished();
2803 } 2803 }
2804 2804
2805 void MultipleHeadersRefetchTest() { 2805 void MultipleHeadersRefetchTest() {
2806 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); 2806 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type());
2807 2807
2808 // Verify that code is correct when building multiple extra headers. 2808 // Verify that code is correct when building multiple extra headers.
2809 HttpHeadersRequestTestJob::Initialize( 2809 HttpHeadersRequestTestJob::Initialize(
2810 "Sat, 29 Oct 1994 19:43:31 GMT", "\"LadeDade\""); 2810 "Sat, 29 Oct 1994 19:43:31 GMT", "\"LadeDade\"");
2811 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactory); 2811 net::URLRequestJobFactory* new_factory(new net::URLRequestJobFactoryImpl);
2812 new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory); 2812 new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory);
2813 io_thread_->SetNewJobFactory(new_factory); 2813 io_thread_->SetNewJobFactory(new_factory);
2814 2814
2815 MakeService(); 2815 MakeService();
2816 group_ = new AppCacheGroup(service_.get(), GURL("http://headertest"), 111); 2816 group_ = new AppCacheGroup(service_.get(), GURL("http://headertest"), 111);
2817 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); 2817 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
2818 group_->update_job_ = update; 2818 group_->update_job_ = update;
2819 2819
2820 // Simulate a refetch manifest request that uses an ETag header. 2820 // Simulate a refetch manifest request that uses an ETag header.
2821 const char data[] = 2821 const char data[] =
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
3567 3567
3568 TEST_F(AppCacheUpdateJobTest, CrossOriginHttpsSuccess) { 3568 TEST_F(AppCacheUpdateJobTest, CrossOriginHttpsSuccess) {
3569 RunTestOnIOThread(&AppCacheUpdateJobTest::CrossOriginHttpsSuccessTest); 3569 RunTestOnIOThread(&AppCacheUpdateJobTest::CrossOriginHttpsSuccessTest);
3570 } 3570 }
3571 3571
3572 TEST_F(AppCacheUpdateJobTest, CrossOriginHttpsDenied) { 3572 TEST_F(AppCacheUpdateJobTest, CrossOriginHttpsDenied) {
3573 RunTestOnIOThread(&AppCacheUpdateJobTest::CrossOriginHttpsDeniedTest); 3573 RunTestOnIOThread(&AppCacheUpdateJobTest::CrossOriginHttpsDeniedTest);
3574 } 3574 }
3575 3575
3576 } // namespace appcache 3576 } // namespace appcache
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698