An initial pass at structure to do end-to-end extension API tests.  I'll work on actually fleshing out some tests in the next CL.

Review URL: http://codereview.chromium.org/171032

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23577 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/extensions/extension_function_dispatcher.cc b/chrome/browser/extensions/extension_function_dispatcher.cc
index e2fa753..5a3bb34 100644
--- a/chrome/browser/extensions/extension_function_dispatcher.cc
+++ b/chrome/browser/extensions/extension_function_dispatcher.cc
@@ -16,6 +16,7 @@
 #include "chrome/browser/extensions/extension_process_manager.h"
 #include "chrome/browser/extensions/extension_tabs_module.h"
 #include "chrome/browser/extensions/extension_tabs_module_constants.h"
+#include "chrome/browser/extensions/extension_test_api.h"
 #include "chrome/browser/extensions/extension_toolstrip_api.h"
 #include "chrome/browser/profile.h"
 #include "chrome/browser/renderer_host/render_process_host.h"
@@ -67,9 +68,10 @@
 void FactoryRegistry::ResetFunctions() {
   // Register all functions here.
 
-  namespace tabs = extension_tabs_module_constants;
-  namespace page_actions = extension_page_actions_module_constants;
   namespace bookmarks = extension_bookmarks_module_constants;
+  namespace page_actions = extension_page_actions_module_constants;
+  namespace tabs = extension_tabs_module_constants;
+  namespace test = extension_test_api_functions;
   namespace toolstrip = extension_toolstrip_api_functions;
 
   // Windows
@@ -139,6 +141,12 @@
       &NewExtensionFunction<ToolstripExpandFunction>;
   factories_[toolstrip::kCollapseFunction] =
       &NewExtensionFunction<ToolstripCollapseFunction>;
+
+  // Test.
+  factories_[test::kPassFunction] =
+      &NewExtensionFunction<ExtensionTestPassFunction>;
+  factories_[test::kFailFunction] =
+      &NewExtensionFunction<ExtensionTestFailFunction>;
 }
 
 void FactoryRegistry::GetAllNames(std::vector<std::string>* names) {
@@ -253,7 +261,8 @@
 }
 
 void ExtensionFunctionDispatcher::HandleBadMessage(ExtensionFunction* api) {
-  LOG(ERROR) << "bad extension message " <<  // TODO(erikkay) name?
+  LOG(ERROR) << "bad extension message " <<
+                api->name() << 
                 " : terminating renderer.";
   if (RenderProcessHost::run_renderer_in_process()) {
     // In single process mode it is better if we don't suicide but just crash.