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/layout_test/blink_test_runner.h" | 5 #include "content/shell/renderer/layout_test/blink_test_runner.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <clocale> | 10 #include <clocale> |
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1025 Reset(true /* for_new_test */); | 1025 Reset(true /* for_new_test */); |
1026 // Navigating to about:blank will make sure that no new loads are initiated | 1026 // Navigating to about:blank will make sure that no new loads are initiated |
1027 // by the renderer. | 1027 // by the renderer. |
1028 WebURLRequest request = WebURLRequest(GURL(url::kAboutBlankURL)); | 1028 WebURLRequest request = WebURLRequest(GURL(url::kAboutBlankURL)); |
1029 render_view()->GetWebView()->MainFrame()->LoadRequest(request); | 1029 render_view()->GetWebView()->MainFrame()->LoadRequest(request); |
1030 Send(new ShellViewHostMsg_ResetDone(routing_id())); | 1030 Send(new ShellViewHostMsg_ResetDone(routing_id())); |
1031 } | 1031 } |
1032 | 1032 |
1033 void BlinkTestRunner::OnTestFinishedInSecondaryRenderer() { | 1033 void BlinkTestRunner::OnTestFinishedInSecondaryRenderer() { |
1034 DCHECK(is_main_window_ && render_view()->GetMainRenderFrame()); | 1034 DCHECK(is_main_window_ && render_view()->GetMainRenderFrame()); |
| 1035 |
| 1036 // Avoid a situation where TestFinished is called twice, because |
| 1037 // of a racey test finish in 2 secondary renderers. |
| 1038 test_runner::WebTestInterfaces* interfaces = |
| 1039 LayoutTestRenderThreadObserver::GetInstance()->test_interfaces(); |
| 1040 if (!interfaces->TestIsRunning()) |
| 1041 return; |
| 1042 |
1035 TestFinished(); | 1043 TestFinished(); |
1036 } | 1044 } |
1037 | 1045 |
1038 void BlinkTestRunner::OnTryLeakDetection() { | 1046 void BlinkTestRunner::OnTryLeakDetection() { |
1039 blink::WebFrame* main_frame = render_view()->GetWebView()->MainFrame(); | 1047 blink::WebFrame* main_frame = render_view()->GetWebView()->MainFrame(); |
1040 DCHECK_EQ(GURL(url::kAboutBlankURL), GURL(main_frame->GetDocument().Url())); | 1048 DCHECK_EQ(GURL(url::kAboutBlankURL), GURL(main_frame->GetDocument().Url())); |
1041 DCHECK(!main_frame->IsLoading()); | 1049 DCHECK(!main_frame->IsLoading()); |
1042 | 1050 |
1043 leak_detector_->TryLeakDetection(main_frame); | 1051 leak_detector_->TryLeakDetection(main_frame); |
1044 } | 1052 } |
(...skipping 10 matching lines...) Expand all Loading... |
1055 void BlinkTestRunner::ReportLeakDetectionResult( | 1063 void BlinkTestRunner::ReportLeakDetectionResult( |
1056 const LeakDetectionResult& report) { | 1064 const LeakDetectionResult& report) { |
1057 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); | 1065 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); |
1058 } | 1066 } |
1059 | 1067 |
1060 void BlinkTestRunner::OnDestruct() { | 1068 void BlinkTestRunner::OnDestruct() { |
1061 delete this; | 1069 delete this; |
1062 } | 1070 } |
1063 | 1071 |
1064 } // namespace content | 1072 } // namespace content |
OLD | NEW |