Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(414)

Side by Side Diff: webkit/tools/test_shell/simple_resource_loader_bridge.cc

Issue 11416382: ********** Content tests with blob hacking. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // This file contains an implementation of the ResourceLoaderBridge class. 5 // This file contains an implementation of the ResourceLoaderBridge class.
6 // The class is implemented using net::URLRequest, meaning it is a "simple" 6 // The class is implemented using net::URLRequest, meaning it is a "simple"
7 // version that directly issues requests. The more complicated one used in the 7 // version that directly issues requests. The more complicated one used in the
8 // browser uses IPC. 8 // browser uses IPC.
9 // 9 //
10 // Because net::URLRequest only provides an asynchronous resource loading API, 10 // Because net::URLRequest only provides an asynchronous resource loading API,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 #include "net/base/static_cookie_policy.h" 55 #include "net/base/static_cookie_policy.h"
56 #include "net/base/upload_data_stream.h" 56 #include "net/base/upload_data_stream.h"
57 #include "net/cookies/cookie_store.h" 57 #include "net/cookies/cookie_store.h"
58 #include "net/http/http_cache.h" 58 #include "net/http/http_cache.h"
59 #include "net/http/http_request_headers.h" 59 #include "net/http/http_request_headers.h"
60 #include "net/http/http_response_headers.h" 60 #include "net/http/http_response_headers.h"
61 #include "net/url_request/url_request.h" 61 #include "net/url_request/url_request.h"
62 #include "net/url_request/url_request_context.h" 62 #include "net/url_request/url_request_context.h"
63 #include "net/url_request/url_request_job.h" 63 #include "net/url_request/url_request_job.h"
64 #include "webkit/appcache/appcache_interfaces.h" 64 #include "webkit/appcache/appcache_interfaces.h"
65 #include "webkit/blob/blob_storage_controller.h" 65 #include "webkit/blob/blob_storage_context.h"
66 #include "webkit/blob/blob_url_request_job.h" 66 #include "webkit/blob/blob_url_request_job_factory.h"
67 #include "webkit/blob/shareable_file_reference.h" 67 #include "webkit/blob/shareable_file_reference.h"
68 #include "webkit/fileapi/file_system_context.h" 68 #include "webkit/fileapi/file_system_context.h"
69 #include "webkit/fileapi/file_system_dir_url_request_job.h" 69 #include "webkit/fileapi/file_system_dir_url_request_job.h"
70 #include "webkit/fileapi/file_system_url_request_job.h" 70 #include "webkit/fileapi/file_system_url_request_job.h"
71 #include "webkit/glue/resource_loader_bridge.h" 71 #include "webkit/glue/resource_loader_bridge.h"
72 #include "webkit/glue/resource_request_body.h" 72 #include "webkit/glue/resource_request_body.h"
73 #include "webkit/glue/webkit_glue.h" 73 #include "webkit/glue/webkit_glue.h"
74 #include "webkit/tools/test_shell/simple_appcache_system.h" 74 #include "webkit/tools/test_shell/simple_appcache_system.h"
75 #include "webkit/tools/test_shell/simple_file_system.h" 75 #include "webkit/tools/test_shell/simple_file_system.h"
76 #include "webkit/tools/test_shell/simple_file_writer.h" 76 #include "webkit/tools/test_shell/simple_file_writer.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 g_request_context_params = NULL; 266 g_request_context_params = NULL;
267 } else { 267 } else {
268 g_request_context = new TestShellRequestContext(); 268 g_request_context = new TestShellRequestContext();
269 } 269 }
270 270
271 g_network_delegate = new TestShellNetworkDelegate(); 271 g_network_delegate = new TestShellNetworkDelegate();
272 g_request_context->set_network_delegate(g_network_delegate); 272 g_request_context->set_network_delegate(g_network_delegate);
273 273
274 SimpleAppCacheSystem::InitializeOnIOThread(g_request_context); 274 SimpleAppCacheSystem::InitializeOnIOThread(g_request_context);
275 SimpleSocketStreamBridge::InitializeOnIOThread(g_request_context); 275 SimpleSocketStreamBridge::InitializeOnIOThread(g_request_context);
276 SimpleFileWriter::InitializeOnIOThread(g_request_context); 276 SimpleFileWriter::InitializeOnIOThread(
277 SimpleFileSystem::InitializeOnIOThread( 277 g_request_context, g_request_context->blob_storage_context());
278 g_request_context->blob_storage_controller());
279 TestShellWebBlobRegistryImpl::InitializeOnIOThread( 278 TestShellWebBlobRegistryImpl::InitializeOnIOThread(
280 g_request_context->blob_storage_controller()); 279 g_request_context->blob_storage_context());
281 } 280 }
282 281
283 virtual void CleanUp() OVERRIDE { 282 virtual void CleanUp() OVERRIDE {
284 // In reverse order of initialization. 283 // In reverse order of initialization.
285 TestShellWebBlobRegistryImpl::Cleanup(); 284 TestShellWebBlobRegistryImpl::Cleanup();
286 SimpleFileSystem::CleanupOnIOThread();
287 SimpleFileWriter::CleanupOnIOThread(); 285 SimpleFileWriter::CleanupOnIOThread();
288 SimpleSocketStreamBridge::Cleanup(); 286 SimpleSocketStreamBridge::Cleanup();
289 SimpleAppCacheSystem::CleanupOnIOThread(); 287 SimpleAppCacheSystem::CleanupOnIOThread();
290 288
291 if (g_request_context) { 289 if (g_request_context) {
292 g_request_context->set_network_delegate(NULL); 290 g_request_context->set_network_delegate(NULL);
293 delete g_request_context; 291 delete g_request_context;
294 g_request_context = NULL; 292 g_request_context = NULL;
295 } 293 }
296 294
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 webkit_glue::ConfigureURLRequestForReferrerPolicy( 456 webkit_glue::ConfigureURLRequestForReferrerPolicy(
459 request_.get(), params->referrer_policy); 457 request_.get(), params->referrer_policy);
460 net::HttpRequestHeaders headers; 458 net::HttpRequestHeaders headers;
461 headers.AddHeadersFromString(params->headers); 459 headers.AddHeadersFromString(params->headers);
462 request_->SetExtraRequestHeaders(headers); 460 request_->SetExtraRequestHeaders(headers);
463 request_->set_load_flags(params->load_flags); 461 request_->set_load_flags(params->load_flags);
464 if (params->request_body) { 462 if (params->request_body) {
465 request_->set_upload(make_scoped_ptr( 463 request_->set_upload(make_scoped_ptr(
466 params->request_body->ResolveElementsAndCreateUploadDataStream( 464 params->request_body->ResolveElementsAndCreateUploadDataStream(
467 static_cast<TestShellRequestContext*>(g_request_context)-> 465 static_cast<TestShellRequestContext*>(g_request_context)->
468 blob_storage_controller(), 466 blob_storage_context(),
469 static_cast<TestShellRequestContext*>(g_request_context)-> 467 static_cast<TestShellRequestContext*>(g_request_context)->
470 file_system_context(), 468 file_system_context(),
471 base::MessageLoopProxy::current()))); 469 base::MessageLoopProxy::current())));
472 } 470 }
471
472 if (request_->url().SchemeIs("blob")) {
473 webkit_blob::BlobProtocolHandler::SetRequestedBlobDataHandle(
474 request_.get(),
475 static_cast<TestShellRequestContext*>(g_request_context)->
476 blob_storage_context()->
477 GetBlobDataFromPublicUrl(request_->url()));
478 }
479
473 SimpleAppCacheSystem::SetExtraRequestInfo( 480 SimpleAppCacheSystem::SetExtraRequestInfo(
474 request_.get(), params->appcache_host_id, params->request_type); 481 request_.get(), params->appcache_host_id, params->request_type);
475 482
476 download_to_file_ = params->download_to_file; 483 download_to_file_ = params->download_to_file;
477 if (download_to_file_) { 484 if (download_to_file_) {
478 base::FilePath path; 485 base::FilePath path;
479 if (file_util::CreateTemporaryFile(&path)) { 486 if (file_util::CreateTemporaryFile(&path)) {
480 downloaded_file_ = ShareableFileReference::GetOrCreate( 487 downloaded_file_ = ShareableFileReference::GetOrCreate(
481 path, ShareableFileReference::DELETE_ON_FINAL_RELEASE, 488 path, ShareableFileReference::DELETE_ON_FINAL_RELEASE,
482 base::MessageLoopProxy::current()); 489 base::MessageLoopProxy::current());
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 if (!g_file_over_http_mappings) 1164 if (!g_file_over_http_mappings)
1158 g_file_over_http_mappings = new FileOverHTTPPathMappings(); 1165 g_file_over_http_mappings = new FileOverHTTPPathMappings();
1159 g_file_over_http_mappings->AddMapping(file_path_template, http_prefix); 1166 g_file_over_http_mappings->AddMapping(file_path_template, http_prefix);
1160 } 1167 }
1161 1168
1162 // static 1169 // static
1163 webkit_glue::ResourceLoaderBridge* SimpleResourceLoaderBridge::Create( 1170 webkit_glue::ResourceLoaderBridge* SimpleResourceLoaderBridge::Create(
1164 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { 1171 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) {
1165 return new ResourceLoaderBridgeImpl(request_info); 1172 return new ResourceLoaderBridgeImpl(request_info);
1166 } 1173 }
OLDNEW
« no previous file with comments | « webkit/tools/test_shell/simple_file_writer.cc ('k') | webkit/tools/test_shell/test_shell_request_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698