summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_function_test_utils.h
diff options
context:
space:
mode:
authormiket@chromium.org <miket@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-22 00:20:33 +0000
committermiket@chromium.org <miket@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-22 00:20:33 +0000
commitbdfc03ebd9af014a7f633a9dcb1575b599b907f0 (patch)
tree11f801ccd7be9340d07e535a9e7df49802c62cda /chrome/browser/extensions/extension_function_test_utils.h
parent60acf75ef79d28ffac791a73e301305fe6d41bff (diff)
downloadchromium_src-bdfc03ebd9af014a7f633a9dcb1575b599b907f0.zip
chromium_src-bdfc03ebd9af014a7f633a9dcb1575b599b907f0.tar.gz
chromium_src-bdfc03ebd9af014a7f633a9dcb1575b599b907f0.tar.bz2
Refactor to allow same code to test both sync and async functions.
BUG=none TEST=none Review URL: http://codereview.chromium.org/8588067 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111050 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_function_test_utils.h')
-rw-r--r--chrome/browser/extensions/extension_function_test_utils.h24
1 files changed, 8 insertions, 16 deletions
diff --git a/chrome/browser/extensions/extension_function_test_utils.h b/chrome/browser/extensions/extension_function_test_utils.h
index ef005a4..e248ec3 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_