| 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 <stack> | 5 #include <stack> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/synchronization/waitable_event.h" | 13 #include "base/synchronization/waitable_event.h" |
| 14 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
| 15 #include "content/browser/appcache/mock_appcache_policy.h" | 15 #include "content/browser/appcache/mock_appcache_policy.h" |
| 16 #include "content/browser/appcache/mock_appcache_service.h" | 16 #include "content/browser/appcache/mock_appcache_service.h" |
| 17 #include "net/base/net_errors.h" | 17 #include "net/base/net_errors.h" |
| 18 #include "net/base/request_priority.h" | 18 #include "net/base/request_priority.h" |
| 19 #include "net/http/http_response_headers.h" | 19 #include "net/http/http_response_headers.h" |
| 20 #include "net/url_request/url_request.h" | 20 #include "net/url_request/url_request.h" |
| 21 #include "net/url_request/url_request_context.h" | 21 #include "net/url_request/url_request_context.h" |
| 22 #include "net/url_request/url_request_error_job.h" | 22 #include "net/url_request/url_request_error_job.h" |
| 23 #include "net/url_request/url_request_job_factory.h" |
| 23 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
| 24 #include "webkit/browser/appcache/appcache.h" | 25 #include "webkit/browser/appcache/appcache.h" |
| 25 #include "webkit/browser/appcache/appcache_backend_impl.h" | 26 #include "webkit/browser/appcache/appcache_backend_impl.h" |
| 26 #include "webkit/browser/appcache/appcache_request_handler.h" | 27 #include "webkit/browser/appcache/appcache_request_handler.h" |
| 27 #include "webkit/browser/appcache/appcache_url_request_job.h" | 28 #include "webkit/browser/appcache/appcache_url_request_job.h" |
| 28 | 29 |
| 29 using appcache::AppCache; | 30 using appcache::AppCache; |
| 30 using appcache::AppCacheBackendImpl; | 31 using appcache::AppCacheBackendImpl; |
| 31 using appcache::AppCacheEntry; | 32 using appcache::AppCacheEntry; |
| 32 using appcache::AppCacheFrontend; | 33 using appcache::AppCacheFrontend; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 return; | 122 return; |
| 122 *info = response_info_; | 123 *info = response_info_; |
| 123 } | 124 } |
| 124 | 125 |
| 125 private: | 126 private: |
| 126 int response_code_; | 127 int response_code_; |
| 127 bool has_response_info_; | 128 bool has_response_info_; |
| 128 net::HttpResponseInfo response_info_; | 129 net::HttpResponseInfo response_info_; |
| 129 }; | 130 }; |
| 130 | 131 |
| 132 class MockURLRequestJobFactory : public net::URLRequestJobFactory { |
| 133 public: |
| 134 MockURLRequestJobFactory() : job_(NULL) { |
| 135 } |
| 136 |
| 137 virtual ~MockURLRequestJobFactory() { |
| 138 DCHECK(!job_); |
| 139 } |
| 140 |
| 141 void SetJob(net::URLRequestJob* job) { |
| 142 job_ = job; |
| 143 } |
| 144 |
| 145 virtual net::URLRequestJob* MaybeCreateJobWithProtocolHandler( |
| 146 const std::string& scheme, |
| 147 net::URLRequest* request, |
| 148 net::NetworkDelegate* network_delegate) const OVERRIDE { |
| 149 if (job_) { |
| 150 net::URLRequestJob* temp = job_; |
| 151 job_ = NULL; |
| 152 return temp; |
| 153 } else { |
| 154 // Some of these tests trigger UpdateJobs which start URLRequests. |
| 155 // We short circuit those be returning error jobs. |
| 156 return new net::URLRequestErrorJob(request, |
| 157 network_delegate, |
| 158 net::ERR_INTERNET_DISCONNECTED); |
| 159 } |
| 160 } |
| 161 |
| 162 virtual bool IsHandledProtocol(const std::string& scheme) const OVERRIDE { |
| 163 return scheme == "http"; |
| 164 }; |
| 165 |
| 166 virtual bool IsHandledURL(const GURL& url) const OVERRIDE { |
| 167 return url.SchemeIs("http"); |
| 168 } |
| 169 |
| 170 virtual bool IsSafeRedirectTarget(const GURL& location) const OVERRIDE { |
| 171 return false; |
| 172 } |
| 173 |
| 174 private: |
| 175 mutable net::URLRequestJob* job_; |
| 176 }; |
| 177 |
| 131 class MockURLRequest : public net::URLRequest { | 178 class MockURLRequest : public net::URLRequest { |
| 132 public: | 179 public: |
| 133 MockURLRequest(const GURL& url, net::URLRequestContext* context) | 180 MockURLRequest(const GURL& url, net::URLRequestContext* context) |
| 134 : net::URLRequest(url, net::DEFAULT_PRIORITY, NULL, context) {} | 181 : net::URLRequest(url, net::DEFAULT_PRIORITY, NULL, context) {} |
| 135 | 182 |
| 136 void SimulateResponseCode(int http_response_code) { | |
| 137 mock_factory_job_ = new MockURLRequestJob( | |
| 138 this, context()->network_delegate(), http_response_code); | |
| 139 Start(); | |
| 140 DCHECK(!mock_factory_job_); | |
| 141 // All our simulation needs to satisfy are the following two DCHECKs | |
| 142 DCHECK(status().is_success()); | |
| 143 DCHECK_EQ(http_response_code, GetResponseCode()); | |
| 144 } | |
| 145 | |
| 146 void SimulateResponseInfo(const net::HttpResponseInfo& info) { | |
| 147 mock_factory_job_ = | |
| 148 new MockURLRequestJob(this, context()->network_delegate(), info); | |
| 149 set_delegate(&delegate_); // needed to get the info back out | |
| 150 Start(); | |
| 151 DCHECK(!mock_factory_job_); | |
| 152 } | |
| 153 | 183 |
| 154 MockURLRequestDelegate delegate_; | 184 MockURLRequestDelegate delegate_; |
| 155 }; | 185 }; |
| 156 | 186 |
| 157 static net::URLRequestJob* MockHttpJobFactory( | |
| 158 net::URLRequest* request, | |
| 159 net::NetworkDelegate* network_delegate, | |
| 160 const std::string& scheme) { | |
| 161 if (mock_factory_job_) { | |
| 162 net::URLRequestJob* temp = mock_factory_job_; | |
| 163 mock_factory_job_ = NULL; | |
| 164 return temp; | |
| 165 } else { | |
| 166 // Some of these tests trigger UpdateJobs which start URLRequests. | |
| 167 // We short circuit those be returning error jobs. | |
| 168 return new net::URLRequestErrorJob(request, | |
| 169 network_delegate, | |
| 170 net::ERR_INTERNET_DISCONNECTED); | |
| 171 } | |
| 172 } | |
| 173 | |
| 174 static void SetUpTestCase() { | 187 static void SetUpTestCase() { |
| 175 io_thread_.reset(new base::Thread("AppCacheRequestHandlerTest Thread")); | 188 io_thread_.reset(new base::Thread("AppCacheRequestHandlerTest Thread")); |
| 176 base::Thread::Options options(base::MessageLoop::TYPE_IO, 0); | 189 base::Thread::Options options(base::MessageLoop::TYPE_IO, 0); |
| 177 io_thread_->StartWithOptions(options); | 190 io_thread_->StartWithOptions(options); |
| 178 } | 191 } |
| 179 | 192 |
| 180 static void TearDownTestCase() { | 193 static void TearDownTestCase() { |
| 181 io_thread_.reset(NULL); | 194 io_thread_.reset(NULL); |
| 182 } | 195 } |
| 183 | 196 |
| 184 // Test harness -------------------------------------------------- | 197 // Test harness -------------------------------------------------- |
| 185 | 198 |
| 186 AppCacheRequestHandlerTest() : host_(NULL), orig_http_factory_(NULL) {} | 199 AppCacheRequestHandlerTest() : host_(NULL) {} |
| 187 | 200 |
| 188 template <class Method> | 201 template <class Method> |
| 189 void RunTestOnIOThread(Method method) { | 202 void RunTestOnIOThread(Method method) { |
| 190 test_finished_event_ .reset(new base::WaitableEvent(false, false)); | 203 test_finished_event_ .reset(new base::WaitableEvent(false, false)); |
| 191 io_thread_->message_loop()->PostTask( | 204 io_thread_->message_loop()->PostTask( |
| 192 FROM_HERE, | 205 FROM_HERE, |
| 193 base::Bind(&AppCacheRequestHandlerTest::MethodWrapper<Method>, | 206 base::Bind(&AppCacheRequestHandlerTest::MethodWrapper<Method>, |
| 194 base::Unretained(this), method)); | 207 base::Unretained(this), method)); |
| 195 test_finished_event_->Wait(); | 208 test_finished_event_->Wait(); |
| 196 } | 209 } |
| 197 | 210 |
| 198 void SetUpTest() { | 211 void SetUpTest() { |
| 199 DCHECK(base::MessageLoop::current() == io_thread_->message_loop()); | 212 DCHECK(base::MessageLoop::current() == io_thread_->message_loop()); |
| 200 orig_http_factory_ = net::URLRequest::Deprecated::RegisterProtocolFactory( | |
| 201 "http", MockHttpJobFactory); | |
| 202 mock_service_.reset(new MockAppCacheService); | 213 mock_service_.reset(new MockAppCacheService); |
| 203 mock_service_->set_request_context(&empty_context_); | 214 mock_service_->set_request_context(&empty_context_); |
| 204 mock_policy_.reset(new MockAppCachePolicy); | 215 mock_policy_.reset(new MockAppCachePolicy); |
| 205 mock_service_->set_appcache_policy(mock_policy_.get()); | 216 mock_service_->set_appcache_policy(mock_policy_.get()); |
| 206 mock_frontend_.reset(new MockFrontend); | 217 mock_frontend_.reset(new MockFrontend); |
| 207 backend_impl_.reset(new AppCacheBackendImpl); | 218 backend_impl_.reset(new AppCacheBackendImpl); |
| 208 backend_impl_->Initialize(mock_service_.get(), mock_frontend_.get(), | 219 backend_impl_->Initialize(mock_service_.get(), mock_frontend_.get(), |
| 209 kMockProcessId); | 220 kMockProcessId); |
| 210 const int kHostId = 1; | 221 const int kHostId = 1; |
| 211 backend_impl_->RegisterHost(kHostId); | 222 backend_impl_->RegisterHost(kHostId); |
| 212 host_ = backend_impl_->GetHost(kHostId); | 223 host_ = backend_impl_->GetHost(kHostId); |
| 224 job_factory_.reset(new MockURLRequestJobFactory()); |
| 225 empty_context_.set_job_factory(job_factory_.get()); |
| 213 } | 226 } |
| 214 | 227 |
| 215 void TearDownTest() { | 228 void TearDownTest() { |
| 216 DCHECK(base::MessageLoop::current() == io_thread_->message_loop()); | 229 DCHECK(base::MessageLoop::current() == io_thread_->message_loop()); |
| 217 DCHECK(!mock_factory_job_); | |
| 218 net::URLRequest::Deprecated::RegisterProtocolFactory( | |
| 219 "http", orig_http_factory_); | |
| 220 orig_http_factory_ = NULL; | |
| 221 job_ = NULL; | 230 job_ = NULL; |
| 222 handler_.reset(); | 231 handler_.reset(); |
| 223 request_.reset(); | 232 request_.reset(); |
| 224 backend_impl_.reset(); | 233 backend_impl_.reset(); |
| 225 mock_frontend_.reset(); | 234 mock_frontend_.reset(); |
| 226 mock_service_.reset(); | 235 mock_service_.reset(); |
| 227 mock_policy_.reset(); | 236 mock_policy_.reset(); |
| 237 job_factory_.reset(); |
| 228 host_ = NULL; | 238 host_ = NULL; |
| 229 } | 239 } |
| 230 | 240 |
| 231 void TestFinished() { | 241 void TestFinished() { |
| 232 // We unwind the stack prior to finishing up to let stack | 242 // We unwind the stack prior to finishing up to let stack |
| 233 // based objects get deleted. | 243 // based objects get deleted. |
| 234 DCHECK(base::MessageLoop::current() == io_thread_->message_loop()); | 244 DCHECK(base::MessageLoop::current() == io_thread_->message_loop()); |
| 235 base::MessageLoop::current()->PostTask( | 245 base::MessageLoop::current()->PostTask( |
| 236 FROM_HERE, | 246 FROM_HERE, |
| 237 base::Bind(&AppCacheRequestHandlerTest::TestFinishedUnwound, | 247 base::Bind(&AppCacheRequestHandlerTest::TestFinishedUnwound, |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 | 382 |
| 373 job_ = handler_->MaybeLoadResource(request_.get(), | 383 job_ = handler_->MaybeLoadResource(request_.get(), |
| 374 request_->context()->network_delegate()); | 384 request_->context()->network_delegate()); |
| 375 EXPECT_TRUE(job_.get()); | 385 EXPECT_TRUE(job_.get()); |
| 376 EXPECT_TRUE(job_->is_waiting()); | 386 EXPECT_TRUE(job_->is_waiting()); |
| 377 | 387 |
| 378 // We have to wait for completion of storage->FindResponseForMainRequest. | 388 // We have to wait for completion of storage->FindResponseForMainRequest. |
| 379 ScheduleNextTask(); | 389 ScheduleNextTask(); |
| 380 } | 390 } |
| 381 | 391 |
| 392 void SimulateResponseCode(int response_code) { |
| 393 job_factory_->SetJob( |
| 394 new MockURLRequestJob( |
| 395 request_.get(), |
| 396 request_->context()->network_delegate(), |
| 397 response_code)); |
| 398 request_->Start(); |
| 399 // All our simulation needs to satisfy are the following two DCHECKs |
| 400 DCHECK(request_->status().is_success()); |
| 401 DCHECK_EQ(response_code, request_->GetResponseCode()); |
| 402 } |
| 403 |
| 404 void SimulateResponseInfo(const net::HttpResponseInfo& info) { |
| 405 job_factory_->SetJob( |
| 406 new MockURLRequestJob( |
| 407 request_.get(), |
| 408 request_->context()->network_delegate(), info)); |
| 409 request_->set_delegate(&request_->delegate_); |
| 410 request_->Start(); |
| 411 } |
| 412 |
| 382 void Verify_MainResource_Fallback() { | 413 void Verify_MainResource_Fallback() { |
| 383 EXPECT_FALSE(job_->is_waiting()); | 414 EXPECT_FALSE(job_->is_waiting()); |
| 384 EXPECT_TRUE(job_->is_delivering_network_response()); | 415 EXPECT_TRUE(job_->is_delivering_network_response()); |
| 385 | 416 |
| 386 // When the request is restarted, the existing job is dropped so a | 417 // When the request is restarted, the existing job is dropped so a |
| 387 // real network job gets created. We expect NULL here which will cause | 418 // real network job gets created. We expect NULL here which will cause |
| 388 // the net library to create a real job. | 419 // the net library to create a real job. |
| 389 job_ = handler_->MaybeLoadResource(request_.get(), | 420 job_ = handler_->MaybeLoadResource(request_.get(), |
| 390 request_->context()->network_delegate()); | 421 request_->context()->network_delegate()); |
| 391 EXPECT_FALSE(job_.get()); | 422 EXPECT_FALSE(job_.get()); |
| 392 | 423 |
| 393 // Simulate an http error of the real network job. | 424 // Simulate an http error of the real network job. |
| 394 request_->SimulateResponseCode(500); | 425 SimulateResponseCode(500); |
| 395 | 426 |
| 396 job_ = handler_->MaybeLoadFallbackForResponse( | 427 job_ = handler_->MaybeLoadFallbackForResponse( |
| 397 request_.get(), request_->context()->network_delegate()); | 428 request_.get(), request_->context()->network_delegate()); |
| 398 EXPECT_TRUE(job_.get()); | 429 EXPECT_TRUE(job_.get()); |
| 399 EXPECT_TRUE(job_->is_delivering_appcache_response()); | 430 EXPECT_TRUE(job_->is_delivering_appcache_response()); |
| 400 | 431 |
| 401 int64 cache_id = kNoCacheId; | 432 int64 cache_id = kNoCacheId; |
| 402 GURL manifest_url; | 433 GURL manifest_url; |
| 403 handler_->GetExtraResponseInfo(&cache_id, &manifest_url); | 434 handler_->GetExtraResponseInfo(&cache_id, &manifest_url); |
| 404 EXPECT_EQ(1, cache_id); | 435 EXPECT_EQ(1, cache_id); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 | 484 |
| 454 // Simulate an http error of the real network job, but with custom | 485 // Simulate an http error of the real network job, but with custom |
| 455 // headers that override the fallback behavior. | 486 // headers that override the fallback behavior. |
| 456 const char kOverrideHeaders[] = | 487 const char kOverrideHeaders[] = |
| 457 "HTTP/1.1 404 BOO HOO\0" | 488 "HTTP/1.1 404 BOO HOO\0" |
| 458 "x-chromium-appcache-fallback-override: disallow-fallback\0" | 489 "x-chromium-appcache-fallback-override: disallow-fallback\0" |
| 459 "\0"; | 490 "\0"; |
| 460 net::HttpResponseInfo info; | 491 net::HttpResponseInfo info; |
| 461 info.headers = new net::HttpResponseHeaders( | 492 info.headers = new net::HttpResponseHeaders( |
| 462 std::string(kOverrideHeaders, arraysize(kOverrideHeaders))); | 493 std::string(kOverrideHeaders, arraysize(kOverrideHeaders))); |
| 463 request_->SimulateResponseInfo(info); | 494 SimulateResponseInfo(info); |
| 464 | 495 |
| 465 job_ = handler_->MaybeLoadFallbackForResponse( | 496 job_ = handler_->MaybeLoadFallbackForResponse( |
| 466 request_.get(), request_->context()->network_delegate()); | 497 request_.get(), request_->context()->network_delegate()); |
| 467 EXPECT_FALSE(job_.get()); | 498 EXPECT_FALSE(job_.get()); |
| 468 | 499 |
| 469 TestFinished(); | 500 TestFinished(); |
| 470 } | 501 } |
| 471 | 502 |
| 472 // SubResource_Miss_WithNoCacheSelected ---------------------------------- | 503 // SubResource_Miss_WithNoCacheSelected ---------------------------------- |
| 473 | 504 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 request_->context()->network_delegate()); | 659 request_->context()->network_delegate()); |
| 629 EXPECT_FALSE(job_.get()); | 660 EXPECT_FALSE(job_.get()); |
| 630 | 661 |
| 631 AppCacheURLRequestJob* fallback_job; | 662 AppCacheURLRequestJob* fallback_job; |
| 632 fallback_job = handler_->MaybeLoadFallbackForRedirect( | 663 fallback_job = handler_->MaybeLoadFallbackForRedirect( |
| 633 request_.get(), | 664 request_.get(), |
| 634 request_->context()->network_delegate(), | 665 request_->context()->network_delegate(), |
| 635 GURL("http://blah/redirect")); | 666 GURL("http://blah/redirect")); |
| 636 EXPECT_FALSE(fallback_job); | 667 EXPECT_FALSE(fallback_job); |
| 637 | 668 |
| 638 request_->SimulateResponseCode(200); | 669 SimulateResponseCode(200); |
| 639 fallback_job = handler_->MaybeLoadFallbackForResponse( | 670 fallback_job = handler_->MaybeLoadFallbackForResponse( |
| 640 request_.get(), request_->context()->network_delegate()); | 671 request_.get(), request_->context()->network_delegate()); |
| 641 EXPECT_FALSE(fallback_job); | 672 EXPECT_FALSE(fallback_job); |
| 642 | 673 |
| 643 TestFinished(); | 674 TestFinished(); |
| 644 } | 675 } |
| 645 | 676 |
| 646 // SubResource_Network ----------------------------- | 677 // SubResource_Network ----------------------------- |
| 647 | 678 |
| 648 void SubResource_Network() { | 679 void SubResource_Network() { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 handler_.reset(host_->CreateRequestHandler(request_.get(), | 796 handler_.reset(host_->CreateRequestHandler(request_.get(), |
| 766 ResourceType::MAIN_FRAME)); | 797 ResourceType::MAIN_FRAME)); |
| 767 EXPECT_TRUE(handler_.get()); | 798 EXPECT_TRUE(handler_.get()); |
| 768 | 799 |
| 769 job_ = handler_->MaybeLoadResource(request_.get(), | 800 job_ = handler_->MaybeLoadResource(request_.get(), |
| 770 request_->context()->network_delegate()); | 801 request_->context()->network_delegate()); |
| 771 EXPECT_TRUE(job_.get()); | 802 EXPECT_TRUE(job_.get()); |
| 772 EXPECT_TRUE(job_->is_waiting()); | 803 EXPECT_TRUE(job_->is_waiting()); |
| 773 EXPECT_FALSE(job_->has_been_started()); | 804 EXPECT_FALSE(job_->has_been_started()); |
| 774 | 805 |
| 775 mock_factory_job_ = job_.get(); | 806 job_factory_->SetJob(job_); |
| 776 request_->Start(); | 807 request_->Start(); |
| 777 EXPECT_TRUE(job_->has_been_started()); | 808 EXPECT_TRUE(job_->has_been_started()); |
| 778 | 809 |
| 779 request_->Cancel(); | 810 request_->Cancel(); |
| 780 EXPECT_TRUE(job_->has_been_killed()); | 811 EXPECT_TRUE(job_->has_been_killed()); |
| 781 | 812 |
| 782 EXPECT_FALSE(handler_->MaybeLoadFallbackForResponse( | 813 EXPECT_FALSE(handler_->MaybeLoadFallbackForResponse( |
| 783 request_.get(), request_->context()->network_delegate())); | 814 request_.get(), request_->context()->network_delegate())); |
| 784 | 815 |
| 785 TestFinished(); | 816 TestFinished(); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 // Data members -------------------------------------------------- | 919 // Data members -------------------------------------------------- |
| 889 | 920 |
| 890 scoped_ptr<base::WaitableEvent> test_finished_event_; | 921 scoped_ptr<base::WaitableEvent> test_finished_event_; |
| 891 std::stack<base::Closure> task_stack_; | 922 std::stack<base::Closure> task_stack_; |
| 892 scoped_ptr<MockAppCacheService> mock_service_; | 923 scoped_ptr<MockAppCacheService> mock_service_; |
| 893 scoped_ptr<AppCacheBackendImpl> backend_impl_; | 924 scoped_ptr<AppCacheBackendImpl> backend_impl_; |
| 894 scoped_ptr<MockFrontend> mock_frontend_; | 925 scoped_ptr<MockFrontend> mock_frontend_; |
| 895 scoped_ptr<MockAppCachePolicy> mock_policy_; | 926 scoped_ptr<MockAppCachePolicy> mock_policy_; |
| 896 AppCacheHost* host_; | 927 AppCacheHost* host_; |
| 897 net::URLRequestContext empty_context_; | 928 net::URLRequestContext empty_context_; |
| 929 scoped_ptr<MockURLRequestJobFactory> job_factory_; |
| 898 scoped_ptr<MockURLRequest> request_; | 930 scoped_ptr<MockURLRequest> request_; |
| 899 scoped_ptr<AppCacheRequestHandler> handler_; | 931 scoped_ptr<AppCacheRequestHandler> handler_; |
| 900 scoped_refptr<AppCacheURLRequestJob> job_; | 932 scoped_refptr<AppCacheURLRequestJob> job_; |
| 901 net::URLRequest::ProtocolFactory* orig_http_factory_; | |
| 902 | 933 |
| 903 static scoped_ptr<base::Thread> io_thread_; | 934 static scoped_ptr<base::Thread> io_thread_; |
| 904 static net::URLRequestJob* mock_factory_job_; | |
| 905 }; | 935 }; |
| 906 | 936 |
| 907 // static | 937 // static |
| 908 scoped_ptr<base::Thread> AppCacheRequestHandlerTest::io_thread_; | 938 scoped_ptr<base::Thread> AppCacheRequestHandlerTest::io_thread_; |
| 909 net::URLRequestJob* AppCacheRequestHandlerTest::mock_factory_job_ = NULL; | |
| 910 | 939 |
| 911 TEST_F(AppCacheRequestHandlerTest, MainResource_Miss) { | 940 TEST_F(AppCacheRequestHandlerTest, MainResource_Miss) { |
| 912 RunTestOnIOThread(&AppCacheRequestHandlerTest::MainResource_Miss); | 941 RunTestOnIOThread(&AppCacheRequestHandlerTest::MainResource_Miss); |
| 913 } | 942 } |
| 914 | 943 |
| 915 TEST_F(AppCacheRequestHandlerTest, MainResource_Hit) { | 944 TEST_F(AppCacheRequestHandlerTest, MainResource_Hit) { |
| 916 RunTestOnIOThread(&AppCacheRequestHandlerTest::MainResource_Hit); | 945 RunTestOnIOThread(&AppCacheRequestHandlerTest::MainResource_Hit); |
| 917 } | 946 } |
| 918 | 947 |
| 919 TEST_F(AppCacheRequestHandlerTest, MainResource_Fallback) { | 948 TEST_F(AppCacheRequestHandlerTest, MainResource_Fallback) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 | 1005 |
| 977 TEST_F(AppCacheRequestHandlerTest, WorkerRequest) { | 1006 TEST_F(AppCacheRequestHandlerTest, WorkerRequest) { |
| 978 RunTestOnIOThread(&AppCacheRequestHandlerTest::WorkerRequest); | 1007 RunTestOnIOThread(&AppCacheRequestHandlerTest::WorkerRequest); |
| 979 } | 1008 } |
| 980 | 1009 |
| 981 TEST_F(AppCacheRequestHandlerTest, MainResource_Blocked) { | 1010 TEST_F(AppCacheRequestHandlerTest, MainResource_Blocked) { |
| 982 RunTestOnIOThread(&AppCacheRequestHandlerTest::MainResource_Blocked); | 1011 RunTestOnIOThread(&AppCacheRequestHandlerTest::MainResource_Blocked); |
| 983 } | 1012 } |
| 984 | 1013 |
| 985 } // namespace content | 1014 } // namespace content |
| OLD | NEW |