Move blob URL scheme registration from test_shell.cc to
simple_resource_loader_bridge.cc, so that it happens for both test_shell and the
Chromium DRT (allowing blob layout tests to pass with the latter too).

BUG=55587
TEST=blob-related layout tests (with both test_shell and DRT)
Review URL: http://codereview.chromium.org/3397002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59406 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/webkit/support/webkit_support.gypi b/webkit/support/webkit_support.gypi
index d052566..2aa5d6a 100644
--- a/webkit/support/webkit_support.gypi
+++ b/webkit/support/webkit_support.gypi
@@ -16,6 +16,7 @@
         '<(DEPTH)/skia/skia.gyp:skia',
         '<(DEPTH)/testing/gtest.gyp:gtest',
         'appcache',
+        'blob',
         'database',
         'glue',
       ],
diff --git a/webkit/tools/test_shell/simple_resource_loader_bridge.cc b/webkit/tools/test_shell/simple_resource_loader_bridge.cc
index c6a66a3..dc11e91d 100644
--- a/webkit/tools/test_shell/simple_resource_loader_bridge.cc
+++ b/webkit/tools/test_shell/simple_resource_loader_bridge.cc
@@ -58,8 +58,10 @@
 #include "net/socket/ssl_client_socket_nss_factory.h"
 #endif
 #include "net/url_request/url_request.h"
+#include "net/url_request/url_request_job.h"
 #include "webkit/appcache/appcache_interfaces.h"
 #include "webkit/blob/blob_storage_controller.h"
+#include "webkit/blob/blob_url_request_job.h"
 #include "webkit/glue/resource_loader_bridge.h"
 #include "webkit/tools/test_shell/simple_appcache_system.h"
 #include "webkit/tools/test_shell/simple_socket_stream_bridge.h"
@@ -88,6 +90,17 @@
   bool accept_all_cookies;
 };
 
+static URLRequestJob* BlobURLRequestJobFactory(URLRequest* request,
+                                               const std::string& scheme) {
+  webkit_blob::BlobStorageController* blob_storage_controller =
+      static_cast<TestShellRequestContext*>(request->context())->
+          blob_storage_controller();
+  return new webkit_blob::BlobURLRequestJob(
+      request,
+      blob_storage_controller->GetBlobDataFromUrl(request->url()),
+      NULL);
+}
+
 TestShellRequestContextParams* g_request_context_params = NULL;
 URLRequestContext* g_request_context = NULL;
 base::Thread* g_cache_thread = NULL;
@@ -123,9 +136,11 @@
 
     SimpleAppCacheSystem::InitializeOnIOThread(g_request_context);
     SimpleSocketStreamBridge::InitializeOnIOThread(g_request_context);
+
     TestShellWebBlobRegistryImpl::InitializeOnIOThread(
         static_cast<TestShellRequestContext*>(g_request_context)->
             blob_storage_controller());
+    URLRequest::RegisterProtocolFactory("blob", &BlobURLRequestJobFactory);
   }
 
   virtual void CleanUp() {
diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc
index 1ef481d..53e3071 100644
--- a/webkit/tools/test_shell/test_shell.cc
+++ b/webkit/tools/test_shell/test_shell.cc
@@ -44,8 +44,6 @@
 #include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h"
 #include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h"
 #include "third_party/WebKit/WebKit/chromium/public/WebView.h"
-#include "webkit/blob/blob_storage_controller.h"
-#include "webkit/blob/blob_url_request_job.h"
 #include "webkit/glue/glue_serialize.h"
 #include "webkit/glue/webkit_glue.h"
 #include "webkit/glue/webpreferences.h"
@@ -104,16 +102,6 @@
   DISALLOW_COPY_AND_ASSIGN(URLRequestTestShellFileJob);
 };
 
-URLRequestJob* BlobURLRequestJobFactory(URLRequest* request,
-                                        const std::string& scheme) {
-  webkit_blob::BlobStorageController* blob_storage_controller =
-      static_cast<TestShellRequestContext*>(request->context())->
-          blob_storage_controller();
-  return new webkit_blob::BlobURLRequestJob(
-      request,
-      blob_storage_controller->GetBlobDataFromUrl(request->url()),
-      NULL);
-}
 
 }  // namespace
 
@@ -158,8 +146,6 @@
                                &URLRequestTestShellFileJob::InspectorFactory);
     url_util::AddStandardScheme("test-shell-resource");
 
-    URLRequest::RegisterProtocolFactory("blob", &BlobURLRequestJobFactory);
-
     if (!file_system_root_.CreateUniqueTempDir()) {
       LOG(WARNING) << "Failed to create a temp dir for the filesystem."
                       "FileSystem feature will be disabled.";