summaryrefslogtreecommitdiffstats
path: root/extensions/browser/api_test_utils.cc
diff options
context:
space:
mode:
authordhnishi@chromium.org <dhnishi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-09 02:53:32 +0000
committerdhnishi@chromium.org <dhnishi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-09 02:54:30 +0000
commit904eb66575fc98086e1a8b90b21a6e5ebc6afc2c (patch)
tree7064cc28fda091fa231806e1a6777bd60ee96408 /extensions/browser/api_test_utils.cc
parent459a22a5e7e580f888faa4ef0cbc1f37d624a810 (diff)
downloadchromium_src-904eb66575fc98086e1a8b90b21a6e5ebc6afc2c.zip
chromium_src-904eb66575fc98086e1a8b90b21a6e5ebc6afc2c.tar.gz
chromium_src-904eb66575fc98086e1a8b90b21a6e5ebc6afc2c.tar.bz2
Move SocketsTcpApiTest.SocketsTcpCreateGood to app_shell_browsertests.
BUG=388893 Review URL: https://codereview.chromium.org/449303002 Cr-Commit-Position: refs/heads/master@{#288495} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288495 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'extensions/browser/api_test_utils.cc')
-rw-r--r--extensions/browser/api_test_utils.cc40
1 files changed, 37 insertions, 3 deletions
diff --git a/extensions/browser/api_test_utils.cc b/extensions/browser/api_test_utils.cc
index 4c9a58b..b18b249 100644
--- a/extensions/browser/api_test_utils.cc
+++ b/extensions/browser/api_test_utils.cc
@@ -11,10 +11,24 @@
#include "content/public/test/test_utils.h"
#include "extensions/browser/extension_function.h"
#include "extensions/browser/extension_function_dispatcher.h"
+#include "extensions/common/extension_builder.h"
#include "testing/gtest/include/gtest/gtest.h"
+using extensions::ExtensionFunctionDispatcher;
+
namespace {
+class TestFunctionDispatcherDelegate
+ : public ExtensionFunctionDispatcher::Delegate {
+ public:
+ TestFunctionDispatcherDelegate() {}
+ virtual ~TestFunctionDispatcherDelegate() {}
+
+ // NULL implementation.
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TestFunctionDispatcherDelegate);
+};
+
base::Value* ParseJSON(const std::string& data) {
return base::JSONReader::Read(data);
}
@@ -69,16 +83,16 @@ namespace extensions {
namespace api_test_utils {
-base::Value* RunFunctionAndReturnSingleResult(
+base::Value* RunFunctionWithDelegateAndReturnSingleResult(
UIThreadExtensionFunction* function,
const std::string& args,
content::BrowserContext* context,
scoped_ptr<extensions::ExtensionFunctionDispatcher> dispatcher) {
- return RunFunctionAndReturnSingleResult(
+ return RunFunctionWithDelegateAndReturnSingleResult(
function, args, context, dispatcher.Pass(), NONE);
}
-base::Value* RunFunctionAndReturnSingleResult(
+base::Value* RunFunctionWithDelegateAndReturnSingleResult(
UIThreadExtensionFunction* function,
const std::string& args,
content::BrowserContext* context,
@@ -98,6 +112,26 @@ base::Value* RunFunctionAndReturnSingleResult(
return NULL;
}
+base::Value* RunFunctionAndReturnSingleResult(
+ UIThreadExtensionFunction* function,
+ const std::string& args,
+ content::BrowserContext* context) {
+ return RunFunctionAndReturnSingleResult(function, args, context, NONE);
+}
+
+base::Value* RunFunctionAndReturnSingleResult(
+ UIThreadExtensionFunction* function,
+ const std::string& args,
+ content::BrowserContext* context,
+ RunFunctionFlags flags) {
+ TestFunctionDispatcherDelegate delegate;
+ scoped_ptr<ExtensionFunctionDispatcher> dispatcher(
+ new ExtensionFunctionDispatcher(context, &delegate));
+
+ return RunFunctionWithDelegateAndReturnSingleResult(
+ function, args, context, dispatcher.Pass(), flags);
+}
+
bool RunFunction(UIThreadExtensionFunction* function,
const std::string& args,
content::BrowserContext* context,