| 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 "content/test/net/url_request_mock_http_job.h" | 5 #include "content/test/net/url_request_mock_http_job.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 // This is the file path leading to the root of the directory to use as the | 23 // This is the file path leading to the root of the directory to use as the |
| 24 // root of the http server. This returns a reference that can be assigned to. | 24 // root of the http server. This returns a reference that can be assigned to. |
| 25 FilePath& BasePath() { | 25 FilePath& BasePath() { |
| 26 CR_DEFINE_STATIC_LOCAL(FilePath, base_path, ()); | 26 CR_DEFINE_STATIC_LOCAL(FilePath, base_path, ()); |
| 27 return base_path; | 27 return base_path; |
| 28 } | 28 } |
| 29 | 29 |
| 30 } // namespace | 30 } // namespace |
| 31 | 31 |
| 32 namespace content { |
| 33 |
| 32 // static | 34 // static |
| 33 net::URLRequestJob* URLRequestMockHTTPJob::Factory( | 35 net::URLRequestJob* URLRequestMockHTTPJob::Factory( |
| 34 net::URLRequest* request, | 36 net::URLRequest* request, |
| 35 net::NetworkDelegate* network_delegate, | 37 net::NetworkDelegate* network_delegate, |
| 36 const std::string& scheme) { | 38 const std::string& scheme) { |
| 37 return new URLRequestMockHTTPJob(request, | 39 return new URLRequestMockHTTPJob(request, |
| 38 network_delegate, | 40 network_delegate, |
| 39 GetOnDiskPath(BasePath(), request, scheme)); | 41 GetOnDiskPath(BasePath(), request, scheme)); |
| 40 } | 42 } |
| 41 | 43 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 if (info.headers) | 134 if (info.headers) |
| 133 return info.headers->response_code(); | 135 return info.headers->response_code(); |
| 134 return net::URLRequestJob::GetResponseCode(); | 136 return net::URLRequestJob::GetResponseCode(); |
| 135 } | 137 } |
| 136 | 138 |
| 137 bool URLRequestMockHTTPJob::GetCharset(std::string* charset) { | 139 bool URLRequestMockHTTPJob::GetCharset(std::string* charset) { |
| 138 net::HttpResponseInfo info; | 140 net::HttpResponseInfo info; |
| 139 GetResponseInfo(&info); | 141 GetResponseInfo(&info); |
| 140 return info.headers && info.headers->GetCharset(charset); | 142 return info.headers && info.headers->GetCharset(charset); |
| 141 } | 143 } |
| 144 |
| 145 } // namespace content |
| OLD | NEW |