| OLD | NEW |
| 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 <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" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 } | 103 } |
| 104 | 104 |
| 105 private: | 105 private: |
| 106 int response_code_; | 106 int response_code_; |
| 107 bool has_response_info_; | 107 bool has_response_info_; |
| 108 net::HttpResponseInfo response_info_; | 108 net::HttpResponseInfo response_info_; |
| 109 }; | 109 }; |
| 110 | 110 |
| 111 class MockURLRequest : public net::URLRequest { | 111 class MockURLRequest : public net::URLRequest { |
| 112 public: | 112 public: |
| 113 explicit MockURLRequest(const GURL& url, net::URLRequestContext* context) : | 113 MockURLRequest(const GURL& url, net::URLRequestContext* context) : |
| 114 net::URLRequest(url, NULL, context) { | 114 net::URLRequest(url, NULL, context) { |
| 115 } | 115 } |
| 116 | 116 |
| 117 void SimulateResponseCode(int http_response_code) { | 117 void SimulateResponseCode(int http_response_code) { |
| 118 mock_factory_job_ = new MockURLRequestJob( | 118 mock_factory_job_ = new MockURLRequestJob( |
| 119 this, context()->network_delegate(), http_response_code); | 119 this, context()->network_delegate(), http_response_code); |
| 120 Start(); | 120 Start(); |
| 121 DCHECK(!mock_factory_job_); | 121 DCHECK(!mock_factory_job_); |
| 122 // All our simulation needs to satisfy are the following two DCHECKs | 122 // All our simulation needs to satisfy are the following two DCHECKs |
| 123 DCHECK(status().is_success()); | 123 DCHECK(status().is_success()); |
| (...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 959 | 959 |
| 960 TEST_F(AppCacheRequestHandlerTest, WorkerRequest) { | 960 TEST_F(AppCacheRequestHandlerTest, WorkerRequest) { |
| 961 RunTestOnIOThread(&AppCacheRequestHandlerTest::WorkerRequest); | 961 RunTestOnIOThread(&AppCacheRequestHandlerTest::WorkerRequest); |
| 962 } | 962 } |
| 963 | 963 |
| 964 TEST_F(AppCacheRequestHandlerTest, MainResource_Blocked) { | 964 TEST_F(AppCacheRequestHandlerTest, MainResource_Blocked) { |
| 965 RunTestOnIOThread(&AppCacheRequestHandlerTest::MainResource_Blocked); | 965 RunTestOnIOThread(&AppCacheRequestHandlerTest::MainResource_Blocked); |
| 966 } | 966 } |
| 967 | 967 |
| 968 } // namespace appcache | 968 } // namespace appcache |
| OLD | NEW |