Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(418)

Side by Side Diff: content/browser/background_fetch/background_fetch_data_manager_unittest.cc

Issue 2778793002: Start aligning BackgroundFetchRequestInfo with the passed in request object. (Closed)
Patch Set: Rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/background_fetch/background_fetch_job_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_data_manager.h" 5 #include "content/browser/background_fetch/background_fetch_data_manager.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 base::Unretained(this), run_loop.QuitClosure(), 69 base::Unretained(this), run_loop.QuitClosure(),
70 out_error)); 70 out_error));
71 run_loop.Run(); 71 run_loop.Run();
72 } 72 }
73 73
74 void CreateRequests(int num_requests) { 74 void CreateRequests(int num_requests) {
75 DCHECK_GT(num_requests, 0); 75 DCHECK_GT(num_requests, 0);
76 // Create |num_requests| BackgroundFetchRequestInfo's. 76 // Create |num_requests| BackgroundFetchRequestInfo's.
77 std::vector<std::unique_ptr<BackgroundFetchRequestInfo>> request_infos; 77 std::vector<std::unique_ptr<BackgroundFetchRequestInfo>> request_infos;
78 for (int i = 0; i < num_requests; i++) { 78 for (int i = 0; i < num_requests; i++) {
79 ServiceWorkerHeaderMap headers;
80 ServiceWorkerFetchRequest request(GURL(kResource), "GET", headers,
81 Referrer(), false /* is_reload */);
79 request_infos.push_back( 82 request_infos.push_back(
80 base::MakeUnique<BackgroundFetchRequestInfo>(GURL(kResource), kTag)); 83 base::MakeUnique<BackgroundFetchRequestInfo>(request));
81 } 84 }
82 std::unique_ptr<BackgroundFetchJobInfo> job_info = 85 std::unique_ptr<BackgroundFetchJobInfo> job_info =
83 base::MakeUnique<BackgroundFetchJobInfo>( 86 base::MakeUnique<BackgroundFetchJobInfo>(
84 "tag", url::Origin(GURL(kJobOrigin)), kServiceWorkerRegistrationId); 87 kTag, url::Origin(GURL(kJobOrigin)), kServiceWorkerRegistrationId);
85 job_info->set_num_requests(num_requests); 88 job_info->set_num_requests(num_requests);
86 89
87 job_guid_ = job_info->guid(); 90 job_guid_ = job_info->guid();
88 91
89 background_fetch_data_manager_->WriteJobToStorage(std::move(job_info), 92 background_fetch_data_manager_->WriteJobToStorage(std::move(job_info),
90 std::move(request_infos)); 93 std::move(request_infos));
91 } 94 }
92 95
93 void GetResponse() { 96 void GetResponse() {
94 base::RunLoop run_loop; 97 base::RunLoop run_loop;
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 294
292 const BackgroundFetchRequestInfo& request_info = 295 const BackgroundFetchRequestInfo& request_info =
293 data_manager->GetNextBackgroundFetchRequestInfo(job_guid); 296 data_manager->GetNextBackgroundFetchRequestInfo(job_guid);
294 EXPECT_FALSE(data_manager->UpdateRequestState( 297 EXPECT_FALSE(data_manager->UpdateRequestState(
295 job_guid, request_info.guid(), DownloadItem::DownloadState::COMPLETE, 298 job_guid, request_info.guid(), DownloadItem::DownloadState::COMPLETE,
296 DownloadInterruptReason::DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE)); 299 DownloadInterruptReason::DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE));
297 EXPECT_TRUE(data_manager->IsComplete(job_guid)); 300 EXPECT_TRUE(data_manager->IsComplete(job_guid));
298 } 301 }
299 302
300 } // namespace content 303 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/background_fetch/background_fetch_job_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698