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

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

Issue 3282003: Support handling blob URL and resolve blob references in upload data.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 3 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #undef LOG 5 #undef LOG
6 6
7 #include "webkit/tools/test_shell/test_shell.h" 7 #include "webkit/tools/test_shell/test_shell.h"
8 8
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 25 matching lines...) Expand all
36 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" 36 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
37 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" 37 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h"
38 #include "third_party/WebKit/WebKit/chromium/public/WebScriptController.h" 38 #include "third_party/WebKit/WebKit/chromium/public/WebScriptController.h"
39 #include "third_party/WebKit/WebKit/chromium/public/WebRect.h" 39 #include "third_party/WebKit/WebKit/chromium/public/WebRect.h"
40 #include "third_party/WebKit/WebKit/chromium/public/WebSize.h" 40 #include "third_party/WebKit/WebKit/chromium/public/WebSize.h"
41 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" 41 #include "third_party/WebKit/WebKit/chromium/public/WebString.h"
42 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" 42 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h"
43 #include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h" 43 #include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h"
44 #include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h" 44 #include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h"
45 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" 45 #include "third_party/WebKit/WebKit/chromium/public/WebView.h"
46 #include "webkit/blob/blob_storage_controller.h"
47 #include "webkit/blob/blob_url_request_job.h"
46 #include "webkit/glue/glue_serialize.h" 48 #include "webkit/glue/glue_serialize.h"
47 #include "webkit/glue/webkit_glue.h" 49 #include "webkit/glue/webkit_glue.h"
48 #include "webkit/glue/webpreferences.h" 50 #include "webkit/glue/webpreferences.h"
49 #include "webkit/tools/test_shell/accessibility_controller.h" 51 #include "webkit/tools/test_shell/accessibility_controller.h"
50 #include "webkit/tools/test_shell/notification_presenter.h" 52 #include "webkit/tools/test_shell/notification_presenter.h"
51 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" 53 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h"
52 #include "webkit/tools/test_shell/test_navigation_controller.h" 54 #include "webkit/tools/test_shell/test_navigation_controller.h"
53 #include "webkit/tools/test_shell/test_shell_devtools_agent.h" 55 #include "webkit/tools/test_shell/test_shell_devtools_agent.h"
54 #include "webkit/tools/test_shell/test_shell_devtools_client.h" 56 #include "webkit/tools/test_shell/test_shell_devtools_client.h"
57 #include "webkit/tools/test_shell/test_shell_request_context.h"
55 #include "webkit/tools/test_shell/test_shell_switches.h" 58 #include "webkit/tools/test_shell/test_shell_switches.h"
56 #include "webkit/tools/test_shell/test_webview_delegate.h" 59 #include "webkit/tools/test_shell/test_webview_delegate.h"
57 60
58 using WebKit::WebCanvas; 61 using WebKit::WebCanvas;
59 using WebKit::WebFrame; 62 using WebKit::WebFrame;
60 using WebKit::WebNavigationPolicy; 63 using WebKit::WebNavigationPolicy;
61 using WebKit::WebRect; 64 using WebKit::WebRect;
62 using WebKit::WebScriptController; 65 using WebKit::WebScriptController;
63 using WebKit::WebSize; 66 using WebKit::WebSize;
64 using WebKit::WebURLRequest; 67 using WebKit::WebURLRequest;
(...skipping 28 matching lines...) Expand all
93 96
94 private: 97 private:
95 URLRequestTestShellFileJob(URLRequest* request, const FilePath& path) 98 URLRequestTestShellFileJob(URLRequest* request, const FilePath& path)
96 : URLRequestFileJob(request, path) { 99 : URLRequestFileJob(request, path) {
97 } 100 }
98 virtual ~URLRequestTestShellFileJob() { } 101 virtual ~URLRequestTestShellFileJob() { }
99 102
100 DISALLOW_COPY_AND_ASSIGN(URLRequestTestShellFileJob); 103 DISALLOW_COPY_AND_ASSIGN(URLRequestTestShellFileJob);
101 }; 104 };
102 105
106 URLRequestJob* BlobURLRequestJobFactory(URLRequest* request,
107 const std::string& scheme) {
108 webkit_blob::BlobStorageController* blob_storage_controller =
109 static_cast<TestShellRequestContext*>(request->context())->
110 blob_storage_controller();
111 return new webkit_blob::BlobURLRequestJob(
112 request,
113 blob_storage_controller->GetBlobDataFromUrl(request->url()),
114 NULL);
115 }
116
103 } // namespace 117 } // namespace
104 118
105 // Initialize static member variable 119 // Initialize static member variable
106 WindowList* TestShell::window_list_; 120 WindowList* TestShell::window_list_;
107 WebPreferences* TestShell::web_prefs_ = NULL; 121 WebPreferences* TestShell::web_prefs_ = NULL;
108 bool TestShell::developer_extras_enabled_ = false; 122 bool TestShell::developer_extras_enabled_ = false;
109 bool TestShell::layout_test_mode_ = false; 123 bool TestShell::layout_test_mode_ = false;
110 bool TestShell::allow_external_pages_ = false; 124 bool TestShell::allow_external_pages_ = false;
111 int TestShell::file_test_timeout_ms_ = kDefaultFileTestTimeoutMillisecs; 125 int TestShell::file_test_timeout_ms_ = kDefaultFileTestTimeoutMillisecs;
112 bool TestShell::test_is_preparing_ = false; 126 bool TestShell::test_is_preparing_ = false;
(...skipping 22 matching lines...) Expand all
135 event_sending_controller_.reset(new EventSendingController(this)); 149 event_sending_controller_.reset(new EventSendingController(this));
136 plain_text_controller_.reset(new PlainTextController(this)); 150 plain_text_controller_.reset(new PlainTextController(this));
137 text_input_controller_.reset(new TextInputController(this)); 151 text_input_controller_.reset(new TextInputController(this));
138 navigation_controller_.reset(new TestNavigationController(this)); 152 navigation_controller_.reset(new TestNavigationController(this));
139 notification_presenter_.reset(new TestNotificationPresenter(this)); 153 notification_presenter_.reset(new TestNotificationPresenter(this));
140 154
141 URLRequestFilter* filter = URLRequestFilter::GetInstance(); 155 URLRequestFilter* filter = URLRequestFilter::GetInstance();
142 filter->AddHostnameHandler("test-shell-resource", "inspector", 156 filter->AddHostnameHandler("test-shell-resource", "inspector",
143 &URLRequestTestShellFileJob::InspectorFactory); 157 &URLRequestTestShellFileJob::InspectorFactory);
144 url_util::AddStandardScheme("test-shell-resource"); 158 url_util::AddStandardScheme("test-shell-resource");
159
160 URLRequest::RegisterProtocolFactory("blob", &BlobURLRequestJobFactory);
145 } 161 }
146 162
147 TestShell::~TestShell() { 163 TestShell::~TestShell() {
148 delegate_->RevokeDragDrop(); 164 delegate_->RevokeDragDrop();
149 165
150 // DevTools frontend page is supposed to be navigated only once and 166 // DevTools frontend page is supposed to be navigated only once and
151 // loading another URL in that Page is an error. 167 // loading another URL in that Page is an error.
152 if (!dev_tools_client_.get()) { 168 if (!dev_tools_client_.get()) {
153 // Navigate to an empty page to fire all the destruction logic for the 169 // Navigate to an empty page to fire all the destruction logic for the
154 // current page. 170 // current page.
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 return -1; 836 return -1;
821 } 837 }
822 838
823 bool GetFontTable(int fd, uint32_t table, uint8_t* output, 839 bool GetFontTable(int fd, uint32_t table, uint8_t* output,
824 size_t* output_length) { 840 size_t* output_length) {
825 return false; 841 return false;
826 } 842 }
827 #endif 843 #endif
828 844
829 } // namespace webkit_glue 845 } // namespace webkit_glue
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698