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

Unified Diff: chrome/browser/extensions/api/downloads/downloads_api_unittest.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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/downloads/downloads_api_unittest.cc
diff --git a/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc b/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc
index 1f6d8379b0942391280a1149a44f8f6ac630f20a..05c4b82834ab79e42b594754e5dca71082312dc5 100644
--- a/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc
+++ b/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc
@@ -468,26 +468,27 @@ class DownloadExtensionTest : public ExtensionApiTest {
// profile(), so pass it the on-record browser so that it always uses the
// on-record profile to match real-life behavior.
- base::Value* RunFunctionAndReturnResult(UIThreadExtensionFunction* function,
- const std::string& args) {
- scoped_refptr<UIThreadExtensionFunction> delete_function(function);
- SetUpExtensionFunction(function);
+ base::Value* RunFunctionAndReturnResult(
+ scoped_refptr<UIThreadExtensionFunction> function,
+ const std::string& args) {
+ SetUpExtensionFunction(function.get());
return extension_function_test_utils::RunFunctionAndReturnSingleResult(
- function, args, browser(), GetFlags());
+ function.get(), args, browser(), GetFlags());
}
- std::string RunFunctionAndReturnError(UIThreadExtensionFunction* function,
- const std::string& args) {
- scoped_refptr<UIThreadExtensionFunction> delete_function(function);
- SetUpExtensionFunction(function);
+ std::string RunFunctionAndReturnError(
+ scoped_refptr<UIThreadExtensionFunction> function,
+ const std::string& args) {
+ SetUpExtensionFunction(function.get());
return extension_function_test_utils::RunFunctionAndReturnError(
- function, args, browser(), GetFlags());
+ function.get(), args, browser(), GetFlags());
}
- bool RunFunctionAndReturnString(UIThreadExtensionFunction* function,
- const std::string& args,
- std::string* result_string) {
- SetUpExtensionFunction(function);
+ bool RunFunctionAndReturnString(
+ scoped_refptr<UIThreadExtensionFunction> function,
+ const std::string& args,
+ std::string* result_string) {
+ SetUpExtensionFunction(function.get());
scoped_ptr<base::Value> result(RunFunctionAndReturnResult(function, args));
EXPECT_TRUE(result.get());
return result.get() && result->GetAsString(result_string);
@@ -882,7 +883,7 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
error.c_str());
}
-UIThreadExtensionFunction* MockedGetFileIconFunction(
+scoped_refptr<UIThreadExtensionFunction> MockedGetFileIconFunction(
const FilePath& expected_path,
IconLoader::IconSize icon_size,
const std::string& response) {
@@ -890,7 +891,7 @@ UIThreadExtensionFunction* MockedGetFileIconFunction(
new DownloadsGetFileIconFunction());
function->SetIconExtractorForTesting(new MockIconExtractorImpl(
expected_path, icon_size, response));
- return function.release();
+ return function;
}
// Test downloads.getFileIcon() on in-progress, finished, cancelled and deleted

Powered by Google App Engine
This is Rietveld 408576698