OLD | NEW |
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 14 matching lines...) Expand all Loading... |
25 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 25 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" | 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" |
27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" | 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" |
29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" |
31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
32 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web
Task.h" | 32 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web
Task.h" |
33 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web
TestProxy.h" | 33 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web
TestProxy.h" |
34 #include "webkit/glue/webkit_glue.h" | 34 #include "webkit/glue/webkit_glue.h" |
| 35 #include "webkit/glue/webpreferences.h" |
35 | 36 |
36 using WebKit::WebContextMenuData; | 37 using WebKit::WebContextMenuData; |
37 using WebKit::WebElement; | 38 using WebKit::WebElement; |
38 using WebKit::WebFrame; | 39 using WebKit::WebFrame; |
39 using WebKit::WebGamepads; | 40 using WebKit::WebGamepads; |
40 using WebKit::WebRect; | 41 using WebKit::WebRect; |
41 using WebKit::WebSize; | 42 using WebKit::WebSize; |
42 using WebKit::WebString; | 43 using WebKit::WebString; |
43 using WebKit::WebVector; | 44 using WebKit::WebVector; |
44 using WebKit::WebView; | 45 using WebKit::WebView; |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 // Public methods - ----------------------------------------------------------- | 266 // Public methods - ----------------------------------------------------------- |
266 | 267 |
267 void WebKitTestRunner::Display() { | 268 void WebKitTestRunner::Display() { |
268 const WebSize& size = render_view()->GetWebView()->size(); | 269 const WebSize& size = render_view()->GetWebView()->size(); |
269 WebRect rect(0, 0, size.width, size.height); | 270 WebRect rect(0, 0, size.width, size.height); |
270 proxy_->setPaintRect(rect); | 271 proxy_->setPaintRect(rect); |
271 PaintInvalidatedRegion(); | 272 PaintInvalidatedRegion(); |
272 DisplayRepaintMask(); | 273 DisplayRepaintMask(); |
273 } | 274 } |
274 | 275 |
| 276 void WebKitTestRunner::SetXSSAuditorEnabled(bool enabled) { |
| 277 prefs_.xss_auditor_enabled = enabled; |
| 278 webkit_glue::WebPreferences prefs = render_view()->GetWebkitPreferences(); |
| 279 prefs_.Apply(&prefs); |
| 280 render_view()->SetWebkitPreferences(prefs); |
| 281 Send(new ShellViewHostMsg_OverridePreferences(routing_id(), prefs_)); |
| 282 } |
| 283 |
| 284 void WebKitTestRunner::Reset() { |
| 285 prefs_ = ShellWebPreferences(); |
| 286 webkit_glue::WebPreferences prefs = render_view()->GetWebkitPreferences(); |
| 287 prefs_.Apply(&prefs); |
| 288 render_view()->SetWebkitPreferences(prefs); |
| 289 } |
| 290 |
275 // Private methods ----------------------------------------------------------- | 291 // Private methods ----------------------------------------------------------- |
276 | 292 |
277 void WebKitTestRunner::OnCaptureTextDump(bool as_text, | 293 void WebKitTestRunner::OnCaptureTextDump(bool as_text, |
278 bool printing, | 294 bool printing, |
279 bool recursive) { | 295 bool recursive) { |
280 WebFrame* frame = render_view()->GetWebView()->mainFrame(); | 296 WebFrame* frame = render_view()->GetWebView()->mainFrame(); |
281 std::string dump; | 297 std::string dump; |
282 if (as_text) { | 298 if (as_text) { |
283 dump = DumpFramesAsText(frame, printing, recursive); | 299 dump = DumpFramesAsText(frame, printing, recursive); |
284 } else { | 300 } else { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 PaintRect(rect); | 408 PaintRect(rect); |
393 } | 409 } |
394 CHECK(proxy_->paintRect().isEmpty()); | 410 CHECK(proxy_->paintRect().isEmpty()); |
395 } | 411 } |
396 | 412 |
397 void WebKitTestRunner::DisplayRepaintMask() { | 413 void WebKitTestRunner::DisplayRepaintMask() { |
398 GetCanvas()->drawARGB(167, 0, 0, 0); | 414 GetCanvas()->drawARGB(167, 0, 0, 0); |
399 } | 415 } |
400 | 416 |
401 } // namespace content | 417 } // namespace content |
OLD | NEW |