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

Side by Side Diff: content/shell/webkit_test_runner.cc

Issue 11565036: [content shell] use WebTestRunner::WebPreferences for layout tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 8 years 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 #include "content/shell/webkit_test_runner.h" 5 #include "content/shell/webkit_test_runner.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/md5.h" 9 #include "base/md5.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 29 matching lines...) Expand all
40 using WebKit::WebContextMenuData; 40 using WebKit::WebContextMenuData;
41 using WebKit::WebDevToolsAgent; 41 using WebKit::WebDevToolsAgent;
42 using WebKit::WebElement; 42 using WebKit::WebElement;
43 using WebKit::WebFrame; 43 using WebKit::WebFrame;
44 using WebKit::WebGamepads; 44 using WebKit::WebGamepads;
45 using WebKit::WebRect; 45 using WebKit::WebRect;
46 using WebKit::WebSize; 46 using WebKit::WebSize;
47 using WebKit::WebString; 47 using WebKit::WebString;
48 using WebKit::WebVector; 48 using WebKit::WebVector;
49 using WebKit::WebView; 49 using WebKit::WebView;
50 using WebTestRunner::WebPreferences;
50 using WebTestRunner::WebTask; 51 using WebTestRunner::WebTask;
51 52
52 namespace content { 53 namespace content {
53 54
54 namespace { 55 namespace {
55 56
56 void InvokeTaskHelper(void* context) { 57 void InvokeTaskHelper(void* context) {
57 WebTask* task = reinterpret_cast<WebTask*>(context); 58 WebTask* task = reinterpret_cast<WebTask*>(context);
58 task->run(); 59 task->run();
59 delete task; 60 delete task;
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 #endif 229 #endif
229 if (!path.IsAbsolute()) { 230 if (!path.IsAbsolute()) {
230 GURL base_url = 231 GURL base_url =
231 net::FilePathToFileURL(current_working_directory_.Append( 232 net::FilePathToFileURL(current_working_directory_.Append(
232 FILE_PATH_LITERAL("foo"))); 233 FILE_PATH_LITERAL("foo")));
233 net::FileURLToFilePath(base_url.Resolve(utf8_path), &path); 234 net::FileURLToFilePath(base_url.Resolve(utf8_path), &path);
234 } 235 }
235 return webkit_base::FilePathToWebString(path); 236 return webkit_base::FilePathToWebString(path);
236 } 237 }
237 238
239 WebPreferences* WebKitTestRunner::preferences() {
240 return &prefs_;
241 }
242
243 void WebKitTestRunner::applyPreferences() {
244 webkit_glue::WebPreferences prefs = render_view()->GetWebkitPreferences();
245 prefs_.Export(&prefs);
246 render_view()->SetWebkitPreferences(prefs);
247 Send(new ShellViewHostMsg_OverridePreferences(routing_id(), prefs_));
248 }
249
238 // RenderViewObserver -------------------------------------------------------- 250 // RenderViewObserver --------------------------------------------------------
239 251
240 void WebKitTestRunner::DidClearWindowObject(WebFrame* frame) { 252 void WebKitTestRunner::DidClearWindowObject(WebFrame* frame) {
241 ShellRenderProcessObserver::GetInstance()->BindTestRunnersToWindow(frame); 253 ShellRenderProcessObserver::GetInstance()->BindTestRunnersToWindow(frame);
242 } 254 }
243 255
244 void WebKitTestRunner::DidFinishLoad(WebFrame* frame) { 256 void WebKitTestRunner::DidFinishLoad(WebFrame* frame) {
245 if (!frame->parent()) 257 if (!frame->parent())
246 Send(new ShellViewHostMsg_DidFinishLoad(routing_id())); 258 Send(new ShellViewHostMsg_DidFinishLoad(routing_id()));
247 } 259 }
(...skipping 21 matching lines...) Expand all
269 281
270 void WebKitTestRunner::Display() { 282 void WebKitTestRunner::Display() {
271 const WebSize& size = render_view()->GetWebView()->size(); 283 const WebSize& size = render_view()->GetWebView()->size();
272 WebRect rect(0, 0, size.width, size.height); 284 WebRect rect(0, 0, size.width, size.height);
273 proxy_->setPaintRect(rect); 285 proxy_->setPaintRect(rect);
274 PaintInvalidatedRegion(); 286 PaintInvalidatedRegion();
275 DisplayRepaintMask(); 287 DisplayRepaintMask();
276 } 288 }
277 289
278 void WebKitTestRunner::SetXSSAuditorEnabled(bool enabled) { 290 void WebKitTestRunner::SetXSSAuditorEnabled(bool enabled) {
279 prefs_.xss_auditor_enabled = enabled; 291 prefs_.XSSAuditorEnabled = enabled;
280 webkit_glue::WebPreferences prefs = render_view()->GetWebkitPreferences(); 292 webkit_glue::WebPreferences prefs = render_view()->GetWebkitPreferences();
281 prefs_.Apply(&prefs); 293 prefs_.Export(&prefs);
282 render_view()->SetWebkitPreferences(prefs); 294 render_view()->SetWebkitPreferences(prefs);
283 Send(new ShellViewHostMsg_OverridePreferences(routing_id(), prefs_)); 295 Send(new ShellViewHostMsg_OverridePreferences(routing_id(), prefs_));
284 } 296 }
285 297
286 void WebKitTestRunner::NotifyDone() { 298 void WebKitTestRunner::NotifyDone() {
287 Send(new ShellViewHostMsg_NotifyDone(routing_id())); 299 Send(new ShellViewHostMsg_NotifyDone(routing_id()));
288 } 300 }
289 301
290 void WebKitTestRunner::DumpAsText() { 302 void WebKitTestRunner::DumpAsText() {
291 Send(new ShellViewHostMsg_DumpAsText(routing_id())); 303 Send(new ShellViewHostMsg_DumpAsText(routing_id()));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 if (agent) 339 if (agent)
328 agent->evaluateInWebInspector(call_id, WebString::fromUTF8(script)); 340 agent->evaluateInWebInspector(call_id, WebString::fromUTF8(script));
329 } 341 }
330 342
331 void WebKitTestRunner::NotImplemented(const std::string& object, 343 void WebKitTestRunner::NotImplemented(const std::string& object,
332 const std::string& method) { 344 const std::string& method) {
333 Send(new ShellViewHostMsg_NotImplemented(routing_id(), object, method)); 345 Send(new ShellViewHostMsg_NotImplemented(routing_id(), object, method));
334 } 346 }
335 347
336 void WebKitTestRunner::Reset() { 348 void WebKitTestRunner::Reset() {
337 prefs_ = ShellWebPreferences(); 349 prefs_.reset();
338 webkit_glue::WebPreferences prefs = render_view()->GetWebkitPreferences(); 350 webkit_glue::WebPreferences prefs = render_view()->GetWebkitPreferences();
339 prefs_.Apply(&prefs); 351 prefs_.Export(&prefs);
340 render_view()->SetWebkitPreferences(prefs); 352 render_view()->SetWebkitPreferences(prefs);
341 } 353 }
342 354
343 // Private methods ----------------------------------------------------------- 355 // Private methods -----------------------------------------------------------
344 356
345 void WebKitTestRunner::OnCaptureTextDump(bool as_text, 357 void WebKitTestRunner::OnCaptureTextDump(bool as_text,
346 bool printing, 358 bool printing,
347 bool recursive) { 359 bool recursive) {
348 WebFrame* frame = render_view()->GetWebView()->mainFrame(); 360 WebFrame* frame = render_view()->GetWebView()->mainFrame();
349 std::string dump; 361 std::string dump;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 PaintRect(rect); 472 PaintRect(rect);
461 } 473 }
462 CHECK(proxy_->paintRect().isEmpty()); 474 CHECK(proxy_->paintRect().isEmpty());
463 } 475 }
464 476
465 void WebKitTestRunner::DisplayRepaintMask() { 477 void WebKitTestRunner::DisplayRepaintMask() {
466 GetCanvas()->drawARGB(167, 0, 0, 0); 478 GetCanvas()->drawARGB(167, 0, 0, 0);
467 } 479 }
468 480
469 } // namespace content 481 } // namespace content
OLDNEW
« content/shell/shell_webpreferences.h ('K') | « content/shell/webkit_test_runner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698