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

Side by Side Diff: content/public/test/test_file_error_injector.cc

Issue 11458003: Remove scoped_refptr::release which is confusing and causes leaks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix mac Created 8 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/public/test/test_file_error_injector.h" 5 #include "content/public/test/test_file_error_injector.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 void DownloadFileWithErrorsFactory::ClearErrors() { 306 void DownloadFileWithErrorsFactory::ClearErrors() {
307 injected_errors_.clear(); 307 injected_errors_.clear();
308 } 308 }
309 309
310 TestFileErrorInjector::TestFileErrorInjector( 310 TestFileErrorInjector::TestFileErrorInjector(
311 scoped_refptr<DownloadManager> download_manager) 311 scoped_refptr<DownloadManager> download_manager)
312 : created_factory_(NULL), 312 : created_factory_(NULL),
313 // This code is only used for browser_tests, so a 313 // This code is only used for browser_tests, so a
314 // DownloadManager is always a DownloadManagerImpl. 314 // DownloadManager is always a DownloadManagerImpl.
315 download_manager_( 315 download_manager_(
316 static_cast<DownloadManagerImpl*>(download_manager.release())) { 316 static_cast<DownloadManagerImpl*>(download_manager.get())) {
317 // Record the value of the pointer, for later validation. 317 // Record the value of the pointer, for later validation.
318 created_factory_ = 318 created_factory_ =
319 new DownloadFileWithErrorsFactory( 319 new DownloadFileWithErrorsFactory(
320 base::Bind(&TestFileErrorInjector::RecordDownloadFileConstruction, 320 base::Bind(&TestFileErrorInjector::RecordDownloadFileConstruction,
321 this), 321 this),
322 base::Bind(&TestFileErrorInjector::RecordDownloadFileDestruction, 322 base::Bind(&TestFileErrorInjector::RecordDownloadFileDestruction,
323 this)); 323 this));
324 324
325 // We will transfer ownership of the factory to the download manager. 325 // We will transfer ownership of the factory to the download manager.
326 scoped_ptr<DownloadFileFactory> download_file_factory( 326 scoped_ptr<DownloadFileFactory> download_file_factory(
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 case FILE_OPERATION_RENAME_ANNOTATE: 439 case FILE_OPERATION_RENAME_ANNOTATE:
440 return "RENAME_ANNOTATE"; 440 return "RENAME_ANNOTATE";
441 default: 441 default:
442 break; 442 break;
443 } 443 }
444 444
445 return "Unknown"; 445 return "Unknown";
446 } 446 }
447 447
448 } // namespace content 448 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698