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

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

Issue 63253002: Rename WebKit namespace to blink (part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « content/test/test_webkit_platform_support.h ('k') | content/test/web_gesture_curve_mock.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 25 matching lines...) Expand all
36 #include "webkit/glue/simple_webmimeregistry_impl.h" 36 #include "webkit/glue/simple_webmimeregistry_impl.h"
37 #include "webkit/glue/webkit_glue.h" 37 #include "webkit/glue/webkit_glue.h"
38 #include "webkit/renderer/compositor_bindings/web_compositor_support_impl.h" 38 #include "webkit/renderer/compositor_bindings/web_compositor_support_impl.h"
39 39
40 #if defined(OS_WIN) 40 #if defined(OS_WIN)
41 #include "third_party/WebKit/public/platform/win/WebThemeEngine.h" 41 #include "third_party/WebKit/public/platform/win/WebThemeEngine.h"
42 #elif defined(OS_MACOSX) 42 #elif defined(OS_MACOSX)
43 #include "base/mac/mac_util.h" 43 #include "base/mac/mac_util.h"
44 #endif 44 #endif
45 45
46 using WebKit::WebScriptController; 46 using blink::WebScriptController;
47 using webkit::WebLayerTreeViewImplForTesting; 47 using webkit::WebLayerTreeViewImplForTesting;
48 48
49 namespace content { 49 namespace content {
50 50
51 TestWebKitPlatformSupport::TestWebKitPlatformSupport() { 51 TestWebKitPlatformSupport::TestWebKitPlatformSupport() {
52 url_loader_factory_.reset(new WebURLLoaderMockFactory()); 52 url_loader_factory_.reset(new WebURLLoaderMockFactory());
53 mock_clipboard_.reset(new MockWebClipboardImpl()); 53 mock_clipboard_.reset(new MockWebClipboardImpl());
54 v8::V8::SetCounterFunction(base::StatsTable::FindLocation); 54 v8::V8::SetCounterFunction(base::StatsTable::FindLocation);
55 55
56 WebKit::initialize(this); 56 blink::initialize(this);
57 WebKit::setLayoutTestMode(true); 57 blink::setLayoutTestMode(true);
58 WebKit::WebSecurityPolicy::registerURLSchemeAsLocal( 58 blink::WebSecurityPolicy::registerURLSchemeAsLocal(
59 WebKit::WebString::fromUTF8("test-shell-resource")); 59 blink::WebString::fromUTF8("test-shell-resource"));
60 WebKit::WebSecurityPolicy::registerURLSchemeAsNoAccess( 60 blink::WebSecurityPolicy::registerURLSchemeAsNoAccess(
61 WebKit::WebString::fromUTF8("test-shell-resource")); 61 blink::WebString::fromUTF8("test-shell-resource"));
62 WebKit::WebSecurityPolicy::registerURLSchemeAsDisplayIsolated( 62 blink::WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(
63 WebKit::WebString::fromUTF8("test-shell-resource")); 63 blink::WebString::fromUTF8("test-shell-resource"));
64 WebKit::WebSecurityPolicy::registerURLSchemeAsEmptyDocument( 64 blink::WebSecurityPolicy::registerURLSchemeAsEmptyDocument(
65 WebKit::WebString::fromUTF8("test-shell-resource")); 65 blink::WebString::fromUTF8("test-shell-resource"));
66 WebScriptController::enableV8SingleThreadMode(); 66 WebScriptController::enableV8SingleThreadMode();
67 WebKit::WebRuntimeFeatures::enableApplicationCache(true); 67 blink::WebRuntimeFeatures::enableApplicationCache(true);
68 WebKit::WebRuntimeFeatures::enableDatabase(true); 68 blink::WebRuntimeFeatures::enableDatabase(true);
69 WebKit::WebRuntimeFeatures::enableNotifications(true); 69 blink::WebRuntimeFeatures::enableNotifications(true);
70 WebKit::WebRuntimeFeatures::enableTouch(true); 70 blink::WebRuntimeFeatures::enableTouch(true);
71 71
72 // Load libraries for media and enable the media player. 72 // Load libraries for media and enable the media player.
73 bool enable_media = false; 73 bool enable_media = false;
74 base::FilePath module_path; 74 base::FilePath module_path;
75 if (PathService::Get(base::DIR_MODULE, &module_path)) { 75 if (PathService::Get(base::DIR_MODULE, &module_path)) {
76 #if defined(OS_MACOSX) 76 #if defined(OS_MACOSX)
77 if (base::mac::AmIBundled()) 77 if (base::mac::AmIBundled())
78 module_path = module_path.DirName().DirName().DirName(); 78 module_path = module_path.DirName().DirName().DirName();
79 #endif 79 #endif
80 if (media::InitializeMediaLibrary(module_path)) 80 if (media::InitializeMediaLibrary(module_path))
81 enable_media = true; 81 enable_media = true;
82 } 82 }
83 WebKit::WebRuntimeFeatures::enableMediaPlayer(enable_media); 83 blink::WebRuntimeFeatures::enableMediaPlayer(enable_media);
84 LOG_IF(WARNING, !enable_media) << "Failed to initialize the media library.\n"; 84 LOG_IF(WARNING, !enable_media) << "Failed to initialize the media library.\n";
85 85
86 // TODO(joth): Make a dummy geolocation service implemenation for 86 // TODO(joth): Make a dummy geolocation service implemenation for
87 // test_shell, and set this to true. http://crbug.com/36451 87 // test_shell, and set this to true. http://crbug.com/36451
88 WebKit::WebRuntimeFeatures::enableGeolocation(false); 88 blink::WebRuntimeFeatures::enableGeolocation(false);
89 89
90 file_utilities_.set_sandbox_enabled(false); 90 file_utilities_.set_sandbox_enabled(false);
91 91
92 if (!file_system_root_.CreateUniqueTempDir()) { 92 if (!file_system_root_.CreateUniqueTempDir()) {
93 LOG(WARNING) << "Failed to create a temp dir for the filesystem." 93 LOG(WARNING) << "Failed to create a temp dir for the filesystem."
94 "FileSystem feature will be disabled."; 94 "FileSystem feature will be disabled.";
95 DCHECK(file_system_root_.path().empty()); 95 DCHECK(file_system_root_.path().empty());
96 } 96 }
97 97
98 #if defined(OS_WIN) 98 #if defined(OS_WIN)
99 // Ensure we pick up the default theme engine. 99 // Ensure we pick up the default theme engine.
100 SetThemeEngine(NULL); 100 SetThemeEngine(NULL);
101 #endif 101 #endif
102 102
103 net::CookieMonster::EnableFileScheme(); 103 net::CookieMonster::EnableFileScheme();
104 104
105 // Test shell always exposes the GC. 105 // Test shell always exposes the GC.
106 webkit_glue::SetJavaScriptFlags(" --expose-gc"); 106 webkit_glue::SetJavaScriptFlags(" --expose-gc");
107 } 107 }
108 108
109 TestWebKitPlatformSupport::~TestWebKitPlatformSupport() { 109 TestWebKitPlatformSupport::~TestWebKitPlatformSupport() {
110 url_loader_factory_.reset(); 110 url_loader_factory_.reset();
111 mock_clipboard_.reset(); 111 mock_clipboard_.reset();
112 WebKit::shutdown(); 112 blink::shutdown();
113 } 113 }
114 114
115 WebKit::WebMimeRegistry* TestWebKitPlatformSupport::mimeRegistry() { 115 blink::WebMimeRegistry* TestWebKitPlatformSupport::mimeRegistry() {
116 return &mime_registry_; 116 return &mime_registry_;
117 } 117 }
118 118
119 WebKit::WebClipboard* TestWebKitPlatformSupport::clipboard() { 119 blink::WebClipboard* TestWebKitPlatformSupport::clipboard() {
120 // Mock out clipboard calls so that tests don't mess 120 // Mock out clipboard calls so that tests don't mess
121 // with each other's copies/pastes when running in parallel. 121 // with each other's copies/pastes when running in parallel.
122 return mock_clipboard_.get(); 122 return mock_clipboard_.get();
123 } 123 }
124 124
125 WebKit::WebFileUtilities* TestWebKitPlatformSupport::fileUtilities() { 125 blink::WebFileUtilities* TestWebKitPlatformSupport::fileUtilities() {
126 return &file_utilities_; 126 return &file_utilities_;
127 } 127 }
128 128
129 WebKit::WebIDBFactory* TestWebKitPlatformSupport::idbFactory() { 129 blink::WebIDBFactory* TestWebKitPlatformSupport::idbFactory() {
130 NOTREACHED() << 130 NOTREACHED() <<
131 "IndexedDB cannot be tested with in-process harnesses."; 131 "IndexedDB cannot be tested with in-process harnesses.";
132 return NULL; 132 return NULL;
133 } 133 }
134 134
135 WebKit::WebURLLoader* TestWebKitPlatformSupport::createURLLoader() { 135 blink::WebURLLoader* TestWebKitPlatformSupport::createURLLoader() {
136 return url_loader_factory_->CreateURLLoader( 136 return url_loader_factory_->CreateURLLoader(
137 webkit_glue::WebKitPlatformSupportImpl::createURLLoader()); 137 webkit_glue::WebKitPlatformSupportImpl::createURLLoader());
138 } 138 }
139 139
140 WebKit::WebData TestWebKitPlatformSupport::loadResource(const char* name) { 140 blink::WebData TestWebKitPlatformSupport::loadResource(const char* name) {
141 if (!strcmp(name, "deleteButton")) { 141 if (!strcmp(name, "deleteButton")) {
142 // Create a red 30x30 square. 142 // Create a red 30x30 square.
143 const char red_square[] = 143 const char red_square[] =
144 "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52" 144 "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52"
145 "\x00\x00\x00\x1e\x00\x00\x00\x1e\x04\x03\x00\x00\x00\xc9\x1e\xb3" 145 "\x00\x00\x00\x1e\x00\x00\x00\x1e\x04\x03\x00\x00\x00\xc9\x1e\xb3"
146 "\x91\x00\x00\x00\x30\x50\x4c\x54\x45\x00\x00\x00\x80\x00\x00\x00" 146 "\x91\x00\x00\x00\x30\x50\x4c\x54\x45\x00\x00\x00\x80\x00\x00\x00"
147 "\x80\x00\x80\x80\x00\x00\x00\x80\x80\x00\x80\x00\x80\x80\x80\x80" 147 "\x80\x00\x80\x80\x00\x00\x00\x80\x80\x00\x80\x00\x80\x80\x80\x80"
148 "\x80\xc0\xc0\xc0\xff\x00\x00\x00\xff\x00\xff\xff\x00\x00\x00\xff" 148 "\x80\xc0\xc0\xc0\xff\x00\x00\x00\xff\x00\xff\xff\x00\x00\x00\xff"
149 "\xff\x00\xff\x00\xff\xff\xff\xff\xff\x7b\x1f\xb1\xc4\x00\x00\x00" 149 "\xff\x00\xff\x00\xff\xff\xff\xff\xff\x7b\x1f\xb1\xc4\x00\x00\x00"
150 "\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\x00\x9a" 150 "\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\x00\x9a"
151 "\x9c\x18\x00\x00\x00\x17\x49\x44\x41\x54\x78\x01\x63\x98\x89\x0a" 151 "\x9c\x18\x00\x00\x00\x17\x49\x44\x41\x54\x78\x01\x63\x98\x89\x0a"
152 "\x18\x50\xb9\x33\x47\xf9\xa8\x01\x32\xd4\xc2\x03\x00\x33\x84\x0d" 152 "\x18\x50\xb9\x33\x47\xf9\xa8\x01\x32\xd4\xc2\x03\x00\x33\x84\x0d"
153 "\x02\x3a\x91\xeb\xa5\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60" 153 "\x02\x3a\x91\xeb\xa5\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60"
154 "\x82"; 154 "\x82";
155 return WebKit::WebData(red_square, arraysize(red_square)); 155 return blink::WebData(red_square, arraysize(red_square));
156 } 156 }
157 return webkit_glue::WebKitPlatformSupportImpl::loadResource(name); 157 return webkit_glue::WebKitPlatformSupportImpl::loadResource(name);
158 } 158 }
159 159
160 WebKit::WebString TestWebKitPlatformSupport::queryLocalizedString( 160 blink::WebString TestWebKitPlatformSupport::queryLocalizedString(
161 WebKit::WebLocalizedString::Name name) { 161 blink::WebLocalizedString::Name name) {
162 // Returns placeholder strings to check if they are correctly localized. 162 // Returns placeholder strings to check if they are correctly localized.
163 switch (name) { 163 switch (name) {
164 case WebKit::WebLocalizedString::OtherDateLabel: 164 case blink::WebLocalizedString::OtherDateLabel:
165 return ASCIIToUTF16("<<OtherDateLabel>>"); 165 return ASCIIToUTF16("<<OtherDateLabel>>");
166 case WebKit::WebLocalizedString::OtherMonthLabel: 166 case blink::WebLocalizedString::OtherMonthLabel:
167 return ASCIIToUTF16("<<OtherMonthLabel>>"); 167 return ASCIIToUTF16("<<OtherMonthLabel>>");
168 case WebKit::WebLocalizedString::OtherTimeLabel: 168 case blink::WebLocalizedString::OtherTimeLabel:
169 return ASCIIToUTF16("<<OtherTimeLabel>>"); 169 return ASCIIToUTF16("<<OtherTimeLabel>>");
170 case WebKit::WebLocalizedString::OtherWeekLabel: 170 case blink::WebLocalizedString::OtherWeekLabel:
171 return ASCIIToUTF16("<<OtherWeekLabel>>"); 171 return ASCIIToUTF16("<<OtherWeekLabel>>");
172 case WebKit::WebLocalizedString::CalendarClear: 172 case blink::WebLocalizedString::CalendarClear:
173 return ASCIIToUTF16("<<CalendarClear>>"); 173 return ASCIIToUTF16("<<CalendarClear>>");
174 case WebKit::WebLocalizedString::CalendarToday: 174 case blink::WebLocalizedString::CalendarToday:
175 return ASCIIToUTF16("<<CalendarToday>>"); 175 return ASCIIToUTF16("<<CalendarToday>>");
176 case WebKit::WebLocalizedString::ThisMonthButtonLabel: 176 case blink::WebLocalizedString::ThisMonthButtonLabel:
177 return ASCIIToUTF16("<<ThisMonthLabel>>"); 177 return ASCIIToUTF16("<<ThisMonthLabel>>");
178 case WebKit::WebLocalizedString::ThisWeekButtonLabel: 178 case blink::WebLocalizedString::ThisWeekButtonLabel:
179 return ASCIIToUTF16("<<ThisWeekLabel>>"); 179 return ASCIIToUTF16("<<ThisWeekLabel>>");
180 case WebKit::WebLocalizedString::WeekFormatTemplate: 180 case blink::WebLocalizedString::WeekFormatTemplate:
181 return ASCIIToUTF16("Week $2, $1"); 181 return ASCIIToUTF16("Week $2, $1");
182 default: 182 default:
183 return WebKitPlatformSupportImpl::queryLocalizedString(name); 183 return WebKitPlatformSupportImpl::queryLocalizedString(name);
184 } 184 }
185 } 185 }
186 186
187 WebKit::WebString TestWebKitPlatformSupport::queryLocalizedString( 187 blink::WebString TestWebKitPlatformSupport::queryLocalizedString(
188 WebKit::WebLocalizedString::Name name, 188 blink::WebLocalizedString::Name name,
189 const WebKit::WebString& value) { 189 const blink::WebString& value) {
190 if (name == WebKit::WebLocalizedString::ValidationRangeUnderflow) 190 if (name == blink::WebLocalizedString::ValidationRangeUnderflow)
191 return ASCIIToUTF16("range underflow"); 191 return ASCIIToUTF16("range underflow");
192 if (name == WebKit::WebLocalizedString::ValidationRangeOverflow) 192 if (name == blink::WebLocalizedString::ValidationRangeOverflow)
193 return ASCIIToUTF16("range overflow"); 193 return ASCIIToUTF16("range overflow");
194 return WebKitPlatformSupportImpl::queryLocalizedString(name, value); 194 return WebKitPlatformSupportImpl::queryLocalizedString(name, value);
195 } 195 }
196 196
197 WebKit::WebString TestWebKitPlatformSupport::queryLocalizedString( 197 blink::WebString TestWebKitPlatformSupport::queryLocalizedString(
198 WebKit::WebLocalizedString::Name name, 198 blink::WebLocalizedString::Name name,
199 const WebKit::WebString& value1, 199 const blink::WebString& value1,
200 const WebKit::WebString& value2) { 200 const blink::WebString& value2) {
201 if (name == WebKit::WebLocalizedString::ValidationTooLong) 201 if (name == blink::WebLocalizedString::ValidationTooLong)
202 return ASCIIToUTF16("too long"); 202 return ASCIIToUTF16("too long");
203 if (name == WebKit::WebLocalizedString::ValidationStepMismatch) 203 if (name == blink::WebLocalizedString::ValidationStepMismatch)
204 return ASCIIToUTF16("step mismatch"); 204 return ASCIIToUTF16("step mismatch");
205 return WebKitPlatformSupportImpl::queryLocalizedString(name, value1, value2); 205 return WebKitPlatformSupportImpl::queryLocalizedString(name, value1, value2);
206 } 206 }
207 207
208 WebKit::WebString TestWebKitPlatformSupport::defaultLocale() { 208 blink::WebString TestWebKitPlatformSupport::defaultLocale() {
209 return ASCIIToUTF16("en-US"); 209 return ASCIIToUTF16("en-US");
210 } 210 }
211 211
212 #if defined(OS_WIN) || defined(OS_MACOSX) 212 #if defined(OS_WIN) || defined(OS_MACOSX)
213 void TestWebKitPlatformSupport::SetThemeEngine(WebKit::WebThemeEngine* engine) { 213 void TestWebKitPlatformSupport::SetThemeEngine(blink::WebThemeEngine* engine) {
214 active_theme_engine_ = engine ? 214 active_theme_engine_ = engine ?
215 engine : WebKitPlatformSupportChildImpl::themeEngine(); 215 engine : WebKitPlatformSupportChildImpl::themeEngine();
216 } 216 }
217 217
218 WebKit::WebThemeEngine* TestWebKitPlatformSupport::themeEngine() { 218 blink::WebThemeEngine* TestWebKitPlatformSupport::themeEngine() {
219 return active_theme_engine_; 219 return active_theme_engine_;
220 } 220 }
221 #endif 221 #endif
222 222
223 WebKit::WebCompositorSupport* TestWebKitPlatformSupport::compositorSupport() { 223 blink::WebCompositorSupport* TestWebKitPlatformSupport::compositorSupport() {
224 return &compositor_support_; 224 return &compositor_support_;
225 } 225 }
226 226
227 base::string16 TestWebKitPlatformSupport::GetLocalizedString(int message_id) { 227 base::string16 TestWebKitPlatformSupport::GetLocalizedString(int message_id) {
228 return base::string16(); 228 return base::string16();
229 } 229 }
230 230
231 base::StringPiece TestWebKitPlatformSupport::GetDataResource( 231 base::StringPiece TestWebKitPlatformSupport::GetDataResource(
232 int resource_id, 232 int resource_id,
233 ui::ScaleFactor scale_factor) { 233 ui::ScaleFactor scale_factor) {
234 return base::StringPiece(); 234 return base::StringPiece();
235 } 235 }
236 236
237 webkit_glue::ResourceLoaderBridge* 237 webkit_glue::ResourceLoaderBridge*
238 TestWebKitPlatformSupport::CreateResourceLoader( 238 TestWebKitPlatformSupport::CreateResourceLoader(
239 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { 239 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) {
240 NOTREACHED(); 240 NOTREACHED();
241 return NULL; 241 return NULL;
242 } 242 }
243 243
244 webkit_glue::WebSocketStreamHandleBridge* 244 webkit_glue::WebSocketStreamHandleBridge*
245 TestWebKitPlatformSupport::CreateWebSocketStreamBridge( 245 TestWebKitPlatformSupport::CreateWebSocketStreamBridge(
246 WebKit::WebSocketStreamHandle* handle, 246 blink::WebSocketStreamHandle* handle,
247 webkit_glue::WebSocketStreamHandleDelegate* delegate) { 247 webkit_glue::WebSocketStreamHandleDelegate* delegate) {
248 NOTREACHED(); 248 NOTREACHED();
249 return NULL; 249 return NULL;
250 } 250 }
251 251
252 WebKit::WebGestureCurve* TestWebKitPlatformSupport::createFlingAnimationCurve( 252 blink::WebGestureCurve* TestWebKitPlatformSupport::createFlingAnimationCurve(
253 int device_source, 253 int device_source,
254 const WebKit::WebFloatPoint& velocity, 254 const blink::WebFloatPoint& velocity,
255 const WebKit::WebSize& cumulative_scroll) { 255 const blink::WebSize& cumulative_scroll) {
256 // Caller will retain and release. 256 // Caller will retain and release.
257 return new WebGestureCurveMock(velocity, cumulative_scroll); 257 return new WebGestureCurveMock(velocity, cumulative_scroll);
258 } 258 }
259 259
260 WebKit::WebUnitTestSupport* TestWebKitPlatformSupport::unitTestSupport() { 260 blink::WebUnitTestSupport* TestWebKitPlatformSupport::unitTestSupport() {
261 return this; 261 return this;
262 } 262 }
263 263
264 void TestWebKitPlatformSupport::registerMockedURL( 264 void TestWebKitPlatformSupport::registerMockedURL(
265 const WebKit::WebURL& url, 265 const blink::WebURL& url,
266 const WebKit::WebURLResponse& response, 266 const blink::WebURLResponse& response,
267 const WebKit::WebString& file_path) { 267 const blink::WebString& file_path) {
268 url_loader_factory_->RegisterURL(url, response, file_path); 268 url_loader_factory_->RegisterURL(url, response, file_path);
269 } 269 }
270 270
271 void TestWebKitPlatformSupport::registerMockedErrorURL( 271 void TestWebKitPlatformSupport::registerMockedErrorURL(
272 const WebKit::WebURL& url, 272 const blink::WebURL& url,
273 const WebKit::WebURLResponse& response, 273 const blink::WebURLResponse& response,
274 const WebKit::WebURLError& error) { 274 const blink::WebURLError& error) {
275 url_loader_factory_->RegisterErrorURL(url, response, error); 275 url_loader_factory_->RegisterErrorURL(url, response, error);
276 } 276 }
277 277
278 void TestWebKitPlatformSupport::unregisterMockedURL(const WebKit::WebURL& url) { 278 void TestWebKitPlatformSupport::unregisterMockedURL(const blink::WebURL& url) {
279 url_loader_factory_->UnregisterURL(url); 279 url_loader_factory_->UnregisterURL(url);
280 } 280 }
281 281
282 void TestWebKitPlatformSupport::unregisterAllMockedURLs() { 282 void TestWebKitPlatformSupport::unregisterAllMockedURLs() {
283 url_loader_factory_->UnregisterAllURLs(); 283 url_loader_factory_->UnregisterAllURLs();
284 } 284 }
285 285
286 void TestWebKitPlatformSupport::serveAsynchronousMockedRequests() { 286 void TestWebKitPlatformSupport::serveAsynchronousMockedRequests() {
287 url_loader_factory_->ServeAsynchronousRequests(); 287 url_loader_factory_->ServeAsynchronousRequests();
288 } 288 }
289 289
290 WebKit::WebString TestWebKitPlatformSupport::webKitRootDir() { 290 blink::WebString TestWebKitPlatformSupport::webKitRootDir() {
291 base::FilePath path; 291 base::FilePath path;
292 PathService::Get(base::DIR_SOURCE_ROOT, &path); 292 PathService::Get(base::DIR_SOURCE_ROOT, &path);
293 path = path.Append(FILE_PATH_LITERAL("third_party/WebKit")); 293 path = path.Append(FILE_PATH_LITERAL("third_party/WebKit"));
294 path = base::MakeAbsoluteFilePath(path); 294 path = base::MakeAbsoluteFilePath(path);
295 CHECK(!path.empty()); 295 CHECK(!path.empty());
296 std::string path_ascii = path.MaybeAsASCII(); 296 std::string path_ascii = path.MaybeAsASCII();
297 CHECK(!path_ascii.empty()); 297 CHECK(!path_ascii.empty());
298 return WebKit::WebString::fromUTF8(path_ascii.c_str()); 298 return blink::WebString::fromUTF8(path_ascii.c_str());
299 } 299 }
300 300
301 WebKit::WebLayerTreeView* 301 blink::WebLayerTreeView*
302 TestWebKitPlatformSupport::createLayerTreeViewForTesting() { 302 TestWebKitPlatformSupport::createLayerTreeViewForTesting() {
303 scoped_ptr<WebLayerTreeViewImplForTesting> view( 303 scoped_ptr<WebLayerTreeViewImplForTesting> view(
304 new WebLayerTreeViewImplForTesting()); 304 new WebLayerTreeViewImplForTesting());
305 305
306 if (!view->Initialize()) 306 if (!view->Initialize())
307 return NULL; 307 return NULL;
308 return view.release(); 308 return view.release();
309 } 309 }
310 310
311 WebKit::WebLayerTreeView* 311 blink::WebLayerTreeView*
312 TestWebKitPlatformSupport::createLayerTreeViewForTesting(TestViewType type) { 312 TestWebKitPlatformSupport::createLayerTreeViewForTesting(TestViewType type) {
313 DCHECK_EQ(TestViewTypeUnitTest, type); 313 DCHECK_EQ(TestViewTypeUnitTest, type);
314 return createLayerTreeViewForTesting(); 314 return createLayerTreeViewForTesting();
315 } 315 }
316 316
317 WebKit::WebData TestWebKitPlatformSupport::readFromFile( 317 blink::WebData TestWebKitPlatformSupport::readFromFile(
318 const WebKit::WebString& path) { 318 const blink::WebString& path) {
319 base::FilePath file_path = base::FilePath::FromUTF16Unsafe(path); 319 base::FilePath file_path = base::FilePath::FromUTF16Unsafe(path);
320 320
321 std::string buffer; 321 std::string buffer;
322 base::ReadFileToString(file_path, &buffer); 322 base::ReadFileToString(file_path, &buffer);
323 323
324 return WebKit::WebData(buffer.data(), buffer.size()); 324 return blink::WebData(buffer.data(), buffer.size());
325 } 325 }
326 326
327 } // namespace content 327 } // namespace content
OLDNEW
« no previous file with comments | « content/test/test_webkit_platform_support.h ('k') | content/test/web_gesture_curve_mock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698