| 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 "content/browser/appcache/appcache_request_handler.h" | 5 #include "content/browser/appcache/appcache_request_handler.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <stack> | 9 #include <stack> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 job_.reset(handler_->MaybeLoadResource( | 373 job_.reset(handler_->MaybeLoadResource( |
| 374 request_.get(), request_->context()->network_delegate())); | 374 request_.get(), request_->context()->network_delegate())); |
| 375 EXPECT_TRUE(job_.get()); | 375 EXPECT_TRUE(job_.get()); |
| 376 EXPECT_TRUE(job_->is_waiting()); | 376 EXPECT_TRUE(job_->is_waiting()); |
| 377 | 377 |
| 378 // We have to wait for completion of storage->FindResponseForMainRequest. | 378 // We have to wait for completion of storage->FindResponseForMainRequest. |
| 379 ScheduleNextTask(); | 379 ScheduleNextTask(); |
| 380 } | 380 } |
| 381 | 381 |
| 382 void SimulateResponseCode(int response_code) { | 382 void SimulateResponseCode(int response_code) { |
| 383 job_factory_->SetJob(base::WrapUnique(new MockURLRequestJob( | 383 job_factory_->SetJob(base::MakeUnique<MockURLRequestJob>( |
| 384 request_.get(), request_->context()->network_delegate(), | 384 request_.get(), request_->context()->network_delegate(), |
| 385 response_code))); | 385 response_code)); |
| 386 request_->Start(); | 386 request_->Start(); |
| 387 // All our simulation needs to satisfy are the following two DCHECKs | 387 // All our simulation needs to satisfy are the following two DCHECKs |
| 388 DCHECK(request_->status().is_success()); | 388 DCHECK(request_->status().is_success()); |
| 389 DCHECK_EQ(response_code, request_->GetResponseCode()); | 389 DCHECK_EQ(response_code, request_->GetResponseCode()); |
| 390 } | 390 } |
| 391 | 391 |
| 392 void SimulateResponseInfo(const net::HttpResponseInfo& info) { | 392 void SimulateResponseInfo(const net::HttpResponseInfo& info) { |
| 393 job_factory_->SetJob(base::WrapUnique(new MockURLRequestJob( | 393 job_factory_->SetJob(base::MakeUnique<MockURLRequestJob>( |
| 394 request_.get(), request_->context()->network_delegate(), info))); | 394 request_.get(), request_->context()->network_delegate(), info)); |
| 395 request_->Start(); | 395 request_->Start(); |
| 396 } | 396 } |
| 397 | 397 |
| 398 void Verify_MainResource_Fallback() { | 398 void Verify_MainResource_Fallback() { |
| 399 EXPECT_FALSE(job_->is_waiting()); | 399 EXPECT_FALSE(job_->is_waiting()); |
| 400 EXPECT_TRUE(job_->is_delivering_network_response()); | 400 EXPECT_TRUE(job_->is_delivering_network_response()); |
| 401 | 401 |
| 402 // The handler expects to the job to tell it that the request is going to | 402 // The handler expects to the job to tell it that the request is going to |
| 403 // be restarted before it sees the next request. | 403 // be restarted before it sees the next request. |
| 404 handler_->OnPrepareToRestart(); | 404 handler_->OnPrepareToRestart(); |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1105 | 1105 |
| 1106 TEST_F(AppCacheRequestHandlerTest, WorkerRequest) { | 1106 TEST_F(AppCacheRequestHandlerTest, WorkerRequest) { |
| 1107 RunTestOnIOThread(&AppCacheRequestHandlerTest::WorkerRequest); | 1107 RunTestOnIOThread(&AppCacheRequestHandlerTest::WorkerRequest); |
| 1108 } | 1108 } |
| 1109 | 1109 |
| 1110 TEST_F(AppCacheRequestHandlerTest, MainResource_Blocked) { | 1110 TEST_F(AppCacheRequestHandlerTest, MainResource_Blocked) { |
| 1111 RunTestOnIOThread(&AppCacheRequestHandlerTest::MainResource_Blocked); | 1111 RunTestOnIOThread(&AppCacheRequestHandlerTest::MainResource_Blocked); |
| 1112 } | 1112 } |
| 1113 | 1113 |
| 1114 } // namespace content | 1114 } // namespace content |
| OLD | NEW |