| 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_update_job.h" | 5 #include "content/browser/appcache/appcache_update_job.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 return GURL("https://cross_origin_host/" + path); | 69 return GURL("https://cross_origin_host/" + path); |
| 70 } | 70 } |
| 71 | 71 |
| 72 static net::URLRequestJob* JobFactory( | 72 static net::URLRequestJob* JobFactory( |
| 73 net::URLRequest* request, net::NetworkDelegate* network_delegate) { | 73 net::URLRequest* request, net::NetworkDelegate* network_delegate) { |
| 74 if (request->url().host() != "mockhost" && | 74 if (request->url().host() != "mockhost" && |
| 75 request->url().host() != "cross_origin_host") | 75 request->url().host() != "cross_origin_host") |
| 76 return new net::URLRequestErrorJob(request, network_delegate, -100); | 76 return new net::URLRequestErrorJob(request, network_delegate, -100); |
| 77 | 77 |
| 78 std::string headers, body; | 78 std::string headers, body; |
| 79 GetMockResponse(request->url().path(), &headers, &body); | 79 GetMockResponse(request->url().path().as_string(), &headers, &body); |
| 80 return new net::URLRequestTestJob( | 80 return new net::URLRequestTestJob( |
| 81 request, network_delegate, headers, body, true); | 81 request, network_delegate, headers, body, true); |
| 82 } | 82 } |
| 83 | 83 |
| 84 private: | 84 private: |
| 85 static void GetMockResponse(const std::string& path, | 85 static void GetMockResponse(const std::string& path, |
| 86 std::string* headers, | 86 std::string* headers, |
| 87 std::string* body) { | 87 std::string* body) { |
| 88 const char ok_headers[] = | 88 const char ok_headers[] = |
| 89 "HTTP/1.1 200 OK\n" | 89 "HTTP/1.1 200 OK\n" |
| (...skipping 3635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3725 | 3725 |
| 3726 TEST_F(AppCacheUpdateJobTest, CrossOriginHttpsSuccess) { | 3726 TEST_F(AppCacheUpdateJobTest, CrossOriginHttpsSuccess) { |
| 3727 RunTestOnIOThread(&AppCacheUpdateJobTest::CrossOriginHttpsSuccessTest); | 3727 RunTestOnIOThread(&AppCacheUpdateJobTest::CrossOriginHttpsSuccessTest); |
| 3728 } | 3728 } |
| 3729 | 3729 |
| 3730 TEST_F(AppCacheUpdateJobTest, CrossOriginHttpsDenied) { | 3730 TEST_F(AppCacheUpdateJobTest, CrossOriginHttpsDenied) { |
| 3731 RunTestOnIOThread(&AppCacheUpdateJobTest::CrossOriginHttpsDeniedTest); | 3731 RunTestOnIOThread(&AppCacheUpdateJobTest::CrossOriginHttpsDeniedTest); |
| 3732 } | 3732 } |
| 3733 | 3733 |
| 3734 } // namespace content | 3734 } // namespace content |
| OLD | NEW |