| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/layout_test_render_frame_observer.h
" | 5 #include "content/shell/renderer/layout_test/layout_test_render_frame_observer.h
" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "components/test_runner/web_test_interfaces.h" | 9 #include "components/test_runner/web_test_interfaces.h" |
| 10 #include "components/test_runner/web_test_runner.h" | 10 #include "components/test_runner/web_test_runner.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 const IPC::Message& message) { | 31 const IPC::Message& message) { |
| 32 bool handled = true; | 32 bool handled = true; |
| 33 IPC_BEGIN_MESSAGE_MAP(LayoutTestRenderFrameObserver, message) | 33 IPC_BEGIN_MESSAGE_MAP(LayoutTestRenderFrameObserver, message) |
| 34 IPC_MESSAGE_HANDLER(ShellViewMsg_LayoutDumpRequest, OnLayoutDumpRequest) | 34 IPC_MESSAGE_HANDLER(ShellViewMsg_LayoutDumpRequest, OnLayoutDumpRequest) |
| 35 IPC_MESSAGE_HANDLER(ShellViewMsg_ReplicateLayoutTestRuntimeFlagsChanges, | 35 IPC_MESSAGE_HANDLER(ShellViewMsg_ReplicateLayoutTestRuntimeFlagsChanges, |
| 36 OnReplicateLayoutTestRuntimeFlagsChanges) | 36 OnReplicateLayoutTestRuntimeFlagsChanges) |
| 37 IPC_MESSAGE_HANDLER(ShellViewMsg_ReplicateTestConfiguration, | 37 IPC_MESSAGE_HANDLER(ShellViewMsg_ReplicateTestConfiguration, |
| 38 OnReplicateTestConfiguration) | 38 OnReplicateTestConfiguration) |
| 39 IPC_MESSAGE_HANDLER(ShellViewMsg_SetTestConfiguration, | 39 IPC_MESSAGE_HANDLER(ShellViewMsg_SetTestConfiguration, |
| 40 OnSetTestConfiguration) | 40 OnSetTestConfiguration) |
| 41 IPC_MESSAGE_HANDLER(ShellViewMsg_SetupSecondaryRenderer, |
| 42 OnSetupSecondaryRenderer) |
| 41 IPC_MESSAGE_UNHANDLED(handled = false) | 43 IPC_MESSAGE_UNHANDLED(handled = false) |
| 42 IPC_END_MESSAGE_MAP() | 44 IPC_END_MESSAGE_MAP() |
| 43 | 45 |
| 44 return handled; | 46 return handled; |
| 45 } | 47 } |
| 46 | 48 |
| 47 void LayoutTestRenderFrameObserver::OnLayoutDumpRequest() { | 49 void LayoutTestRenderFrameObserver::OnLayoutDumpRequest() { |
| 48 std::string dump = | 50 std::string dump = |
| 49 LayoutTestRenderProcessObserver::GetInstance() | 51 LayoutTestRenderProcessObserver::GetInstance() |
| 50 ->test_interfaces() | 52 ->test_interfaces() |
| 51 ->TestRunner() | 53 ->TestRunner() |
| 52 ->DumpLayout(render_frame()->GetWebFrame()); | 54 ->DumpLayout(render_frame()->GetWebFrame()); |
| 53 Send(new ShellViewHostMsg_LayoutDumpResponse(routing_id(), dump)); | 55 Send(new ShellViewHostMsg_LayoutDumpResponse(routing_id(), dump)); |
| 54 } | 56 } |
| 55 | 57 |
| 56 void LayoutTestRenderFrameObserver::OnReplicateLayoutTestRuntimeFlagsChanges( | 58 void LayoutTestRenderFrameObserver::OnReplicateLayoutTestRuntimeFlagsChanges( |
| 57 const base::DictionaryValue& changed_layout_test_runtime_flags) { | 59 const base::DictionaryValue& changed_layout_test_runtime_flags) { |
| 58 LayoutTestRenderProcessObserver::GetInstance() | 60 LayoutTestRenderProcessObserver::GetInstance() |
| 59 ->test_interfaces() | 61 ->test_interfaces() |
| 60 ->TestRunner() | 62 ->TestRunner() |
| 61 ->ReplicateLayoutTestRuntimeFlagsChanges( | 63 ->ReplicateLayoutTestRuntimeFlagsChanges( |
| 62 changed_layout_test_runtime_flags); | 64 changed_layout_test_runtime_flags); |
| 63 } | 65 } |
| 64 | 66 |
| 65 void LayoutTestRenderFrameObserver::OnReplicateTestConfiguration( | 67 void LayoutTestRenderFrameObserver::OnReplicateTestConfiguration( |
| 66 const ShellTestConfiguration& test_config, | 68 const ShellTestConfiguration& test_config, |
| 67 const base::DictionaryValue& | 69 const base::DictionaryValue& |
| 68 accumulated_layout_test_runtime_flags_changes) { | 70 accumulated_layout_test_runtime_flags_changes) { |
| 69 LayoutTestRenderProcessObserver::GetInstance() | 71 BlinkTestRunner::Get(render_frame()->GetRenderView()) |
| 70 ->main_test_runner() | |
| 71 ->OnReplicateTestConfiguration(test_config); | 72 ->OnReplicateTestConfiguration(test_config); |
| 72 | 73 |
| 73 OnReplicateLayoutTestRuntimeFlagsChanges( | 74 OnReplicateLayoutTestRuntimeFlagsChanges( |
| 74 accumulated_layout_test_runtime_flags_changes); | 75 accumulated_layout_test_runtime_flags_changes); |
| 75 } | 76 } |
| 76 | 77 |
| 77 void LayoutTestRenderFrameObserver::OnSetTestConfiguration( | 78 void LayoutTestRenderFrameObserver::OnSetTestConfiguration( |
| 78 const ShellTestConfiguration& test_config) { | 79 const ShellTestConfiguration& test_config) { |
| 79 LayoutTestRenderProcessObserver::GetInstance() | 80 BlinkTestRunner::Get(render_frame()->GetRenderView()) |
| 80 ->main_test_runner() | |
| 81 ->OnSetTestConfiguration(test_config); | 81 ->OnSetTestConfiguration(test_config); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void LayoutTestRenderFrameObserver::OnSetupSecondaryRenderer() { |
| 85 BlinkTestRunner::Get(render_frame()->GetRenderView()) |
| 86 ->OnSetupSecondaryRenderer(); |
| 87 } |
| 88 |
| 84 } // namespace content | 89 } // namespace content |
| OLD | NEW |