| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 class NavigateAwayVisitor : public RenderViewVisitor { | 144 class NavigateAwayVisitor : public RenderViewVisitor { |
| 145 public: | 145 public: |
| 146 explicit NavigateAwayVisitor(RenderView* main_render_view) | 146 explicit NavigateAwayVisitor(RenderView* main_render_view) |
| 147 : main_render_view_(main_render_view) {} | 147 : main_render_view_(main_render_view) {} |
| 148 virtual ~NavigateAwayVisitor() {} | 148 virtual ~NavigateAwayVisitor() {} |
| 149 | 149 |
| 150 virtual bool Visit(RenderView* render_view) OVERRIDE { | 150 virtual bool Visit(RenderView* render_view) OVERRIDE { |
| 151 if (render_view == main_render_view_) | 151 if (render_view == main_render_view_) |
| 152 return true; | 152 return true; |
| 153 render_view->GetWebView()->mainFrame()->loadRequest( | 153 render_view->GetWebView()->mainFrame()->loadRequest( |
| 154 WebURLRequest(GURL(kAboutBlankURL))); | 154 WebURLRequest(GURL(url::kAboutBlankURL))); |
| 155 return true; | 155 return true; |
| 156 } | 156 } |
| 157 | 157 |
| 158 private: | 158 private: |
| 159 RenderView* main_render_view_; | 159 RenderView* main_render_view_; |
| 160 | 160 |
| 161 DISALLOW_COPY_AND_ASSIGN(NavigateAwayVisitor); | 161 DISALLOW_COPY_AND_ASSIGN(NavigateAwayVisitor); |
| 162 }; | 162 }; |
| 163 | 163 |
| 164 class UseSynchronousResizeModeVisitor : public RenderViewVisitor { | 164 class UseSynchronousResizeModeVisitor : public RenderViewVisitor { |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 current_entry_indexes_ = current_entry_indexes; | 699 current_entry_indexes_ = current_entry_indexes; |
| 700 CaptureDump(); | 700 CaptureDump(); |
| 701 } | 701 } |
| 702 | 702 |
| 703 void WebKitTestRunner::OnReset() { | 703 void WebKitTestRunner::OnReset() { |
| 704 ShellRenderProcessObserver::GetInstance()->test_interfaces()->resetAll(); | 704 ShellRenderProcessObserver::GetInstance()->test_interfaces()->resetAll(); |
| 705 Reset(); | 705 Reset(); |
| 706 // Navigating to about:blank will make sure that no new loads are initiated | 706 // Navigating to about:blank will make sure that no new loads are initiated |
| 707 // by the renderer. | 707 // by the renderer. |
| 708 render_view()->GetWebView()->mainFrame()->loadRequest( | 708 render_view()->GetWebView()->mainFrame()->loadRequest( |
| 709 WebURLRequest(GURL(kAboutBlankURL))); | 709 WebURLRequest(GURL(url::kAboutBlankURL))); |
| 710 Send(new ShellViewHostMsg_ResetDone(routing_id())); | 710 Send(new ShellViewHostMsg_ResetDone(routing_id())); |
| 711 } | 711 } |
| 712 | 712 |
| 713 void WebKitTestRunner::OnNotifyDone() { | 713 void WebKitTestRunner::OnNotifyDone() { |
| 714 render_view()->GetWebView()->mainFrame()->executeScript( | 714 render_view()->GetWebView()->mainFrame()->executeScript( |
| 715 WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();"))); | 715 WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();"))); |
| 716 } | 716 } |
| 717 | 717 |
| 718 void WebKitTestRunner::OnTryLeakDetection() { | 718 void WebKitTestRunner::OnTryLeakDetection() { |
| 719 WebLocalFrame* main_frame = | 719 WebLocalFrame* main_frame = |
| 720 render_view()->GetWebView()->mainFrame()->toWebLocalFrame(); | 720 render_view()->GetWebView()->mainFrame()->toWebLocalFrame(); |
| 721 DCHECK_EQ(GURL(kAboutBlankURL), GURL(main_frame->document().url())); | 721 DCHECK_EQ(GURL(url::kAboutBlankURL), GURL(main_frame->document().url())); |
| 722 DCHECK(!main_frame->isLoading()); | 722 DCHECK(!main_frame->isLoading()); |
| 723 | 723 |
| 724 leak_detector_->TryLeakDetection(main_frame); | 724 leak_detector_->TryLeakDetection(main_frame); |
| 725 } | 725 } |
| 726 | 726 |
| 727 void WebKitTestRunner::ReportLeakDetectionResult( | 727 void WebKitTestRunner::ReportLeakDetectionResult( |
| 728 const LeakDetectionResult& report) { | 728 const LeakDetectionResult& report) { |
| 729 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); | 729 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); |
| 730 } | 730 } |
| 731 | 731 |
| 732 } // namespace content | 732 } // namespace content |
| OLD | NEW |