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

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

Issue 2973233002: [Background Fetch] Cleanup/fix thread safety (Closed)
Patch Set: Remove n.b. from comments Created 3 years, 5 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
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_job_controller.h" 5 #include "content/browser/background_fetch/background_fetch_job_controller.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <unordered_map> 9 #include <unordered_map>
10 10
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 for (const auto& pair : request_data) { 77 for (const auto& pair : request_data) {
78 CreateRequestWithProvidedResponse( 78 CreateRequestWithProvidedResponse(
79 pair.second, pair.first, 79 pair.second, pair.first,
80 TestResponseBuilder(200 /* response_code */).Build()); 80 TestResponseBuilder(200 /* response_code */).Build());
81 } 81 }
82 } 82 }
83 83
84 // Creates a new BackgroundFetchJobController instance. 84 // Creates a new BackgroundFetchJobController instance.
85 std::unique_ptr<BackgroundFetchJobController> CreateJobController( 85 std::unique_ptr<BackgroundFetchJobController> CreateJobController(
86 const BackgroundFetchRegistrationId& registration_id) { 86 const BackgroundFetchRegistrationId& registration_id) {
87 // StoragePartition creates its own BackgroundFetchContext, but this test
88 // doesn't use that; it just uses the StoragePartition's URLRequestContext.
87 StoragePartition* storage_partition = 89 StoragePartition* storage_partition =
88 BrowserContext::GetDefaultStoragePartition(browser_context()); 90 BrowserContext::GetDefaultStoragePartition(browser_context());
89 91
90 return base::MakeUnique<BackgroundFetchJobController>( 92 return base::MakeUnique<BackgroundFetchJobController>(
91 registration_id, BackgroundFetchOptions(), &data_manager_, 93 registration_id, BackgroundFetchOptions(), &data_manager_,
92 browser_context(), 94 browser_context(),
93 make_scoped_refptr(storage_partition->GetURLRequestContext()), 95 make_scoped_refptr(storage_partition->GetURLRequestContext()),
94 base::BindOnce(&BackgroundFetchJobControllerTest::DidCompleteJob, 96 base::BindOnce(&BackgroundFetchJobControllerTest::DidCompleteJob,
95 base::Unretained(this)), 97 base::Unretained(this)),
96 TRAFFIC_ANNOTATION_FOR_TESTS); 98 TRAFFIC_ANNOTATION_FOR_TESTS);
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 238
237 // TODO(peter): Verify that the issued download items have had their state 239 // TODO(peter): Verify that the issued download items have had their state
238 // updated to be cancelled as well. 240 // updated to be cancelled as well.
239 241
240 EXPECT_EQ(controller->state(), BackgroundFetchJobController::State::ABORTED); 242 EXPECT_EQ(controller->state(), BackgroundFetchJobController::State::ABORTED);
241 EXPECT_TRUE(did_complete_job_); 243 EXPECT_TRUE(did_complete_job_);
242 } 244 }
243 245
244 } // namespace 246 } // namespace
245 } // namespace content 247 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698