Chromium Code Reviews| Index: content/browser/background_fetch/background_fetch_job_controller_unittest.cc |
| diff --git a/content/browser/background_fetch/background_fetch_job_controller_unittest.cc b/content/browser/background_fetch/background_fetch_job_controller_unittest.cc |
| index 22959816189334849c265623cc715a0492d0bbf5..49ec05355b6ffdde5697fa7f86550eb424a6f547 100644 |
| --- a/content/browser/background_fetch/background_fetch_job_controller_unittest.cc |
| +++ b/content/browser/background_fetch/background_fetch_job_controller_unittest.cc |
| @@ -152,16 +152,19 @@ class BackgroundFetchJobControllerTest : public ::testing::Test { |
| void TearDown() override { job_controller_->Shutdown(); } |
| - void InitializeJobController() { |
| + void InitializeJobController( |
| + const BackgroundFetchRegistrationId& registration_id) { |
| job_controller_ = base::MakeUnique<BackgroundFetchJobController>( |
| - kJobGuid, &browser_context_, |
| + registration_id, &browser_context_, |
| BrowserContext::GetDefaultStoragePartition(&browser_context_), |
| data_manager_.get(), |
| base::BindOnce(&BackgroundFetchJobControllerTest::DidCompleteJob, |
| base::Unretained(this))); |
| } |
| - void DidCompleteJob() { did_complete_job_ = true; } |
| + void DidCompleteJob(const BackgroundFetchRegistrationId& registration_id) { |
| + did_complete_job_ = true; |
|
harkness
2017/03/27 15:35:12
optional: DCHECK that registration_id is equal to
Peter Beverloo
2017/03/27 15:42:55
Done.
|
| + } |
| void StartProcessing() { |
| base::RunLoop run_loop; |
| @@ -202,12 +205,13 @@ class BackgroundFetchJobControllerTest : public ::testing::Test { |
| }; |
| TEST_F(BackgroundFetchJobControllerTest, SingleRequestJob) { |
| - BackgroundFetchJobInfo job_info(kTag, url::Origin(GURL(kOrigin)), |
| - kServiceWorkerRegistrationId); |
| + BackgroundFetchRegistrationId registration_id( |
| + kServiceWorkerRegistrationId, url::Origin(GURL(kOrigin)), kTag); |
| + |
| BackgroundFetchRequestInfo request_info(GURL(kTestUrl), kJobGuid); |
| request_info.set_state(DownloadItem::DownloadState::IN_PROGRESS); |
| data_manager()->set_next_request(&request_info); |
| - InitializeJobController(); |
| + InitializeJobController(registration_id); |
| EXPECT_CALL(*(download_manager()), |
| DownloadUrlMock(::testing::Pointee(::testing::Property( |
| @@ -236,14 +240,15 @@ TEST_F(BackgroundFetchJobControllerTest, SingleRequestJob) { |
| } |
| TEST_F(BackgroundFetchJobControllerTest, MultipleRequestJob) { |
| - BackgroundFetchJobInfo job_info(kTag, url::Origin(GURL(kOrigin)), |
| - kServiceWorkerRegistrationId); |
| + BackgroundFetchRegistrationId registration_id( |
| + kServiceWorkerRegistrationId, url::Origin(GURL(kOrigin)), kTag); |
| + |
| std::vector<BackgroundFetchRequestInfo> request_infos; |
| for (int i = 0; i < 10; i++) { |
| request_infos.emplace_back(GURL(kTestUrl), base::IntToString(i)); |
| } |
| data_manager()->set_next_request(&request_infos[0]); |
| - InitializeJobController(); |
| + InitializeJobController(registration_id); |
| EXPECT_CALL(*(download_manager()), |
| DownloadUrlMock(::testing::Pointee(::testing::Property( |
| @@ -287,12 +292,13 @@ TEST_F(BackgroundFetchJobControllerTest, MultipleRequestJob) { |
| } |
| TEST_F(BackgroundFetchJobControllerTest, UpdateStorageState) { |
| - BackgroundFetchJobInfo job_info(kTag, url::Origin(GURL(kOrigin)), |
| - kServiceWorkerRegistrationId); |
| + BackgroundFetchRegistrationId registration_id( |
| + kServiceWorkerRegistrationId, url::Origin(GURL(kOrigin)), kTag); |
| + |
| BackgroundFetchRequestInfo request_info(GURL(kTestUrl), kJobGuid); |
| request_info.set_state(DownloadItem::DownloadState::IN_PROGRESS); |
| data_manager()->set_next_request(&request_info); |
| - InitializeJobController(); |
| + InitializeJobController(registration_id); |
| EXPECT_CALL(*(download_manager()), |
| DownloadUrlMock(::testing::Pointee(::testing::Property( |