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

Unified Diff: chrome/browser/extensions/extension_function_test_utils.cc

Issue 10694106: Added support for multiple parameters to Extension API callbacks. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Synced. Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_function_test_utils.cc
diff --git a/chrome/browser/extensions/extension_function_test_utils.cc b/chrome/browser/extensions/extension_function_test_utils.cc
index 2f0fc463ee29eb9800571ef5450584fe8c8c2d86..29097ec354b08029b1d50a8c7f58f6e24db7c581 100644
--- a/chrome/browser/extensions/extension_function_test_utils.cc
+++ b/chrome/browser/extensions/extension_function_test_utils.cc
@@ -130,25 +130,31 @@ std::string RunFunctionAndReturnError(UIThreadExtensionFunction* function,
RunFunctionFlags flags) {
scoped_refptr<ExtensionFunction> function_owner(function);
RunFunction(function, args, browser, flags);
- EXPECT_FALSE(function->GetResultValue()) << "Did not expect a result";
+ EXPECT_FALSE(function->GetResultList()) << "Did not expect a result";
return function->GetError();
}
-base::Value* RunFunctionAndReturnResult(UIThreadExtensionFunction* function,
- const std::string& args,
- Browser* browser) {
- return RunFunctionAndReturnResult(function, args, browser, NONE);
+base::Value* RunFunctionAndReturnSingleResult(
+ UIThreadExtensionFunction* function,
+ const std::string& args,
+ Browser* browser) {
+ return RunFunctionAndReturnSingleResult(function, args, browser, NONE);
}
-base::Value* RunFunctionAndReturnResult(UIThreadExtensionFunction* function,
- const std::string& args,
- Browser* browser,
- RunFunctionFlags flags) {
+base::Value* RunFunctionAndReturnSingleResult(
+ UIThreadExtensionFunction* function,
+ const std::string& args,
+ Browser* browser,
+ RunFunctionFlags flags) {
scoped_refptr<ExtensionFunction> function_owner(function);
RunFunction(function, args, browser, flags);
EXPECT_TRUE(function->GetError().empty()) << "Unexpected error: "
<< function->GetError();
- return (function->GetResultValue() == NULL) ? NULL :
- function->GetResultValue()->DeepCopy();
+ base::Value* single_result = NULL;
+ if (function->GetResultList() != NULL &&
+ function->GetResultList()->Get(0, &single_result)) {
+ return single_result->DeepCopy();
+ }
+ return NULL;
}
// This helps us be able to wait until an AsyncExtensionFunction calls

Powered by Google App Engine
This is Rietveld 408576698