| 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/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 Loading... |
| 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/WebTestProxy.h" | |
| 37 #include "content/shell/renderer/test_runner/WebTestRunner.h" | 36 #include "content/shell/renderer/test_runner/WebTestRunner.h" |
| 37 #include "content/shell/renderer/test_runner/web_test_proxy.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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 | 605 |
| 606 void WebKitTestRunner::DidFailProvisionalLoad(WebLocalFrame* frame, | 606 void WebKitTestRunner::DidFailProvisionalLoad(WebLocalFrame* frame, |
| 607 const WebURLError& error) { | 607 const WebURLError& error) { |
| 608 focus_on_next_commit_ = false; | 608 focus_on_next_commit_ = false; |
| 609 } | 609 } |
| 610 | 610 |
| 611 // Public methods - ----------------------------------------------------------- | 611 // Public methods - ----------------------------------------------------------- |
| 612 | 612 |
| 613 void WebKitTestRunner::Reset() { | 613 void WebKitTestRunner::Reset() { |
| 614 // The proxy_ is always non-NULL, it is set right after construction. | 614 // The proxy_ is always non-NULL, it is set right after construction. |
| 615 proxy_->setWidget(render_view()->GetWebView()); | 615 proxy_->set_widget(render_view()->GetWebView()); |
| 616 proxy_->reset(); | 616 proxy_->Reset(); |
| 617 prefs_.Reset(); | 617 prefs_.Reset(); |
| 618 routing_ids_.clear(); | 618 routing_ids_.clear(); |
| 619 session_histories_.clear(); | 619 session_histories_.clear(); |
| 620 current_entry_indexes_.clear(); | 620 current_entry_indexes_.clear(); |
| 621 | 621 |
| 622 render_view()->ClearEditCommands(); | 622 render_view()->ClearEditCommands(); |
| 623 render_view()->GetWebView()->mainFrame()->setName(WebString()); | 623 render_view()->GetWebView()->mainFrame()->setName(WebString()); |
| 624 render_view()->GetWebView()->mainFrame()->clearOpener(); | 624 render_view()->GetWebView()->mainFrame()->clearOpener(); |
| 625 render_view()->GetWebView()->setPageScaleFactorLimits(-1, -1); | 625 render_view()->GetWebView()->setPageScaleFactorLimits(-1, -1); |
| 626 render_view()->GetWebView()->setPageScaleFactor(1, WebPoint(0, 0)); | 626 render_view()->GetWebView()->setPageScaleFactor(1, WebPoint(0, 0)); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 638 WebTestInterfaces* interfaces = | 638 WebTestInterfaces* interfaces = |
| 639 ShellRenderProcessObserver::GetInstance()->test_interfaces(); | 639 ShellRenderProcessObserver::GetInstance()->test_interfaces(); |
| 640 TRACE_EVENT0("shell", "WebKitTestRunner::CaptureDump"); | 640 TRACE_EVENT0("shell", "WebKitTestRunner::CaptureDump"); |
| 641 | 641 |
| 642 if (interfaces->testRunner()->shouldDumpAsAudio()) { | 642 if (interfaces->testRunner()->shouldDumpAsAudio()) { |
| 643 std::vector<unsigned char> vector_data; | 643 std::vector<unsigned char> vector_data; |
| 644 interfaces->testRunner()->getAudioData(&vector_data); | 644 interfaces->testRunner()->getAudioData(&vector_data); |
| 645 Send(new ShellViewHostMsg_AudioDump(routing_id(), vector_data)); | 645 Send(new ShellViewHostMsg_AudioDump(routing_id(), vector_data)); |
| 646 } else { | 646 } else { |
| 647 Send(new ShellViewHostMsg_TextDump(routing_id(), | 647 Send(new ShellViewHostMsg_TextDump(routing_id(), |
| 648 proxy()->captureTree(false))); | 648 proxy()->CaptureTree(false))); |
| 649 | 649 |
| 650 if (test_config_.enable_pixel_dumping && | 650 if (test_config_.enable_pixel_dumping && |
| 651 interfaces->testRunner()->shouldGeneratePixelResults()) { | 651 interfaces->testRunner()->shouldGeneratePixelResults()) { |
| 652 // TODO(danakj): Remove when kForceCompositingMode is everywhere. | 652 // TODO(danakj): Remove when kForceCompositingMode is everywhere. |
| 653 if (!render_view()->GetWebView()->isAcceleratedCompositingActive()) { | 653 if (!render_view()->GetWebView()->isAcceleratedCompositingActive()) { |
| 654 SkBitmap snapshot; | 654 SkBitmap snapshot; |
| 655 CopyCanvasToBitmap(proxy()->capturePixels(), &snapshot); | 655 CopyCanvasToBitmap(proxy()->CapturePixels(), &snapshot); |
| 656 CaptureDumpPixels(snapshot); | 656 CaptureDumpPixels(snapshot); |
| 657 } else { | 657 } else { |
| 658 proxy()->CapturePixelsAsync(base::Bind( | 658 proxy()->CapturePixelsAsync(base::Bind( |
| 659 &WebKitTestRunner::CaptureDumpPixels, base::Unretained(this))); | 659 &WebKitTestRunner::CaptureDumpPixels, base::Unretained(this))); |
| 660 } | 660 } |
| 661 return; | 661 return; |
| 662 } | 662 } |
| 663 } | 663 } |
| 664 | 664 |
| 665 CaptureDumpComplete(); | 665 CaptureDumpComplete(); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 | 746 |
| 747 leak_detector_->TryLeakDetection(main_frame); | 747 leak_detector_->TryLeakDetection(main_frame); |
| 748 } | 748 } |
| 749 | 749 |
| 750 void WebKitTestRunner::ReportLeakDetectionResult( | 750 void WebKitTestRunner::ReportLeakDetectionResult( |
| 751 const LeakDetectionResult& report) { | 751 const LeakDetectionResult& report) { |
| 752 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); | 752 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); |
| 753 } | 753 } |
| 754 | 754 |
| 755 } // namespace content | 755 } // namespace content |
| OLD | NEW |