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

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

Issue 8588067: Refactor to allow same code to test both sync and async functions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix dependencies. Created 9 years, 1 month 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.h
diff --git a/chrome/browser/extensions/extension_function_test_utils.h b/chrome/browser/extensions/extension_function_test_utils.h
index ef005a4dd3b277a340db28037ab7918d99ff1168..e248ec34efc7c6f06e1412380a43d07526454e5f 100644
--- a/chrome/browser/extensions/extension_function_test_utils.h
+++ b/chrome/browser/extensions/extension_function_test_utils.h
@@ -49,8 +49,7 @@ enum RunFunctionFlags {
};
// Run |function| with |args| and return the resulting error. Adds an error to
-// the current test if |function| returns a result. The caller releases
-// ownership of |function|.
+// the current test if |function| returns a result.
std::string RunFunctionAndReturnError(UIThreadExtensionFunction* function,
const std::string& args,
Browser* browser,
@@ -60,8 +59,8 @@ std::string RunFunctionAndReturnError(UIThreadExtensionFunction* function,
Browser* browser);
// Run |function| with |args| and return the result. Adds an error to the
-// current test if |function| returns an error. The caller releases ownership of
-// |function|. the caller takes ownership of the result.
+// current test if |function| returns an error. The caller takes ownership of
+// the result.
base::Value* RunFunctionAndReturnResult(UIThreadExtensionFunction* function,
const std::string& args,
Browser* browser,
@@ -70,28 +69,21 @@ base::Value* RunFunctionAndReturnResult(UIThreadExtensionFunction* function,
const std::string& args,
Browser* browser);
-// Create and run |function| with |args|. The caller retains ownership of
-// |function|.
+// Create and run |function| with |args|. Works with both synchronous and async
+// functions.
//
// TODO(aa): It would be nice if |args| could be validated against the schema
// that |function| expects. That way, we know that we are testing something
// close to what the bindings would actually send.
//
// TODO(aa): I'm concerned that this style won't scale to all the bits and bobs
-// we're going to need to frob for all the different extension functions. But we
-// can refactor when we see what is needed.
-void RunFunction(UIThreadExtensionFunction* function,
+// we're going to need to frob for all the different extension functions. But
+// we can refactor when we see what is needed.
+bool RunFunction(UIThreadExtensionFunction* function,
const std::string& args,
Browser* browser,
RunFunctionFlags flags);
-// Similar to RunFunction, but doesn't return until |function| calls
-// SendResponse. Returns the value |function| passed to SendResponse.
-bool RunAsyncFunction(AsyncExtensionFunction* function,
- const std::string& args,
- Browser* browser,
- RunFunctionFlags flags);
-
} // namespace extension_function_test_utils
#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_TEST_UTILS_H_
« no previous file with comments | « chrome/browser/extensions/extension_function.cc ('k') | chrome/browser/extensions/extension_function_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698