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

Unified Diff: extensions/browser/api_test_utils.cc

Issue 461273003: Rework ExtensionApiUnittest to run in extensions_unittests, removing its Chrome dependencies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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: extensions/browser/api_test_utils.cc
diff --git a/extensions/browser/api_test_utils.cc b/extensions/browser/api_test_utils.cc
index b18b249e58dd560a405d6e61a9753faae0c4e366..829e18540e017460c6040f3e2205b9dd9a623f25 100644
--- a/extensions/browser/api_test_utils.cc
+++ b/extensions/browser/api_test_utils.cc
@@ -132,6 +132,27 @@ base::Value* RunFunctionAndReturnSingleResult(
function, args, context, dispatcher.Pass(), flags);
}
+std::string RunFunctionAndReturnError(UIThreadExtensionFunction* function,
James Cook 2014/08/13 16:11:36 What's the plan for the copy of this code in chrom
Yoyo Zhou 2014/08/13 22:53:43 I'd rather not spend time on refactoring it when t
+ const std::string& args,
+ content::BrowserContext* context) {
+ return RunFunctionAndReturnError(function, args, context, NONE);
+}
+
+std::string RunFunctionAndReturnError(UIThreadExtensionFunction* function,
+ const std::string& args,
+ content::BrowserContext* context,
+ RunFunctionFlags flags) {
+ TestFunctionDispatcherDelegate delegate;
+ scoped_ptr<ExtensionFunctionDispatcher> dispatcher(
+ new ExtensionFunctionDispatcher(context, &delegate));
+ scoped_refptr<ExtensionFunction> function_owner(function);
+ // Without a callback the function will not generate a result.
+ function->set_has_callback(true);
+ RunFunction(function, args, context, dispatcher.Pass(), flags);
+ EXPECT_FALSE(function->GetResultList()) << "Did not expect a result";
+ return function->GetError();
+}
+
bool RunFunction(UIThreadExtensionFunction* function,
const std::string& args,
content::BrowserContext* context,

Powered by Google App Engine
This is Rietveld 408576698