diff options
author | yoz <yoz@chromium.org> | 2014-08-27 19:23:05 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-08-28 02:23:49 +0000 |
commit | b6272ef2f62c82478c53f93eb42f2cabed2a21d0 (patch) | |
tree | 469976dae040d570b7b8e89fa1a807c5a1b25892 /extensions/browser/api_test_utils.cc | |
parent | 6fe3f977401afbb8e62adf7912e9bd59c0445d02 (diff) | |
download | chromium_src-b6272ef2f62c82478c53f93eb42f2cabed2a21d0.zip chromium_src-b6272ef2f62c82478c53f93eb42f2cabed2a21d0.tar.gz chromium_src-b6272ef2f62c82478c53f93eb42f2cabed2a21d0.tar.bz2 |
Rework ExtensionApiUnittest to run in extensions_unittests, removing its Chrome dependencies.
Move SocketsTcpUnitTest as the first test to use it.
BUG=397164
Review URL: https://codereview.chromium.org/461273003
Cr-Commit-Position: refs/heads/master@{#292296}
Diffstat (limited to 'extensions/browser/api_test_utils.cc')
-rw-r--r-- | extensions/browser/api_test_utils.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/extensions/browser/api_test_utils.cc b/extensions/browser/api_test_utils.cc index 1c70b27..dd04bb7 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, + 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, |