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

Side by Side Diff: content/test/test_webkit_platform_support.cc

Issue 185553014: Revert "Revert 254514 "Revert 254507 "Reland "Move WebKitPlatformSupport..."" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "content/test/test_webkit_platform_support.h" 5 #include "content/test/test_webkit_platform_support.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
11 #include "base/metrics/stats_counters.h" 11 #include "base/metrics/stats_counters.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "content/child/blink_platform_impl.h"
15 #include "content/public/common/content_switches.h" 14 #include "content/public/common/content_switches.h"
16 #include "content/test/mock_webclipboard_impl.h" 15 #include "content/test/mock_webclipboard_impl.h"
17 #include "content/test/web_gesture_curve_mock.h" 16 #include "content/test/web_gesture_curve_mock.h"
18 #include "content/test/web_layer_tree_view_impl_for_testing.h" 17 #include "content/test/web_layer_tree_view_impl_for_testing.h"
19 #include "content/test/weburl_loader_mock_factory.h" 18 #include "content/test/weburl_loader_mock_factory.h"
20 #include "media/base/media.h" 19 #include "media/base/media.h"
21 #include "net/cookies/cookie_monster.h" 20 #include "net/cookies/cookie_monster.h"
22 #include "net/test/spawned_test_server/spawned_test_server.h" 21 #include "net/test/spawned_test_server/spawned_test_server.h"
23 #include "third_party/WebKit/public/platform/WebData.h" 22 #include "third_party/WebKit/public/platform/WebData.h"
24 #include "third_party/WebKit/public/platform/WebFileSystem.h" 23 #include "third_party/WebKit/public/platform/WebFileSystem.h"
25 #include "third_party/WebKit/public/platform/WebStorageArea.h" 24 #include "third_party/WebKit/public/platform/WebStorageArea.h"
26 #include "third_party/WebKit/public/platform/WebStorageNamespace.h" 25 #include "third_party/WebKit/public/platform/WebStorageNamespace.h"
27 #include "third_party/WebKit/public/platform/WebString.h" 26 #include "third_party/WebKit/public/platform/WebString.h"
28 #include "third_party/WebKit/public/platform/WebURL.h" 27 #include "third_party/WebKit/public/platform/WebURL.h"
29 #include "third_party/WebKit/public/web/WebDatabase.h" 28 #include "third_party/WebKit/public/web/WebDatabase.h"
30 #include "third_party/WebKit/public/web/WebKit.h" 29 #include "third_party/WebKit/public/web/WebKit.h"
31 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" 30 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
32 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" 31 #include "third_party/WebKit/public/web/WebSecurityPolicy.h"
33 #include "third_party/WebKit/public/web/WebStorageEventDispatcher.h" 32 #include "third_party/WebKit/public/web/WebStorageEventDispatcher.h"
34 #include "v8/include/v8.h" 33 #include "v8/include/v8.h"
35 #include "webkit/browser/database/vfs_backend.h" 34 #include "webkit/browser/database/vfs_backend.h"
35 #include "webkit/child/webkitplatformsupport_impl.h"
36 #include "webkit/renderer/compositor_bindings/web_compositor_support_impl.h" 36 #include "webkit/renderer/compositor_bindings/web_compositor_support_impl.h"
37 37
38 #if defined(OS_MACOSX) 38 #if defined(OS_MACOSX)
39 #include "base/mac/mac_util.h" 39 #include "base/mac/mac_util.h"
40 #endif 40 #endif
41 41
42 namespace content { 42 namespace content {
43 43
44 TestWebKitPlatformSupport::TestWebKitPlatformSupport() { 44 TestWebKitPlatformSupport::TestWebKitPlatformSupport() {
45 url_loader_factory_.reset(new WebURLLoaderMockFactory()); 45 url_loader_factory_.reset(new WebURLLoaderMockFactory());
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 } 116 }
117 117
118 blink::WebIDBFactory* TestWebKitPlatformSupport::idbFactory() { 118 blink::WebIDBFactory* TestWebKitPlatformSupport::idbFactory() {
119 NOTREACHED() << 119 NOTREACHED() <<
120 "IndexedDB cannot be tested with in-process harnesses."; 120 "IndexedDB cannot be tested with in-process harnesses.";
121 return NULL; 121 return NULL;
122 } 122 }
123 123
124 blink::WebURLLoader* TestWebKitPlatformSupport::createURLLoader() { 124 blink::WebURLLoader* TestWebKitPlatformSupport::createURLLoader() {
125 return url_loader_factory_->CreateURLLoader( 125 return url_loader_factory_->CreateURLLoader(
126 BlinkPlatformImpl::createURLLoader()); 126 webkit_glue::WebKitPlatformSupportImpl::createURLLoader());
127 } 127 }
128 128
129 blink::WebData TestWebKitPlatformSupport::loadResource(const char* name) { 129 blink::WebData TestWebKitPlatformSupport::loadResource(const char* name) {
130 if (!strcmp(name, "deleteButton")) { 130 if (!strcmp(name, "deleteButton")) {
131 // Create a red 30x30 square. 131 // Create a red 30x30 square.
132 const char red_square[] = 132 const char red_square[] =
133 "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52" 133 "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52"
134 "\x00\x00\x00\x1e\x00\x00\x00\x1e\x04\x03\x00\x00\x00\xc9\x1e\xb3" 134 "\x00\x00\x00\x1e\x00\x00\x00\x1e\x04\x03\x00\x00\x00\xc9\x1e\xb3"
135 "\x91\x00\x00\x00\x30\x50\x4c\x54\x45\x00\x00\x00\x80\x00\x00\x00" 135 "\x91\x00\x00\x00\x30\x50\x4c\x54\x45\x00\x00\x00\x80\x00\x00\x00"
136 "\x80\x00\x80\x80\x00\x00\x00\x80\x80\x00\x80\x00\x80\x80\x80\x80" 136 "\x80\x00\x80\x80\x00\x00\x00\x80\x80\x00\x80\x00\x80\x80\x80\x80"
137 "\x80\xc0\xc0\xc0\xff\x00\x00\x00\xff\x00\xff\xff\x00\x00\x00\xff" 137 "\x80\xc0\xc0\xc0\xff\x00\x00\x00\xff\x00\xff\xff\x00\x00\x00\xff"
138 "\xff\x00\xff\x00\xff\xff\xff\xff\xff\x7b\x1f\xb1\xc4\x00\x00\x00" 138 "\xff\x00\xff\x00\xff\xff\xff\xff\xff\x7b\x1f\xb1\xc4\x00\x00\x00"
139 "\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\x00\x9a" 139 "\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\x00\x9a"
140 "\x9c\x18\x00\x00\x00\x17\x49\x44\x41\x54\x78\x01\x63\x98\x89\x0a" 140 "\x9c\x18\x00\x00\x00\x17\x49\x44\x41\x54\x78\x01\x63\x98\x89\x0a"
141 "\x18\x50\xb9\x33\x47\xf9\xa8\x01\x32\xd4\xc2\x03\x00\x33\x84\x0d" 141 "\x18\x50\xb9\x33\x47\xf9\xa8\x01\x32\xd4\xc2\x03\x00\x33\x84\x0d"
142 "\x02\x3a\x91\xeb\xa5\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60" 142 "\x02\x3a\x91\xeb\xa5\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60"
143 "\x82"; 143 "\x82";
144 return blink::WebData(red_square, arraysize(red_square)); 144 return blink::WebData(red_square, arraysize(red_square));
145 } 145 }
146 return BlinkPlatformImpl::loadResource(name); 146 return webkit_glue::WebKitPlatformSupportImpl::loadResource(name);
147 } 147 }
148 148
149 blink::WebString TestWebKitPlatformSupport::queryLocalizedString( 149 blink::WebString TestWebKitPlatformSupport::queryLocalizedString(
150 blink::WebLocalizedString::Name name) { 150 blink::WebLocalizedString::Name name) {
151 // Returns placeholder strings to check if they are correctly localized. 151 // Returns placeholder strings to check if they are correctly localized.
152 switch (name) { 152 switch (name) {
153 case blink::WebLocalizedString::OtherDateLabel: 153 case blink::WebLocalizedString::OtherDateLabel:
154 return base::ASCIIToUTF16("<<OtherDateLabel>>"); 154 return base::ASCIIToUTF16("<<OtherDateLabel>>");
155 case blink::WebLocalizedString::OtherMonthLabel: 155 case blink::WebLocalizedString::OtherMonthLabel:
156 return base::ASCIIToUTF16("<<OtherMonthLabel>>"); 156 return base::ASCIIToUTF16("<<OtherMonthLabel>>");
157 case blink::WebLocalizedString::OtherTimeLabel: 157 case blink::WebLocalizedString::OtherTimeLabel:
158 return base::ASCIIToUTF16("<<OtherTimeLabel>>"); 158 return base::ASCIIToUTF16("<<OtherTimeLabel>>");
159 case blink::WebLocalizedString::OtherWeekLabel: 159 case blink::WebLocalizedString::OtherWeekLabel:
160 return base::ASCIIToUTF16("<<OtherWeekLabel>>"); 160 return base::ASCIIToUTF16("<<OtherWeekLabel>>");
161 case blink::WebLocalizedString::CalendarClear: 161 case blink::WebLocalizedString::CalendarClear:
162 return base::ASCIIToUTF16("<<CalendarClear>>"); 162 return base::ASCIIToUTF16("<<CalendarClear>>");
163 case blink::WebLocalizedString::CalendarToday: 163 case blink::WebLocalizedString::CalendarToday:
164 return base::ASCIIToUTF16("<<CalendarToday>>"); 164 return base::ASCIIToUTF16("<<CalendarToday>>");
165 case blink::WebLocalizedString::ThisMonthButtonLabel: 165 case blink::WebLocalizedString::ThisMonthButtonLabel:
166 return base::ASCIIToUTF16("<<ThisMonthLabel>>"); 166 return base::ASCIIToUTF16("<<ThisMonthLabel>>");
167 case blink::WebLocalizedString::ThisWeekButtonLabel: 167 case blink::WebLocalizedString::ThisWeekButtonLabel:
168 return base::ASCIIToUTF16("<<ThisWeekLabel>>"); 168 return base::ASCIIToUTF16("<<ThisWeekLabel>>");
169 case blink::WebLocalizedString::WeekFormatTemplate: 169 case blink::WebLocalizedString::WeekFormatTemplate:
170 return base::ASCIIToUTF16("Week $2, $1"); 170 return base::ASCIIToUTF16("Week $2, $1");
171 default: 171 default:
172 return BlinkPlatformImpl::queryLocalizedString(name); 172 return WebKitPlatformSupportImpl::queryLocalizedString(name);
173 } 173 }
174 } 174 }
175 175
176 blink::WebString TestWebKitPlatformSupport::queryLocalizedString( 176 blink::WebString TestWebKitPlatformSupport::queryLocalizedString(
177 blink::WebLocalizedString::Name name, 177 blink::WebLocalizedString::Name name,
178 const blink::WebString& value) { 178 const blink::WebString& value) {
179 if (name == blink::WebLocalizedString::ValidationRangeUnderflow) 179 if (name == blink::WebLocalizedString::ValidationRangeUnderflow)
180 return base::ASCIIToUTF16("range underflow"); 180 return base::ASCIIToUTF16("range underflow");
181 if (name == blink::WebLocalizedString::ValidationRangeOverflow) 181 if (name == blink::WebLocalizedString::ValidationRangeOverflow)
182 return base::ASCIIToUTF16("range overflow"); 182 return base::ASCIIToUTF16("range overflow");
183 return BlinkPlatformImpl::queryLocalizedString(name, value); 183 return WebKitPlatformSupportImpl::queryLocalizedString(name, value);
184 } 184 }
185 185
186 blink::WebString TestWebKitPlatformSupport::queryLocalizedString( 186 blink::WebString TestWebKitPlatformSupport::queryLocalizedString(
187 blink::WebLocalizedString::Name name, 187 blink::WebLocalizedString::Name name,
188 const blink::WebString& value1, 188 const blink::WebString& value1,
189 const blink::WebString& value2) { 189 const blink::WebString& value2) {
190 if (name == blink::WebLocalizedString::ValidationTooLong) 190 if (name == blink::WebLocalizedString::ValidationTooLong)
191 return base::ASCIIToUTF16("too long"); 191 return base::ASCIIToUTF16("too long");
192 if (name == blink::WebLocalizedString::ValidationStepMismatch) 192 if (name == blink::WebLocalizedString::ValidationStepMismatch)
193 return base::ASCIIToUTF16("step mismatch"); 193 return base::ASCIIToUTF16("step mismatch");
194 return BlinkPlatformImpl::queryLocalizedString(name, value1, value2); 194 return WebKitPlatformSupportImpl::queryLocalizedString(name, value1, value2);
195 } 195 }
196 196
197 blink::WebString TestWebKitPlatformSupport::defaultLocale() { 197 blink::WebString TestWebKitPlatformSupport::defaultLocale() {
198 return base::ASCIIToUTF16("en-US"); 198 return base::ASCIIToUTF16("en-US");
199 } 199 }
200 200
201 #if defined(OS_WIN) || defined(OS_MACOSX) 201 #if defined(OS_WIN) || defined(OS_MACOSX)
202 void TestWebKitPlatformSupport::SetThemeEngine(blink::WebThemeEngine* engine) { 202 void TestWebKitPlatformSupport::SetThemeEngine(blink::WebThemeEngine* engine) {
203 active_theme_engine_ = engine ? 203 active_theme_engine_ = engine ?
204 engine : WebKitPlatformSupportChildImpl::themeEngine(); 204 engine : WebKitPlatformSupportChildImpl::themeEngine();
(...skipping 18 matching lines...) Expand all
223 return base::StringPiece(); 223 return base::StringPiece();
224 } 224 }
225 225
226 webkit_glue::ResourceLoaderBridge* 226 webkit_glue::ResourceLoaderBridge*
227 TestWebKitPlatformSupport::CreateResourceLoader( 227 TestWebKitPlatformSupport::CreateResourceLoader(
228 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { 228 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) {
229 NOTREACHED(); 229 NOTREACHED();
230 return NULL; 230 return NULL;
231 } 231 }
232 232
233 WebSocketStreamHandleBridge* 233 webkit_glue::WebSocketStreamHandleBridge*
234 TestWebKitPlatformSupport::CreateWebSocketStreamBridge( 234 TestWebKitPlatformSupport::CreateWebSocketStreamBridge(
235 blink::WebSocketStreamHandle* handle, 235 blink::WebSocketStreamHandle* handle,
236 WebSocketStreamHandleDelegate* delegate) { 236 webkit_glue::WebSocketStreamHandleDelegate* delegate) {
237 NOTREACHED(); 237 NOTREACHED();
238 return NULL; 238 return NULL;
239 } 239 }
240 240
241 blink::WebGestureCurve* TestWebKitPlatformSupport::createFlingAnimationCurve( 241 blink::WebGestureCurve* TestWebKitPlatformSupport::createFlingAnimationCurve(
242 int device_source, 242 int device_source,
243 const blink::WebFloatPoint& velocity, 243 const blink::WebFloatPoint& velocity,
244 const blink::WebSize& cumulative_scroll) { 244 const blink::WebSize& cumulative_scroll) {
245 // Caller will retain and release. 245 // Caller will retain and release.
246 return new WebGestureCurveMock(velocity, cumulative_scroll); 246 return new WebGestureCurveMock(velocity, cumulative_scroll);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 const blink::WebString& path) { 306 const blink::WebString& path) {
307 base::FilePath file_path = base::FilePath::FromUTF16Unsafe(path); 307 base::FilePath file_path = base::FilePath::FromUTF16Unsafe(path);
308 308
309 std::string buffer; 309 std::string buffer;
310 base::ReadFileToString(file_path, &buffer); 310 base::ReadFileToString(file_path, &buffer);
311 311
312 return blink::WebData(buffer.data(), buffer.size()); 312 return blink::WebData(buffer.data(), buffer.size());
313 } 313 }
314 314
315 } // namespace content 315 } // namespace content
OLDNEW
« no previous file with comments | « content/test/test_webkit_platform_support.h ('k') | webkit/child/ftp_directory_listing_response_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698