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 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 current_entry_indexes_ = current_entry_indexes; | 694 current_entry_indexes_ = current_entry_indexes; |
695 CaptureDump(); | 695 CaptureDump(); |
696 } | 696 } |
697 | 697 |
698 void WebKitTestRunner::OnReset() { | 698 void WebKitTestRunner::OnReset() { |
699 ShellRenderProcessObserver::GetInstance()->test_interfaces()->resetAll(); | 699 ShellRenderProcessObserver::GetInstance()->test_interfaces()->resetAll(); |
700 Reset(); | 700 Reset(); |
701 // Navigating to about:blank will make sure that no new loads are initiated | 701 // Navigating to about:blank will make sure that no new loads are initiated |
702 // by the renderer. | 702 // by the renderer. |
703 render_view()->GetWebView()->mainFrame()->loadRequest( | 703 render_view()->GetWebView()->mainFrame()->loadRequest( |
704 WebURLRequest(GURL(kAboutBlankURL))); | 704 WebURLRequest(GURL(url::kAboutBlankURL))); |
705 Send(new ShellViewHostMsg_ResetDone(routing_id())); | 705 Send(new ShellViewHostMsg_ResetDone(routing_id())); |
706 } | 706 } |
707 | 707 |
708 void WebKitTestRunner::OnNotifyDone() { | 708 void WebKitTestRunner::OnNotifyDone() { |
709 render_view()->GetWebView()->mainFrame()->executeScript( | 709 render_view()->GetWebView()->mainFrame()->executeScript( |
710 WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();"))); | 710 WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();"))); |
711 } | 711 } |
712 | 712 |
713 void WebKitTestRunner::OnTryLeakDetection() { | 713 void WebKitTestRunner::OnTryLeakDetection() { |
714 WebLocalFrame* main_frame = | 714 WebLocalFrame* main_frame = |
715 render_view()->GetWebView()->mainFrame()->toWebLocalFrame(); | 715 render_view()->GetWebView()->mainFrame()->toWebLocalFrame(); |
716 DCHECK_EQ(GURL(kAboutBlankURL), GURL(main_frame->document().url())); | 716 DCHECK_EQ(GURL(url::kAboutBlankURL), GURL(main_frame->document().url())); |
717 DCHECK(!main_frame->isLoading()); | 717 DCHECK(!main_frame->isLoading()); |
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 |
OLD | NEW |