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

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

Issue 2815913005: Switch to using scoped_ptr with UserData (Closed)
Patch Set: rebase Created 3 years, 8 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_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
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/files/file_util.h" 13 #include "base/files/file_util.h"
14 #include "base/files/scoped_temp_dir.h" 14 #include "base/files/scoped_temp_dir.h"
15 #include "base/guid.h" 15 #include "base/guid.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/memory/ptr_util.h"
17 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
18 #include "base/run_loop.h" 19 #include "base/run_loop.h"
19 #include "base/time/time.h" 20 #include "base/time/time.h"
20 #include "content/browser/background_fetch/background_fetch_registration_id.h" 21 #include "content/browser/background_fetch/background_fetch_registration_id.h"
21 #include "content/browser/service_worker/service_worker_context_core.h" 22 #include "content/browser/service_worker/service_worker_context_core.h"
22 #include "content/browser/service_worker/service_worker_registration.h" 23 #include "content/browser/service_worker/service_worker_registration.h"
23 #include "content/common/service_worker/service_worker_status_code.h" 24 #include "content/common/service_worker/service_worker_status_code.h"
24 #include "content/public/browser/browser_thread.h" 25 #include "content/public/browser/browser_thread.h"
25 #include "content/public/browser/download_item.h" 26 #include "content/public/browser/download_item.h"
26 #include "content/public/browser/download_url_parameters.h" 27 #include "content/public/browser/download_url_parameters.h"
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 BackgroundFetchTestBase::~BackgroundFetchTestBase() { 207 BackgroundFetchTestBase::~BackgroundFetchTestBase() {
207 DCHECK(set_up_called_); 208 DCHECK(set_up_called_);
208 DCHECK(tear_down_called_); 209 DCHECK(tear_down_called_);
209 } 210 }
210 211
211 void BackgroundFetchTestBase::SetUp() { 212 void BackgroundFetchTestBase::SetUp() {
212 download_manager_ = new RespondingDownloadManager(); 213 download_manager_ = new RespondingDownloadManager();
213 214
214 // The |download_manager_| ownership is given to the BrowserContext, and the 215 // The |download_manager_| ownership is given to the BrowserContext, and the
215 // BrowserContext will take care of deallocating it. 216 // BrowserContext will take care of deallocating it.
216 BrowserContext::SetDownloadManagerForTesting(browser_context(), 217 BrowserContext::SetDownloadManagerForTesting(
217 download_manager_); 218 browser_context(), base::WrapUnique(download_manager_));
218 219
219 set_up_called_ = true; 220 set_up_called_ = true;
220 } 221 }
221 222
222 void BackgroundFetchTestBase::TearDown() { 223 void BackgroundFetchTestBase::TearDown() {
223 EXPECT_CALL(*download_manager_, Shutdown()).Times(1); 224 EXPECT_CALL(*download_manager_, Shutdown()).Times(1);
224 225
225 service_worker_registrations_.clear(); 226 service_worker_registrations_.clear();
226 tear_down_called_ = true; 227 tear_down_called_ = true;
227 } 228 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 // Create a ServiceWorkerFetchRequest request with the same information. 293 // Create a ServiceWorkerFetchRequest request with the same information.
293 return ServiceWorkerFetchRequest(gurl, method, ServiceWorkerHeaderMap(), 294 return ServiceWorkerFetchRequest(gurl, method, ServiceWorkerHeaderMap(),
294 Referrer(), false /* is_reload */); 295 Referrer(), false /* is_reload */);
295 } 296 }
296 297
297 MockDownloadManager* BackgroundFetchTestBase::download_manager() { 298 MockDownloadManager* BackgroundFetchTestBase::download_manager() {
298 return download_manager_; 299 return download_manager_;
299 } 300 }
300 301
301 } // namespace content 302 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698