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

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

Issue 11830020: [content shell] when the test contains the path loading/ enable frame load callback dumping (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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
« no previous file with comments | « content/shell/webkit_test_runner.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/base64.h" 9 #include "base/base64.h"
10 #include "base/md5.h" 10 #include "base/md5.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 #if !defined(OS_MACOSX) 147 #if !defined(OS_MACOSX)
148 // Only the expected PNGs for Mac have a valid alpha channel. 148 // Only the expected PNGs for Mac have a valid alpha channel.
149 MakeBitmapOpaque(snapshot); 149 MakeBitmapOpaque(snapshot);
150 #endif 150 #endif
151 151
152 } 152 }
153 153
154 } // namespace 154 } // namespace
155 155
156 WebKitTestRunner::WebKitTestRunner(RenderView* render_view) 156 WebKitTestRunner::WebKitTestRunner(RenderView* render_view)
157 : RenderViewObserver(render_view), 157 : RenderViewObserver(render_view) {
158 dump_editing_callbacks_(false), 158 Reset();
159 dump_frame_load_callbacks_(false),
160 dump_user_gesture_in_frame_load_callbacks_(false),
161 stop_provisional_frame_loads_(false),
162 dump_title_changes_(false),
163 test_is_running_(true),
164 wait_until_done_(false) {
165 } 159 }
166 160
167 WebKitTestRunner::~WebKitTestRunner() { 161 WebKitTestRunner::~WebKitTestRunner() {
168 } 162 }
169 163
170 // WebTestDelegate ----------------------------------------------------------- 164 // WebTestDelegate -----------------------------------------------------------
171 165
172 void WebKitTestRunner::clearContextMenuData() { 166 void WebKitTestRunner::clearContextMenuData() {
173 last_context_menu_data_.reset(); 167 last_context_menu_data_.reset();
174 } 168 }
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 // RenderViewObserver -------------------------------------------------------- 316 // RenderViewObserver --------------------------------------------------------
323 317
324 void WebKitTestRunner::DidClearWindowObject(WebFrame* frame) { 318 void WebKitTestRunner::DidClearWindowObject(WebFrame* frame) {
325 ShellRenderProcessObserver::GetInstance()->BindTestRunnersToWindow(frame); 319 ShellRenderProcessObserver::GetInstance()->BindTestRunnersToWindow(frame);
326 } 320 }
327 321
328 void WebKitTestRunner::DidFinishLoad(WebFrame* frame) { 322 void WebKitTestRunner::DidFinishLoad(WebFrame* frame) {
329 if (!frame->parent()) { 323 if (!frame->parent()) {
330 if (!wait_until_done_) 324 if (!wait_until_done_)
331 test_is_running_ = false; 325 test_is_running_ = false;
326 load_finished_ = true;
332 Send(new ShellViewHostMsg_DidFinishLoad(routing_id())); 327 Send(new ShellViewHostMsg_DidFinishLoad(routing_id()));
333 } 328 }
334 } 329 }
335 330
336 void WebKitTestRunner::DidRequestShowContextMenu( 331 void WebKitTestRunner::DidRequestShowContextMenu(
337 WebFrame* frame, 332 WebFrame* frame,
338 const WebContextMenuData& data) { 333 const WebContextMenuData& data) {
339 last_context_menu_data_.reset(new WebContextMenuData(data)); 334 last_context_menu_data_.reset(new WebContextMenuData(data));
340 } 335 }
341 336
(...skipping 19 matching lines...) Expand all
361 PaintInvalidatedRegion(); 356 PaintInvalidatedRegion();
362 DisplayRepaintMask(); 357 DisplayRepaintMask();
363 } 358 }
364 359
365 void WebKitTestRunner::SetXSSAuditorEnabled(bool enabled) { 360 void WebKitTestRunner::SetXSSAuditorEnabled(bool enabled) {
366 prefs_.XSSAuditorEnabled = enabled; 361 prefs_.XSSAuditorEnabled = enabled;
367 applyPreferences(); 362 applyPreferences();
368 } 363 }
369 364
370 void WebKitTestRunner::NotifyDone() { 365 void WebKitTestRunner::NotifyDone() {
371 test_is_running_ = false; 366 if (load_finished_)
367 test_is_running_ = false;
368 else
369 wait_until_done_ = false;
372 Send(new ShellViewHostMsg_NotifyDone(routing_id())); 370 Send(new ShellViewHostMsg_NotifyDone(routing_id()));
373 } 371 }
374 372
375 void WebKitTestRunner::DumpAsText() { 373 void WebKitTestRunner::DumpAsText() {
376 Send(new ShellViewHostMsg_DumpAsText(routing_id())); 374 Send(new ShellViewHostMsg_DumpAsText(routing_id()));
377 } 375 }
378 376
379 void WebKitTestRunner::DumpChildFramesAsText() { 377 void WebKitTestRunner::DumpChildFramesAsText() {
380 Send(new ShellViewHostMsg_DumpChildFramesAsText(routing_id())); 378 Send(new ShellViewHostMsg_DumpChildFramesAsText(routing_id()));
381 } 379 }
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 prefs_.reset(); 501 prefs_.reset();
504 webkit_glue::WebPreferences prefs = render_view()->GetWebkitPreferences(); 502 webkit_glue::WebPreferences prefs = render_view()->GetWebkitPreferences();
505 ExportLayoutTestSpecificPreferences(prefs_, &prefs); 503 ExportLayoutTestSpecificPreferences(prefs_, &prefs);
506 render_view()->SetWebkitPreferences(prefs); 504 render_view()->SetWebkitPreferences(prefs);
507 dump_editing_callbacks_ = false; 505 dump_editing_callbacks_ = false;
508 dump_frame_load_callbacks_ = false; 506 dump_frame_load_callbacks_ = false;
509 dump_user_gesture_in_frame_load_callbacks_ = false; 507 dump_user_gesture_in_frame_load_callbacks_ = false;
510 stop_provisional_frame_loads_ = false; 508 stop_provisional_frame_loads_ = false;
511 dump_title_changes_ = false; 509 dump_title_changes_ = false;
512 test_is_running_ = true; 510 test_is_running_ = true;
511 load_finished_ = false;
513 wait_until_done_ = false; 512 wait_until_done_ = false;
514 } 513 }
515 514
516 // Private methods ----------------------------------------------------------- 515 // Private methods -----------------------------------------------------------
517 516
518 void WebKitTestRunner::OnCaptureTextDump(bool as_text, 517 void WebKitTestRunner::OnCaptureTextDump(bool as_text,
519 bool printing, 518 bool printing,
520 bool recursive) { 519 bool recursive) {
521 WebFrame* frame = render_view()->GetWebView()->mainFrame(); 520 WebFrame* frame = render_view()->GetWebView()->mainFrame();
522 std::string dump; 521 std::string dump;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 routing_id(), actual_pixel_hash, empty_image)); 564 routing_id(), actual_pixel_hash, empty_image));
566 return; 565 return;
567 } 566 }
568 Send(new ShellViewHostMsg_ImageDump( 567 Send(new ShellViewHostMsg_ImageDump(
569 routing_id(), actual_pixel_hash, snapshot)); 568 routing_id(), actual_pixel_hash, snapshot));
570 } 569 }
571 570
572 void WebKitTestRunner::OnSetCurrentWorkingDirectory( 571 void WebKitTestRunner::OnSetCurrentWorkingDirectory(
573 const FilePath& current_working_directory) { 572 const FilePath& current_working_directory) {
574 current_working_directory_ = current_working_directory; 573 current_working_directory_ = current_working_directory;
574 std::vector<FilePath::StringType> components;
575 current_working_directory_.GetComponents(&components);
576 for (unsigned i = 0; i < components.size(); ++i) {
577 if (components[i] == FILE_PATH_LITERAL("loading"))
578 dump_frame_load_callbacks_ = true;
579 }
575 } 580 }
576 581
577 SkCanvas* WebKitTestRunner::GetCanvas() { 582 SkCanvas* WebKitTestRunner::GetCanvas() {
578 WebView* view = render_view()->GetWebView(); 583 WebView* view = render_view()->GetWebView();
579 const WebSize& size = view->size(); 584 const WebSize& size = view->size();
580 float device_scale_factor = view->deviceScaleFactor(); 585 float device_scale_factor = view->deviceScaleFactor();
581 int width = std::ceil(device_scale_factor * size.width); 586 int width = std::ceil(device_scale_factor * size.width);
582 int height = std::ceil(device_scale_factor * size.height); 587 int height = std::ceil(device_scale_factor * size.height);
583 588
584 if (canvas_ && 589 if (canvas_ &&
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 PaintRect(rect); 638 PaintRect(rect);
634 } 639 }
635 CHECK(proxy_->paintRect().isEmpty()); 640 CHECK(proxy_->paintRect().isEmpty());
636 } 641 }
637 642
638 void WebKitTestRunner::DisplayRepaintMask() { 643 void WebKitTestRunner::DisplayRepaintMask() {
639 GetCanvas()->drawARGB(167, 0, 0, 0); 644 GetCanvas()->drawARGB(167, 0, 0, 0);
640 } 645 }
641 646
642 } // namespace content 647 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/webkit_test_runner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698