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 #include <algorithm> | 8 #include <algorithm> |
9 #include <clocale> | 9 #include <clocale> |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "base/thread_task_runner_handle.h" | 27 #include "base/thread_task_runner_handle.h" |
28 #include "base/time/time.h" | 28 #include "base/time/time.h" |
29 #include "base/values.h" | 29 #include "base/values.h" |
30 #include "build/build_config.h" | 30 #include "build/build_config.h" |
31 #include "components/plugins/renderer/plugin_placeholder.h" | 31 #include "components/plugins/renderer/plugin_placeholder.h" |
32 #include "components/test_runner/gamepad_controller.h" | 32 #include "components/test_runner/gamepad_controller.h" |
33 #include "components/test_runner/web_test_interfaces.h" | 33 #include "components/test_runner/web_test_interfaces.h" |
34 #include "components/test_runner/web_test_proxy.h" | 34 #include "components/test_runner/web_test_proxy.h" |
35 #include "components/test_runner/web_test_runner.h" | 35 #include "components/test_runner/web_test_runner.h" |
36 #include "content/public/common/content_switches.h" | 36 #include "content/public/common/content_switches.h" |
37 #include "content/public/common/service_registry.h" | |
38 #include "content/public/common/url_constants.h" | 37 #include "content/public/common/url_constants.h" |
39 #include "content/public/common/web_preferences.h" | 38 #include "content/public/common/web_preferences.h" |
40 #include "content/public/renderer/media_stream_utils.h" | 39 #include "content/public/renderer/media_stream_utils.h" |
41 #include "content/public/renderer/render_frame.h" | 40 #include "content/public/renderer/render_frame.h" |
42 #include "content/public/renderer/render_thread.h" | |
43 #include "content/public/renderer/render_view.h" | 41 #include "content/public/renderer/render_view.h" |
44 #include "content/public/renderer/render_view_visitor.h" | 42 #include "content/public/renderer/render_view_visitor.h" |
45 #include "content/public/renderer/renderer_gamepad_provider.h" | 43 #include "content/public/renderer/renderer_gamepad_provider.h" |
46 #include "content/public/test/layouttest_support.h" | 44 #include "content/public/test/layouttest_support.h" |
47 #include "content/shell/common/layout_test/layout_test_messages.h" | 45 #include "content/shell/common/layout_test/layout_test_messages.h" |
48 #include "content/shell/common/shell_messages.h" | 46 #include "content/shell/common/shell_messages.h" |
49 #include "content/shell/common/shell_switches.h" | 47 #include "content/shell/common/shell_switches.h" |
50 #include "content/shell/renderer/layout_test/blink_test_helpers.h" | 48 #include "content/shell/renderer/layout_test/blink_test_helpers.h" |
51 #include "content/shell/renderer/layout_test/layout_test_render_process_observer
.h" | 49 #include "content/shell/renderer/layout_test/layout_test_render_process_observer
.h" |
52 #include "content/shell/renderer/layout_test/leak_detector.h" | 50 #include "content/shell/renderer/layout_test/leak_detector.h" |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 local_frame = RenderFrame::FromWebFrame(frame); | 588 local_frame = RenderFrame::FromWebFrame(frame); |
591 break; | 589 break; |
592 } | 590 } |
593 } | 591 } |
594 DCHECK(local_frame); | 592 DCHECK(local_frame); |
595 Send(new ShellViewHostMsg_LayoutTestRuntimeFlagsChanged( | 593 Send(new ShellViewHostMsg_LayoutTestRuntimeFlagsChanged( |
596 local_frame->GetRoutingID(), changed_values)); | 594 local_frame->GetRoutingID(), changed_values)); |
597 } | 595 } |
598 | 596 |
599 void BlinkTestRunner::TestFinished() { | 597 void BlinkTestRunner::TestFinished() { |
600 // In layout tests, mock Mojo service factories implemented in JS may be | |
601 // installed on the per-frame and the per-process service registries. With | |
602 // the test finished, clear any overrides so they don't interfere with any | |
603 // later tests and so they aren't detected as leaks. | |
604 RenderThread::Get()->GetServiceRegistry()->ClearServiceOverridesForTesting(); | |
605 render_view() | |
606 ->GetMainRenderFrame() | |
607 ->GetServiceRegistry() | |
608 ->ClearServiceOverridesForTesting(); | |
609 | |
610 if (!is_main_window_ || !render_view()->GetMainRenderFrame()) { | 598 if (!is_main_window_ || !render_view()->GetMainRenderFrame()) { |
611 Send(new ShellViewHostMsg_TestFinishedInSecondaryRenderer(routing_id())); | 599 Send(new ShellViewHostMsg_TestFinishedInSecondaryRenderer(routing_id())); |
612 return; | 600 return; |
613 } | 601 } |
614 test_runner::WebTestInterfaces* interfaces = | 602 test_runner::WebTestInterfaces* interfaces = |
615 LayoutTestRenderProcessObserver::GetInstance()->test_interfaces(); | 603 LayoutTestRenderProcessObserver::GetInstance()->test_interfaces(); |
616 interfaces->SetTestIsRunning(false); | 604 interfaces->SetTestIsRunning(false); |
617 if (interfaces->TestRunner()->ShouldDumpBackForwardList()) { | 605 if (interfaces->TestRunner()->ShouldDumpBackForwardList()) { |
618 SyncNavigationStateVisitor visitor; | 606 SyncNavigationStateVisitor visitor; |
619 RenderView::ForEach(&visitor); | 607 RenderView::ForEach(&visitor); |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1021 get_bluetooth_events_callbacks_.pop_front(); | 1009 get_bluetooth_events_callbacks_.pop_front(); |
1022 callback.Run(events); | 1010 callback.Run(events); |
1023 } | 1011 } |
1024 | 1012 |
1025 void BlinkTestRunner::ReportLeakDetectionResult( | 1013 void BlinkTestRunner::ReportLeakDetectionResult( |
1026 const LeakDetectionResult& report) { | 1014 const LeakDetectionResult& report) { |
1027 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); | 1015 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); |
1028 } | 1016 } |
1029 | 1017 |
1030 } // namespace content | 1018 } // namespace content |
OLD | NEW |