| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/background_fetch/background_fetch_test_base.h" | 5 #include "content/browser/background_fetch/background_fetch_test_base.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 // Write the |response_info|'s response_text to a temporary file. | 126 // Write the |response_info|'s response_text to a temporary file. |
| 127 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_directory_.GetPath(), | 127 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_directory_.GetPath(), |
| 128 &response_path)); | 128 &response_path)); |
| 129 | 129 |
| 130 ASSERT_NE(-1 /* error */, | 130 ASSERT_NE(-1 /* error */, |
| 131 base::WriteFile(response_path, response_info.second.c_str(), | 131 base::WriteFile(response_path, response_info.second.c_str(), |
| 132 response_info.second.size())); | 132 response_info.second.size())); |
| 133 | 133 |
| 134 download_item->SetTargetFilePath(response_path); | 134 download_item->SetTargetFilePath(response_path); |
| 135 download_item->SetReceivedBytes(response_info.second.size()); | 135 download_item->SetReceivedBytes(response_info.second.size()); |
| 136 download_item->SetMimeType("text/plain"); |
| 136 | 137 |
| 137 // Notify the Job Controller about the download having been updated. | 138 // Notify the Job Controller about the download having been updated. |
| 138 download_item->NotifyDownloadUpdated(); | 139 download_item->NotifyDownloadUpdated(); |
| 139 } | 140 } |
| 140 | 141 |
| 141 using ResponseInfo = | 142 using ResponseInfo = |
| 142 std::pair<int /* status_code */, std::string /* response_text */>; | 143 std::pair<int /* status_code */, std::string /* response_text */>; |
| 143 | 144 |
| 144 // Map of URL to the response information associated with that URL. | 145 // Map of URL to the response information associated with that URL. |
| 145 std::map<GURL, ResponseInfo> registered_responses_; | 146 std::map<GURL, ResponseInfo> registered_responses_; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 // Create a ServiceWorkerFetchRequest request with the same information. | 254 // Create a ServiceWorkerFetchRequest request with the same information. |
| 254 return ServiceWorkerFetchRequest(url, method, ServiceWorkerHeaderMap(), | 255 return ServiceWorkerFetchRequest(url, method, ServiceWorkerHeaderMap(), |
| 255 Referrer(), false /* is_reload */); | 256 Referrer(), false /* is_reload */); |
| 256 } | 257 } |
| 257 | 258 |
| 258 MockDownloadManager* BackgroundFetchTestBase::download_manager() { | 259 MockDownloadManager* BackgroundFetchTestBase::download_manager() { |
| 259 return download_manager_; | 260 return download_manager_; |
| 260 } | 261 } |
| 261 | 262 |
| 262 } // namespace content | 263 } // namespace content |
| OLD | NEW |