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 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 // layout flag changes in ShellViewMsg_ReplicateTestConfiguration. | 527 // layout flag changes in ShellViewMsg_ReplicateTestConfiguration. |
528 if (!is_main_window_) | 528 if (!is_main_window_) |
529 return; | 529 return; |
530 | 530 |
531 RenderThread::Get()->Send( | 531 RenderThread::Get()->Send( |
532 new LayoutTestHostMsg_LayoutTestRuntimeFlagsChanged(changed_values)); | 532 new LayoutTestHostMsg_LayoutTestRuntimeFlagsChanged(changed_values)); |
533 } | 533 } |
534 | 534 |
535 void BlinkTestRunner::TestFinished() { | 535 void BlinkTestRunner::TestFinished() { |
536 if (!is_main_window_ || !render_view()->GetMainRenderFrame()) { | 536 if (!is_main_window_ || !render_view()->GetMainRenderFrame()) { |
537 Send(new ShellViewHostMsg_TestFinishedInSecondaryRenderer(routing_id())); | 537 RenderThread::Get()->Send( |
| 538 new LayoutTestHostMsg_TestFinishedInSecondaryRenderer()); |
538 return; | 539 return; |
539 } | 540 } |
540 test_runner::WebTestInterfaces* interfaces = | 541 test_runner::WebTestInterfaces* interfaces = |
541 LayoutTestRenderThreadObserver::GetInstance()->test_interfaces(); | 542 LayoutTestRenderThreadObserver::GetInstance()->test_interfaces(); |
542 interfaces->SetTestIsRunning(false); | 543 interfaces->SetTestIsRunning(false); |
543 if (interfaces->TestRunner()->ShouldDumpBackForwardList()) { | 544 if (interfaces->TestRunner()->ShouldDumpBackForwardList()) { |
544 SyncNavigationStateVisitor visitor; | 545 SyncNavigationStateVisitor visitor; |
545 RenderView::ForEach(&visitor); | 546 RenderView::ForEach(&visitor); |
546 Send(new ShellViewHostMsg_CaptureSessionHistory(routing_id())); | 547 Send(new ShellViewHostMsg_CaptureSessionHistory(routing_id())); |
547 } else { | 548 } else { |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 | 710 |
710 void BlinkTestRunner::DidClearWindowObject(WebLocalFrame* frame) { | 711 void BlinkTestRunner::DidClearWindowObject(WebLocalFrame* frame) { |
711 WebTestingSupport::injectInternalsObject(frame); | 712 WebTestingSupport::injectInternalsObject(frame); |
712 } | 713 } |
713 | 714 |
714 bool BlinkTestRunner::OnMessageReceived(const IPC::Message& message) { | 715 bool BlinkTestRunner::OnMessageReceived(const IPC::Message& message) { |
715 bool handled = true; | 716 bool handled = true; |
716 IPC_BEGIN_MESSAGE_MAP(BlinkTestRunner, message) | 717 IPC_BEGIN_MESSAGE_MAP(BlinkTestRunner, message) |
717 IPC_MESSAGE_HANDLER(ShellViewMsg_SessionHistory, OnSessionHistory) | 718 IPC_MESSAGE_HANDLER(ShellViewMsg_SessionHistory, OnSessionHistory) |
718 IPC_MESSAGE_HANDLER(ShellViewMsg_Reset, OnReset) | 719 IPC_MESSAGE_HANDLER(ShellViewMsg_Reset, OnReset) |
719 IPC_MESSAGE_HANDLER(ShellViewMsg_NotifyDone, OnNotifyDone) | 720 IPC_MESSAGE_HANDLER(ShellViewMsg_TestFinishedInSecondaryRenderer, |
| 721 OnTestFinishedInSecondaryRenderer) |
720 IPC_MESSAGE_HANDLER(ShellViewMsg_TryLeakDetection, OnTryLeakDetection) | 722 IPC_MESSAGE_HANDLER(ShellViewMsg_TryLeakDetection, OnTryLeakDetection) |
721 IPC_MESSAGE_HANDLER(ShellViewMsg_ReplyBluetoothManualChooserEvents, | 723 IPC_MESSAGE_HANDLER(ShellViewMsg_ReplyBluetoothManualChooserEvents, |
722 OnReplyBluetoothManualChooserEvents) | 724 OnReplyBluetoothManualChooserEvents) |
723 IPC_MESSAGE_HANDLER(ShellViewMsg_LayoutDumpCompleted, OnLayoutDumpCompleted) | 725 IPC_MESSAGE_HANDLER(ShellViewMsg_LayoutDumpCompleted, OnLayoutDumpCompleted) |
724 IPC_MESSAGE_UNHANDLED(handled = false) | 726 IPC_MESSAGE_UNHANDLED(handled = false) |
725 IPC_END_MESSAGE_MAP() | 727 IPC_END_MESSAGE_MAP() |
726 | 728 |
727 return handled; | 729 return handled; |
728 } | 730 } |
729 | 731 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 void BlinkTestRunner::OnReset() { | 933 void BlinkTestRunner::OnReset() { |
932 LayoutTestRenderThreadObserver::GetInstance()->test_interfaces()->ResetAll(); | 934 LayoutTestRenderThreadObserver::GetInstance()->test_interfaces()->ResetAll(); |
933 Reset(true /* for_new_test */); | 935 Reset(true /* for_new_test */); |
934 // Navigating to about:blank will make sure that no new loads are initiated | 936 // Navigating to about:blank will make sure that no new loads are initiated |
935 // by the renderer. | 937 // by the renderer. |
936 render_view()->GetWebView()->mainFrame()->loadRequest( | 938 render_view()->GetWebView()->mainFrame()->loadRequest( |
937 WebURLRequest(GURL(url::kAboutBlankURL))); | 939 WebURLRequest(GURL(url::kAboutBlankURL))); |
938 Send(new ShellViewHostMsg_ResetDone(routing_id())); | 940 Send(new ShellViewHostMsg_ResetDone(routing_id())); |
939 } | 941 } |
940 | 942 |
941 void BlinkTestRunner::OnNotifyDone() { | 943 void BlinkTestRunner::OnTestFinishedInSecondaryRenderer() { |
942 render_view()->GetWebView()->mainFrame()->executeScript( | 944 DCHECK(is_main_window_ && render_view()->GetMainRenderFrame()); |
943 WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();"))); | 945 TestFinished(); |
944 } | 946 } |
945 | 947 |
946 void BlinkTestRunner::OnTryLeakDetection() { | 948 void BlinkTestRunner::OnTryLeakDetection() { |
947 blink::WebFrame* main_frame = | 949 blink::WebFrame* main_frame = |
948 render_view()->GetWebView()->mainFrame(); | 950 render_view()->GetWebView()->mainFrame(); |
949 DCHECK_EQ(GURL(url::kAboutBlankURL), GURL(main_frame->document().url())); | 951 DCHECK_EQ(GURL(url::kAboutBlankURL), GURL(main_frame->document().url())); |
950 DCHECK(!main_frame->isLoading()); | 952 DCHECK(!main_frame->isLoading()); |
951 | 953 |
952 leak_detector_->TryLeakDetection(main_frame); | 954 leak_detector_->TryLeakDetection(main_frame); |
953 } | 955 } |
954 | 956 |
955 void BlinkTestRunner::OnReplyBluetoothManualChooserEvents( | 957 void BlinkTestRunner::OnReplyBluetoothManualChooserEvents( |
956 const std::vector<std::string>& events) { | 958 const std::vector<std::string>& events) { |
957 DCHECK(!get_bluetooth_events_callbacks_.empty()); | 959 DCHECK(!get_bluetooth_events_callbacks_.empty()); |
958 base::Callback<void(const std::vector<std::string>&)> callback = | 960 base::Callback<void(const std::vector<std::string>&)> callback = |
959 get_bluetooth_events_callbacks_.front(); | 961 get_bluetooth_events_callbacks_.front(); |
960 get_bluetooth_events_callbacks_.pop_front(); | 962 get_bluetooth_events_callbacks_.pop_front(); |
961 callback.Run(events); | 963 callback.Run(events); |
962 } | 964 } |
963 | 965 |
964 void BlinkTestRunner::ReportLeakDetectionResult( | 966 void BlinkTestRunner::ReportLeakDetectionResult( |
965 const LeakDetectionResult& report) { | 967 const LeakDetectionResult& report) { |
966 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); | 968 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); |
967 } | 969 } |
968 | 970 |
969 } // namespace content | 971 } // namespace content |
OLD | NEW |