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

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

Issue 297273003: test_runner: Migrate WebTestRunner to our Chromium C++ style. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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/renderer/test_runner/web_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/renderer/webkit_test_runner.h" 5 #include "content/shell/renderer/webkit_test_runner.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <clocale> 8 #include <clocale>
9 #include <cmath> 9 #include <cmath>
10 10
(...skipping 15 matching lines...) Expand all
26 #include "content/public/renderer/render_view_visitor.h" 26 #include "content/public/renderer/render_view_visitor.h"
27 #include "content/public/test/layouttest_support.h" 27 #include "content/public/test/layouttest_support.h"
28 #include "content/shell/common/shell_messages.h" 28 #include "content/shell/common/shell_messages.h"
29 #include "content/shell/common/shell_switches.h" 29 #include "content/shell/common/shell_switches.h"
30 #include "content/shell/common/webkit_test_helpers.h" 30 #include "content/shell/common/webkit_test_helpers.h"
31 #include "content/shell/renderer/gc_controller.h" 31 #include "content/shell/renderer/gc_controller.h"
32 #include "content/shell/renderer/leak_detector.h" 32 #include "content/shell/renderer/leak_detector.h"
33 #include "content/shell/renderer/shell_render_process_observer.h" 33 #include "content/shell/renderer/shell_render_process_observer.h"
34 #include "content/shell/renderer/test_runner/WebTask.h" 34 #include "content/shell/renderer/test_runner/WebTask.h"
35 #include "content/shell/renderer/test_runner/WebTestInterfaces.h" 35 #include "content/shell/renderer/test_runner/WebTestInterfaces.h"
36 #include "content/shell/renderer/test_runner/WebTestRunner.h"
37 #include "content/shell/renderer/test_runner/web_test_proxy.h" 36 #include "content/shell/renderer/test_runner/web_test_proxy.h"
37 #include "content/shell/renderer/test_runner/web_test_runner.h"
38 #include "net/base/filename_util.h" 38 #include "net/base/filename_util.h"
39 #include "net/base/net_errors.h" 39 #include "net/base/net_errors.h"
40 #include "skia/ext/platform_canvas.h" 40 #include "skia/ext/platform_canvas.h"
41 #include "third_party/WebKit/public/platform/Platform.h" 41 #include "third_party/WebKit/public/platform/Platform.h"
42 #include "third_party/WebKit/public/platform/WebCString.h" 42 #include "third_party/WebKit/public/platform/WebCString.h"
43 #include "third_party/WebKit/public/platform/WebPoint.h" 43 #include "third_party/WebKit/public/platform/WebPoint.h"
44 #include "third_party/WebKit/public/platform/WebRect.h" 44 #include "third_party/WebKit/public/platform/WebRect.h"
45 #include "third_party/WebKit/public/platform/WebSize.h" 45 #include "third_party/WebKit/public/platform/WebSize.h"
46 #include "third_party/WebKit/public/platform/WebString.h" 46 #include "third_party/WebKit/public/platform/WebString.h"
47 #include "third_party/WebKit/public/platform/WebURL.h" 47 #include "third_party/WebKit/public/platform/WebURL.h"
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 } 469 }
470 470
471 void WebKitTestRunner::testFinished() { 471 void WebKitTestRunner::testFinished() {
472 if (!is_main_window_) { 472 if (!is_main_window_) {
473 Send(new ShellViewHostMsg_TestFinishedInSecondaryWindow(routing_id())); 473 Send(new ShellViewHostMsg_TestFinishedInSecondaryWindow(routing_id()));
474 return; 474 return;
475 } 475 }
476 WebTestInterfaces* interfaces = 476 WebTestInterfaces* interfaces =
477 ShellRenderProcessObserver::GetInstance()->test_interfaces(); 477 ShellRenderProcessObserver::GetInstance()->test_interfaces();
478 interfaces->setTestIsRunning(false); 478 interfaces->setTestIsRunning(false);
479 if (interfaces->testRunner()->shouldDumpBackForwardList()) { 479 if (interfaces->testRunner()->ShouldDumpBackForwardList()) {
480 SyncNavigationStateVisitor visitor; 480 SyncNavigationStateVisitor visitor;
481 RenderView::ForEach(&visitor); 481 RenderView::ForEach(&visitor);
482 Send(new ShellViewHostMsg_CaptureSessionHistory(routing_id())); 482 Send(new ShellViewHostMsg_CaptureSessionHistory(routing_id()));
483 } else { 483 } else {
484 CaptureDump(); 484 CaptureDump();
485 } 485 }
486 } 486 }
487 487
488 void WebKitTestRunner::closeRemainingWindows() { 488 void WebKitTestRunner::closeRemainingWindows() {
489 NavigateAwayVisitor visitor(render_view()); 489 NavigateAwayVisitor visitor(render_view());
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 render_view()->SetWebkitPreferences(render_view()->GetWebkitPreferences()); 610 render_view()->SetWebkitPreferences(render_view()->GetWebkitPreferences());
611 } 611 }
612 612
613 // Private methods ----------------------------------------------------------- 613 // Private methods -----------------------------------------------------------
614 614
615 void WebKitTestRunner::CaptureDump() { 615 void WebKitTestRunner::CaptureDump() {
616 WebTestInterfaces* interfaces = 616 WebTestInterfaces* interfaces =
617 ShellRenderProcessObserver::GetInstance()->test_interfaces(); 617 ShellRenderProcessObserver::GetInstance()->test_interfaces();
618 TRACE_EVENT0("shell", "WebKitTestRunner::CaptureDump"); 618 TRACE_EVENT0("shell", "WebKitTestRunner::CaptureDump");
619 619
620 if (interfaces->testRunner()->shouldDumpAsAudio()) { 620 if (interfaces->testRunner()->ShouldDumpAsAudio()) {
621 std::vector<unsigned char> vector_data; 621 std::vector<unsigned char> vector_data;
622 interfaces->testRunner()->getAudioData(&vector_data); 622 interfaces->testRunner()->GetAudioData(&vector_data);
623 Send(new ShellViewHostMsg_AudioDump(routing_id(), vector_data)); 623 Send(new ShellViewHostMsg_AudioDump(routing_id(), vector_data));
624 } else { 624 } else {
625 Send(new ShellViewHostMsg_TextDump(routing_id(), 625 Send(new ShellViewHostMsg_TextDump(routing_id(),
626 proxy()->CaptureTree(false))); 626 proxy()->CaptureTree(false)));
627 627
628 if (test_config_.enable_pixel_dumping && 628 if (test_config_.enable_pixel_dumping &&
629 interfaces->testRunner()->shouldGeneratePixelResults()) { 629 interfaces->testRunner()->ShouldGeneratePixelResults()) {
630 CHECK(render_view()->GetWebView()->isAcceleratedCompositingActive()); 630 CHECK(render_view()->GetWebView()->isAcceleratedCompositingActive());
631 proxy()->CapturePixelsAsync(base::Bind( 631 proxy()->CapturePixelsAsync(base::Bind(
632 &WebKitTestRunner::CaptureDumpPixels, base::Unretained(this))); 632 &WebKitTestRunner::CaptureDumpPixels, base::Unretained(this)));
633 return; 633 return;
634 } 634 }
635 } 635 }
636 636
637 CaptureDumpComplete(); 637 CaptureDumpComplete();
638 } 638 }
639 639
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 718
719 leak_detector_->TryLeakDetection(main_frame); 719 leak_detector_->TryLeakDetection(main_frame);
720 } 720 }
721 721
722 void WebKitTestRunner::ReportLeakDetectionResult( 722 void WebKitTestRunner::ReportLeakDetectionResult(
723 const LeakDetectionResult& report) { 723 const LeakDetectionResult& report) {
724 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); 724 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report));
725 } 725 }
726 726
727 } // namespace content 727 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/renderer/test_runner/web_test_runner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698