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

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

Issue 7720022: Third-party appcache blocking. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Code review comments (not all). Created 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/stl_util.h" 7 #include "base/stl_util.h"
8 #include "base/threading/thread.h" 8 #include "base/threading/thread.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
11 #include "net/http/http_response_headers.h" 11 #include "net/http/http_response_headers.h"
12 #include "net/url_request/url_request_error_job.h" 12 #include "net/url_request/url_request_error_job.h"
13 #include "net/url_request/url_request_job_factory.h" 13 #include "net/url_request/url_request_job_factory.h"
14 #include "net/url_request/url_request_test_job.h" 14 #include "net/url_request/url_request_test_job.h"
15 #include "net/url_request/url_request_test_util.h" 15 #include "net/url_request/url_request_test_util.h"
16 #include "webkit/appcache/appcache_group.h" 16 #include "webkit/appcache/appcache_group.h"
17 #include "webkit/appcache/appcache_host.h" 17 #include "webkit/appcache/appcache_host.h"
18 #include "webkit/appcache/appcache_policy.h" 18 #include "webkit/appcache/appcache_request_handler.h"
19 #include "webkit/appcache/appcache_response.h" 19 #include "webkit/appcache/appcache_response.h"
20 #include "webkit/appcache/appcache_update_job.h" 20 #include "webkit/appcache/appcache_update_job.h"
21 #include "webkit/appcache/mock_appcache_service.h" 21 #include "webkit/appcache/mock_appcache_service.h"
22 #include "webkit/glue/resource_type.h"
22 23
23 namespace appcache { 24 namespace appcache {
24 class AppCacheUpdateJobTest; 25 class AppCacheUpdateJobTest;
25 26
26 namespace { 27 namespace {
27 28
28 const char kManifest1Contents[] = 29 const char kManifest1Contents[] =
29 "CACHE MANIFEST\n" 30 "CACHE MANIFEST\n"
30 "explicit1\n" 31 "explicit1\n"
31 "FALLBACK:\n" 32 "FALLBACK:\n"
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 } 545 }
545 546
546 private: 547 private:
547 scoped_ptr<net::URLRequestJobFactory> job_factory_; 548 scoped_ptr<net::URLRequestJobFactory> job_factory_;
548 scoped_refptr<net::URLRequestContext> request_context_; 549 scoped_refptr<net::URLRequestContext> request_context_;
549 }; 550 };
550 551
551 class AppCacheUpdateJobTest : public testing::Test, 552 class AppCacheUpdateJobTest : public testing::Test,
552 public AppCacheGroup::UpdateObserver { 553 public AppCacheGroup::UpdateObserver {
553 public: 554 public:
554 class MockAppCachePolicy : public AppCachePolicy {
555 public:
556 MockAppCachePolicy()
557 : can_create_return_value_(net::OK), return_immediately_(true),
558 callback_(NULL) {
559 }
560
561 virtual bool CanLoadAppCache(const GURL& manifest_url) {
562 return true;
563 }
564
565 virtual int CanCreateAppCache(const GURL& manifest_url,
566 net::CompletionCallback* callback) {
567 requested_manifest_url_ = manifest_url;
568 callback_ = callback;
569 if (return_immediately_)
570 return can_create_return_value_;
571
572 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod(
573 this, &MockAppCachePolicy::CompleteCanCreateAppCache));
574 return net::ERR_IO_PENDING;
575 }
576
577 void CompleteCanCreateAppCache() {
578 callback_->Run(can_create_return_value_);
579 }
580
581 int can_create_return_value_;
582 bool return_immediately_;
583 GURL requested_manifest_url_;
584 net::CompletionCallback* callback_;
585 };
586
587
588 AppCacheUpdateJobTest() 555 AppCacheUpdateJobTest()
589 : do_checks_after_update_finished_(false), 556 : do_checks_after_update_finished_(false),
590 expect_group_obsolete_(false), 557 expect_group_obsolete_(false),
591 expect_group_has_cache_(false), 558 expect_group_has_cache_(false),
592 expect_old_cache_(NULL), 559 expect_old_cache_(NULL),
593 expect_newest_cache_(NULL), 560 expect_newest_cache_(NULL),
594 expect_non_null_update_time_(false), 561 expect_non_null_update_time_(false),
595 tested_manifest_(NONE), 562 tested_manifest_(NONE),
596 tested_manifest_path_override_(NULL) { 563 tested_manifest_path_override_(NULL) {
597 io_thread_.reset(new IOThread("AppCacheUpdateJob IO test thread")); 564 io_thread_.reset(new IOThread("AppCacheUpdateJob IO test thread"));
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 EXPECT_EQ(expected, events.size()); 604 EXPECT_EQ(expected, events.size());
638 EXPECT_EQ(expected, events[0].first.size()); 605 EXPECT_EQ(expected, events[0].first.size());
639 EXPECT_EQ(host.host_id(), events[0].first[0]); 606 EXPECT_EQ(host.host_id(), events[0].first[0]);
640 EXPECT_EQ(CHECKING_EVENT, events[0].second); 607 EXPECT_EQ(CHECKING_EVENT, events[0].second);
641 608
642 // Abort as we're not testing actual URL fetches in this test. 609 // Abort as we're not testing actual URL fetches in this test.
643 delete update; 610 delete update;
644 UpdateFinished(); 611 UpdateFinished();
645 } 612 }
646 613
647 void ImmediatelyBlockCacheAttemptTest() {
648 BlockCacheAttemptTest(true);
649 }
650
651 void DelayedBlockCacheAttemptTest() {
652 BlockCacheAttemptTest(false);
653 }
654
655 void BlockCacheAttemptTest(bool immediately) {
656 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type());
657
658 GURL manifest_url = GURL("http://failme");
659
660 // Setup to block the cache attempt immediately.
661 policy_.return_immediately_ = immediately;
662 policy_.can_create_return_value_ = net::ERR_ACCESS_DENIED;
663
664 MakeService();
665 group_ = new AppCacheGroup(service_.get(), manifest_url,
666 service_->storage()->NewGroupId());
667
668 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
669 group_->update_job_ = update;
670
671 MockFrontend mock_frontend;
672 AppCacheHost host(1, &mock_frontend, service_.get());
673
674 update->StartUpdate(&host, GURL());
675 EXPECT_EQ(manifest_url, policy_.requested_manifest_url_);
676
677 // Verify state.
678 EXPECT_EQ(AppCacheUpdateJob::CACHE_ATTEMPT, update->update_type_);
679 EXPECT_EQ(AppCacheUpdateJob::FETCH_MANIFEST, update->internal_state_);
680 EXPECT_EQ(AppCacheGroup::CHECKING, group_->update_status());
681
682 // Verify notifications.
683 MockFrontend::RaisedEvents& events = mock_frontend.raised_events_;
684 size_t expected = 1;
685 EXPECT_EQ(expected, events.size());
686 EXPECT_EQ(1U, events[0].first.size());
687 EXPECT_EQ(host.host_id(), events[0].first[0]);
688 EXPECT_EQ(CHECKING_EVENT, events[0].second);
689
690 WaitForUpdateToFinish();
691 }
692
693 void StartUpgradeAttemptTest() { 614 void StartUpgradeAttemptTest() {
694 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); 615 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type());
695 616
696 { 617 {
697 MakeService(); 618 MakeService();
698 group_ = new AppCacheGroup(service_.get(), GURL("http://failme"), 619 group_ = new AppCacheGroup(service_.get(), GURL("http://failme"),
699 service_->storage()->NewGroupId()); 620 service_->storage()->NewGroupId());
700 621
701 // Give the group some existing caches. 622 // Give the group some existing caches.
702 AppCache* cache1 = MakeCacheForGroup(1, 111); 623 AppCache* cache1 = MakeCacheForGroup(1, 111);
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 EXPECT_TRUE(update->manifest_fetcher_ != NULL); 972 EXPECT_TRUE(update->manifest_fetcher_ != NULL);
1052 973
1053 WaitForUpdateToFinish(); 974 WaitForUpdateToFinish();
1054 } 975 }
1055 976
1056 void BasicCacheAttemptSuccessTest() { 977 void BasicCacheAttemptSuccessTest() {
1057 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); 978 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type());
1058 979
1059 GURL manifest_url = MockHttpServer::GetMockUrl("files/manifest1"); 980 GURL manifest_url = MockHttpServer::GetMockUrl("files/manifest1");
1060 981
1061 // We also test the async AppCachePolicy return path in this test case.
1062 policy_.return_immediately_ = false;
1063 policy_.can_create_return_value_ = net::OK;
1064
1065 MakeService(); 982 MakeService();
1066 group_ = new AppCacheGroup( 983 group_ = new AppCacheGroup(
1067 service_.get(), manifest_url, 984 service_.get(), manifest_url,
1068 service_->storage()->NewGroupId()); 985 service_->storage()->NewGroupId());
1069 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); 986 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
1070 group_->update_job_ = update; 987 group_->update_job_ = update;
1071 988
1072 MockFrontend* frontend = MakeMockFrontend(); 989 MockFrontend* frontend = MakeMockFrontend();
1073 AppCacheHost* host = MakeHost(1, frontend); 990 AppCacheHost* host = MakeHost(1, frontend);
1074 update->StartUpdate(host, GURL()); 991 update->StartUpdate(host, GURL());
1075 EXPECT_EQ(manifest_url, policy_.requested_manifest_url_);;
1076 992
1077 // Set up checks for when update job finishes. 993 // Set up checks for when update job finishes.
1078 do_checks_after_update_finished_ = true; 994 do_checks_after_update_finished_ = true;
1079 expect_group_obsolete_ = false; 995 expect_group_obsolete_ = false;
1080 expect_group_has_cache_ = true; 996 expect_group_has_cache_ = true;
1081 tested_manifest_ = MANIFEST1; 997 tested_manifest_ = MANIFEST1;
1082 frontend->AddExpectedEvent(MockFrontend::HostIds(1, host->host_id()), 998 frontend->AddExpectedEvent(MockFrontend::HostIds(1, host->host_id()),
1083 CHECKING_EVENT); 999 CHECKING_EVENT);
1084 1000
1085 WaitForUpdateToFinish(); 1001 WaitForUpdateToFinish();
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
1861 1777
1862 group_ = new AppCacheGroup( 1778 group_ = new AppCacheGroup(
1863 service_.get(), kManifestUrl, 1779 service_.get(), kManifestUrl,
1864 service_->storage()->NewGroupId()); 1780 service_->storage()->NewGroupId());
1865 scoped_refptr<AppCache> cache( 1781 scoped_refptr<AppCache> cache(
1866 MakeCacheForGroup(service_->storage()->NewCacheId(), 1782 MakeCacheForGroup(service_->storage()->NewCacheId(),
1867 kManifestResponseId)); 1783 kManifestResponseId));
1868 1784
1869 MockFrontend* frontend = MakeMockFrontend(); 1785 MockFrontend* frontend = MakeMockFrontend();
1870 AppCacheHost* host = MakeHost(1, frontend); 1786 AppCacheHost* host = MakeHost(1, frontend);
1787 net::URLRequest url_request(kManifestUrl, NULL);
1788 url_request.set_first_party_for_cookies(kManifestUrl);
1789 delete host->CreateRequestHandler(&url_request, ResourceType::MAIN_FRAME);
1871 host->SelectCache(MockHttpServer::GetMockUrl("files/empty1"), 1790 host->SelectCache(MockHttpServer::GetMockUrl("files/empty1"),
1872 kNoCacheId, kManifestUrl); 1791 kNoCacheId, kManifestUrl);
1873 1792
1874 // Set up checks for when update job finishes. 1793 // Set up checks for when update job finishes.
1875 do_checks_after_update_finished_ = true; 1794 do_checks_after_update_finished_ = true;
1876 tested_manifest_ = EMPTY_MANIFEST; 1795 tested_manifest_ = EMPTY_MANIFEST;
1877 tested_manifest_path_override_ = "files/notmodified"; 1796 tested_manifest_path_override_ = "files/notmodified";
1878 expect_group_obsolete_ = false; 1797 expect_group_obsolete_ = false;
1879 expect_group_has_cache_ = true; 1798 expect_group_has_cache_ = true;
1880 expect_newest_cache_ = cache; // unchanged 1799 expect_newest_cache_ = cache; // unchanged
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after
2836 MakeService(); 2755 MakeService();
2837 group_ = new AppCacheGroup( 2756 group_ = new AppCacheGroup(
2838 service_.get(), manifest_url, 2757 service_.get(), manifest_url,
2839 service_->storage()->NewGroupId()); 2758 service_->storage()->NewGroupId());
2840 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); 2759 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
2841 group_->update_job_ = update; 2760 group_->update_job_ = update;
2842 2761
2843 MockFrontend* frontend = MakeMockFrontend(); 2762 MockFrontend* frontend = MakeMockFrontend();
2844 AppCacheHost* host = MakeHost(1, frontend); 2763 AppCacheHost* host = MakeHost(1, frontend);
2845 update->StartUpdate(host, GURL()); 2764 update->StartUpdate(host, GURL());
2846 EXPECT_EQ(manifest_url, policy_.requested_manifest_url_);
2847 2765
2848 // Set up checks for when update job finishes. 2766 // Set up checks for when update job finishes.
2849 do_checks_after_update_finished_ = true; 2767 do_checks_after_update_finished_ = true;
2850 expect_group_obsolete_ = false; 2768 expect_group_obsolete_ = false;
2851 expect_group_has_cache_ = true; 2769 expect_group_has_cache_ = true;
2852 tested_manifest_ = NONE; 2770 tested_manifest_ = NONE;
2853 MockFrontend::HostIds host_ids(1, host->host_id()); 2771 MockFrontend::HostIds host_ids(1, host->host_id());
2854 frontend->AddExpectedEvent(host_ids, CHECKING_EVENT); 2772 frontend->AddExpectedEvent(host_ids, CHECKING_EVENT);
2855 2773
2856 WaitForUpdateToFinish(); 2774 WaitForUpdateToFinish();
2857 } 2775 }
2858 2776
2859 void CrossOriginHttpsDeniedTest() { 2777 void CrossOriginHttpsDeniedTest() {
2860 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); 2778 ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type());
2861 2779
2862 GURL manifest_url = MockHttpServer::GetMockHttpsUrl( 2780 GURL manifest_url = MockHttpServer::GetMockHttpsUrl(
2863 "files/invalid_cross_origin_https_manifest"); 2781 "files/invalid_cross_origin_https_manifest");
2864 2782
2865 MakeService(); 2783 MakeService();
2866 group_ = new AppCacheGroup( 2784 group_ = new AppCacheGroup(
2867 service_.get(), manifest_url, 2785 service_.get(), manifest_url,
2868 service_->storage()->NewGroupId()); 2786 service_->storage()->NewGroupId());
2869 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); 2787 AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_);
2870 group_->update_job_ = update; 2788 group_->update_job_ = update;
2871 2789
2872 MockFrontend* frontend = MakeMockFrontend(); 2790 MockFrontend* frontend = MakeMockFrontend();
2873 AppCacheHost* host = MakeHost(1, frontend); 2791 AppCacheHost* host = MakeHost(1, frontend);
2874 update->StartUpdate(host, GURL()); 2792 update->StartUpdate(host, GURL());
2875 EXPECT_EQ(manifest_url, policy_.requested_manifest_url_);
2876 2793
2877 // Set up checks for when update job finishes. 2794 // Set up checks for when update job finishes.
2878 do_checks_after_update_finished_ = true; 2795 do_checks_after_update_finished_ = true;
2879 expect_group_obsolete_ = false; 2796 expect_group_obsolete_ = false;
2880 expect_group_has_cache_ = false; 2797 expect_group_has_cache_ = false;
2881 tested_manifest_ = NONE; 2798 tested_manifest_ = NONE;
2882 MockFrontend::HostIds host_ids(1, host->host_id()); 2799 MockFrontend::HostIds host_ids(1, host->host_id());
2883 frontend->AddExpectedEvent(host_ids, CHECKING_EVENT); 2800 frontend->AddExpectedEvent(host_ids, CHECKING_EVENT);
2884 2801
2885 WaitForUpdateToFinish(); 2802 WaitForUpdateToFinish();
2886 } 2803 }
2887 2804
2888 void WaitForUpdateToFinish() { 2805 void WaitForUpdateToFinish() {
2889 if (group_->update_status() == AppCacheGroup::IDLE) 2806 if (group_->update_status() == AppCacheGroup::IDLE)
2890 UpdateFinished(); 2807 UpdateFinished();
2891 else 2808 else
2892 group_->AddUpdateObserver(this); 2809 group_->AddUpdateObserver(this);
2893 } 2810 }
2894 2811
2895 void OnUpdateComplete(AppCacheGroup* group) { 2812 void OnUpdateComplete(AppCacheGroup* group) {
2896 ASSERT_EQ(group_, group); 2813 ASSERT_EQ(group_, group);
2897 protect_newest_cache_ = group->newest_complete_cache(); 2814 protect_newest_cache_ = group->newest_complete_cache();
2898 UpdateFinished(); 2815 UpdateFinished();
2899 } 2816 }
2900 2817
2901 void OnContentBlocked(AppCacheGroup* group) {
2902 }
2903
2904 void UpdateFinished() { 2818 void UpdateFinished() {
2905 // We unwind the stack prior to finishing up to let stack-based objects 2819 // We unwind the stack prior to finishing up to let stack-based objects
2906 // get deleted. 2820 // get deleted.
2907 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( 2821 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod(
2908 this, &AppCacheUpdateJobTest::UpdateFinishedUnwound)); 2822 this, &AppCacheUpdateJobTest::UpdateFinishedUnwound));
2909 } 2823 }
2910 2824
2911 void UpdateFinishedUnwound() { 2825 void UpdateFinishedUnwound() {
2912 EXPECT_EQ(AppCacheGroup::IDLE, group_->update_status()); 2826 EXPECT_EQ(AppCacheGroup::IDLE, group_->update_status());
2913 EXPECT_TRUE(group_->update_job() == NULL); 2827 EXPECT_TRUE(group_->update_job() == NULL);
2914 if (do_checks_after_update_finished_) 2828 if (do_checks_after_update_finished_)
2915 VerifyExpectations(); 2829 VerifyExpectations();
2916 2830
2917 // Clean up everything that was created on the IO thread. 2831 // Clean up everything that was created on the IO thread.
2918 protect_newest_cache_ = NULL; 2832 protect_newest_cache_ = NULL;
2919 group_ = NULL; 2833 group_ = NULL;
2920 STLDeleteContainerPointers(hosts_.begin(), hosts_.end()); 2834 STLDeleteContainerPointers(hosts_.begin(), hosts_.end());
2921 STLDeleteContainerPointers(frontends_.begin(), frontends_.end()); 2835 STLDeleteContainerPointers(frontends_.begin(), frontends_.end());
2922 response_infos_.clear(); 2836 response_infos_.clear();
2923 service_.reset(NULL); 2837 service_.reset(NULL);
2924 2838
2925 event_->Signal(); 2839 event_->Signal();
2926 } 2840 }
2927 2841
2928 void MakeService() { 2842 void MakeService() {
2929 service_.reset(new MockAppCacheService()); 2843 service_.reset(new MockAppCacheService());
2930 service_->set_request_context(io_thread_->request_context()); 2844 service_->set_request_context(io_thread_->request_context());
2931 service_->set_appcache_policy(&policy_);
2932 } 2845 }
2933 2846
2934 AppCache* MakeCacheForGroup(int64 cache_id, int64 manifest_response_id) { 2847 AppCache* MakeCacheForGroup(int64 cache_id, int64 manifest_response_id) {
2935 AppCache* cache = new AppCache(service_.get(), cache_id); 2848 AppCache* cache = new AppCache(service_.get(), cache_id);
2936 cache->set_complete(true); 2849 cache->set_complete(true);
2937 cache->set_update_time(base::Time::Now()); 2850 cache->set_update_time(base::Time::Now());
2938 group_->AddCache(cache); 2851 group_->AddCache(cache);
2939 2852
2940 // Add manifest entry to cache. 2853 // Add manifest entry to cache.
2941 cache->AddEntry(group_->manifest_url(), 2854 cache->AddEntry(group_->manifest_url(),
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
3234 EMPTY_FILE_MANIFEST, 3147 EMPTY_FILE_MANIFEST,
3235 PENDING_MASTER_NO_UPDATE, 3148 PENDING_MASTER_NO_UPDATE,
3236 }; 3149 };
3237 3150
3238 scoped_ptr<IOThread> io_thread_; 3151 scoped_ptr<IOThread> io_thread_;
3239 3152
3240 scoped_ptr<MockAppCacheService> service_; 3153 scoped_ptr<MockAppCacheService> service_;
3241 scoped_refptr<AppCacheGroup> group_; 3154 scoped_refptr<AppCacheGroup> group_;
3242 scoped_refptr<AppCache> protect_newest_cache_; 3155 scoped_refptr<AppCache> protect_newest_cache_;
3243 scoped_ptr<base::WaitableEvent> event_; 3156 scoped_ptr<base::WaitableEvent> event_;
3244 MockAppCachePolicy policy_;
3245 3157
3246 scoped_ptr<AppCacheResponseWriter> response_writer_; 3158 scoped_ptr<AppCacheResponseWriter> response_writer_;
3247 scoped_ptr<net::CompletionCallbackImpl<AppCacheUpdateJobTest> > 3159 scoped_ptr<net::CompletionCallbackImpl<AppCacheUpdateJobTest> >
3248 write_callback_; 3160 write_callback_;
3249 3161
3250 // Hosts used by an async test that need to live until update job finishes. 3162 // Hosts used by an async test that need to live until update job finishes.
3251 // Otherwise, test can put host on the stack instead of here. 3163 // Otherwise, test can put host on the stack instead of here.
3252 std::vector<AppCacheHost*> hosts_; 3164 std::vector<AppCacheHost*> hosts_;
3253 3165
3254 // Response infos used by an async test that need to live until update job 3166 // Response infos used by an async test that need to live until update job
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
3328 EXPECT_EQ(host.host_id(), events[1].first[0]); 3240 EXPECT_EQ(host.host_id(), events[1].first[0]);
3329 EXPECT_EQ(appcache::DOWNLOADING_EVENT, events[1].second); 3241 EXPECT_EQ(appcache::DOWNLOADING_EVENT, events[1].second);
3330 3242
3331 EXPECT_EQ(AppCacheGroup::DOWNLOADING, group->update_status()); 3243 EXPECT_EQ(AppCacheGroup::DOWNLOADING, group->update_status());
3332 } 3244 }
3333 3245
3334 TEST_F(AppCacheUpdateJobTest, StartCacheAttempt) { 3246 TEST_F(AppCacheUpdateJobTest, StartCacheAttempt) {
3335 RunTestOnIOThread(&AppCacheUpdateJobTest::StartCacheAttemptTest); 3247 RunTestOnIOThread(&AppCacheUpdateJobTest::StartCacheAttemptTest);
3336 } 3248 }
3337 3249
3338 TEST_F(AppCacheUpdateJobTest, ImmediatelyBlockCacheAttemptTest) {
3339 RunTestOnIOThread(&AppCacheUpdateJobTest::ImmediatelyBlockCacheAttemptTest);
3340 }
3341
3342 TEST_F(AppCacheUpdateJobTest, DelayedBlockCacheAttemptTest) {
3343 RunTestOnIOThread(&AppCacheUpdateJobTest::DelayedBlockCacheAttemptTest);
3344 }
3345
3346 TEST_F(AppCacheUpdateJobTest, StartUpgradeAttempt) { 3250 TEST_F(AppCacheUpdateJobTest, StartUpgradeAttempt) {
3347 RunTestOnIOThread(&AppCacheUpdateJobTest::StartUpgradeAttemptTest); 3251 RunTestOnIOThread(&AppCacheUpdateJobTest::StartUpgradeAttemptTest);
3348 } 3252 }
3349 3253
3350 TEST_F(AppCacheUpdateJobTest, CacheAttemptFetchManifestFail) { 3254 TEST_F(AppCacheUpdateJobTest, CacheAttemptFetchManifestFail) {
3351 RunTestOnIOThread(&AppCacheUpdateJobTest::CacheAttemptFetchManifestFailTest); 3255 RunTestOnIOThread(&AppCacheUpdateJobTest::CacheAttemptFetchManifestFailTest);
3352 } 3256 }
3353 3257
3354 TEST_F(AppCacheUpdateJobTest, UpgradeFetchManifestFail) { 3258 TEST_F(AppCacheUpdateJobTest, UpgradeFetchManifestFail) {
3355 RunTestOnIOThread(&AppCacheUpdateJobTest::UpgradeFetchManifestFailTest); 3259 RunTestOnIOThread(&AppCacheUpdateJobTest::UpgradeFetchManifestFailTest);
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
3543 3447
3544 TEST_F(AppCacheUpdateJobTest, CrossOriginHttpsDenied) { 3448 TEST_F(AppCacheUpdateJobTest, CrossOriginHttpsDenied) {
3545 RunTestOnIOThread(&AppCacheUpdateJobTest::CrossOriginHttpsDeniedTest); 3449 RunTestOnIOThread(&AppCacheUpdateJobTest::CrossOriginHttpsDeniedTest);
3546 } 3450 }
3547 3451
3548 } // namespace appcache 3452 } // namespace appcache
3549 3453
3550 // AppCacheUpdateJobTest is expected to always live longer than the 3454 // AppCacheUpdateJobTest is expected to always live longer than the
3551 // runnable methods. This lets us call NewRunnableMethod on its instances. 3455 // runnable methods. This lets us call NewRunnableMethod on its instances.
3552 DISABLE_RUNNABLE_METHOD_REFCOUNT(appcache::AppCacheUpdateJobTest); 3456 DISABLE_RUNNABLE_METHOD_REFCOUNT(appcache::AppCacheUpdateJobTest);
3553 DISABLE_RUNNABLE_METHOD_REFCOUNT(
3554 appcache::AppCacheUpdateJobTest::MockAppCachePolicy);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698