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

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

Issue 11316244: [content shell] add support for a testRunner.setXSSAuditorEnabled (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 14 matching lines...) Expand all
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
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 webkit_glue::WebPreferences prefs = render_view()->GetWebkitPreferences();
278 prefs.xss_auditor_enabled = enabled;
279 render_view()->OverrideWebkitPreferences(prefs);
280 }
281
282 void WebKitTestRunner::Reset() {
283 webkit_glue::WebPreferences prefs = render_view()->GetWebkitPreferences();
284 prefs.xss_auditor_enabled = true;
285 render_view()->OverrideWebkitPreferences(prefs);
286 }
287
275 // Private methods ----------------------------------------------------------- 288 // Private methods -----------------------------------------------------------
276 289
277 void WebKitTestRunner::OnCaptureTextDump(bool as_text, 290 void WebKitTestRunner::OnCaptureTextDump(bool as_text,
278 bool printing, 291 bool printing,
279 bool recursive) { 292 bool recursive) {
280 WebFrame* frame = render_view()->GetWebView()->mainFrame(); 293 WebFrame* frame = render_view()->GetWebView()->mainFrame();
281 std::string dump; 294 std::string dump;
282 if (as_text) { 295 if (as_text) {
283 dump = DumpFramesAsText(frame, printing, recursive); 296 dump = DumpFramesAsText(frame, printing, recursive);
284 } else { 297 } else {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 PaintRect(rect); 405 PaintRect(rect);
393 } 406 }
394 CHECK(proxy_->paintRect().isEmpty()); 407 CHECK(proxy_->paintRect().isEmpty());
395 } 408 }
396 409
397 void WebKitTestRunner::DisplayRepaintMask() { 410 void WebKitTestRunner::DisplayRepaintMask() {
398 GetCanvas()->drawARGB(167, 0, 0, 0); 411 GetCanvas()->drawARGB(167, 0, 0, 0);
399 } 412 }
400 413
401 } // namespace content 414 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698