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/layout_dump.h" | |
10 #include "components/test_runner/layout_dump_flags.h" | |
11 #include "components/test_runner/web_test_interfaces.h" | 9 #include "components/test_runner/web_test_interfaces.h" |
12 #include "components/test_runner/web_test_runner.h" | 10 #include "components/test_runner/web_test_runner.h" |
13 #include "content/public/renderer/render_frame.h" | 11 #include "content/public/renderer/render_frame.h" |
14 #include "content/shell/common/shell_messages.h" | 12 #include "content/shell/common/shell_messages.h" |
15 #include "content/shell/renderer/layout_test/blink_test_runner.h" | 13 #include "content/shell/renderer/layout_test/blink_test_runner.h" |
16 #include "content/shell/renderer/layout_test/layout_test_render_process_observer
.h" | 14 #include "content/shell/renderer/layout_test/layout_test_render_process_observer
.h" |
17 #include "ipc/ipc_message_macros.h" | 15 #include "ipc/ipc_message_macros.h" |
18 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 16 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
19 | 17 |
20 namespace content { | 18 namespace content { |
(...skipping 19 matching lines...) Expand all Loading... |
40 OnReplicateTestConfiguration) | 38 OnReplicateTestConfiguration) |
41 IPC_MESSAGE_HANDLER(ShellViewMsg_SetTestConfiguration, | 39 IPC_MESSAGE_HANDLER(ShellViewMsg_SetTestConfiguration, |
42 OnSetTestConfiguration) | 40 OnSetTestConfiguration) |
43 IPC_MESSAGE_UNHANDLED(handled = false) | 41 IPC_MESSAGE_UNHANDLED(handled = false) |
44 IPC_END_MESSAGE_MAP() | 42 IPC_END_MESSAGE_MAP() |
45 | 43 |
46 return handled; | 44 return handled; |
47 } | 45 } |
48 | 46 |
49 void LayoutTestRenderFrameObserver::OnLayoutDumpRequest() { | 47 void LayoutTestRenderFrameObserver::OnLayoutDumpRequest() { |
50 const test_runner::LayoutDumpFlags& layout_dump_flags = | 48 std::string dump = |
51 LayoutTestRenderProcessObserver::GetInstance() | 49 LayoutTestRenderProcessObserver::GetInstance() |
52 ->test_interfaces() | 50 ->test_interfaces() |
53 ->TestRunner() | 51 ->TestRunner() |
54 ->GetLayoutDumpFlags(); | 52 ->DumpLayout(render_frame()->GetWebFrame()); |
55 std::string dump = | |
56 test_runner::DumpLayout(render_frame()->GetWebFrame(), layout_dump_flags); | |
57 Send(new ShellViewHostMsg_LayoutDumpResponse(routing_id(), dump)); | 53 Send(new ShellViewHostMsg_LayoutDumpResponse(routing_id(), dump)); |
58 } | 54 } |
59 | 55 |
60 void LayoutTestRenderFrameObserver::OnReplicateLayoutDumpFlagsChanges( | 56 void LayoutTestRenderFrameObserver::OnReplicateLayoutDumpFlagsChanges( |
61 const base::DictionaryValue& changed_layout_dump_flags) { | 57 const base::DictionaryValue& changed_layout_dump_flags) { |
62 LayoutTestRenderProcessObserver::GetInstance() | 58 LayoutTestRenderProcessObserver::GetInstance() |
63 ->test_interfaces() | 59 ->test_interfaces() |
64 ->TestRunner() | 60 ->TestRunner() |
65 ->ReplicateLayoutDumpFlagsChanges(changed_layout_dump_flags); | 61 ->ReplicateLayoutDumpFlagsChanges(changed_layout_dump_flags); |
66 } | 62 } |
67 | 63 |
68 void LayoutTestRenderFrameObserver::OnReplicateTestConfiguration( | 64 void LayoutTestRenderFrameObserver::OnReplicateTestConfiguration( |
69 const ShellTestConfiguration& test_config, | 65 const ShellTestConfiguration& test_config, |
70 const base::DictionaryValue& accumulated_layout_dump_flags_changes) { | 66 const base::DictionaryValue& accumulated_layout_dump_flags_changes) { |
71 LayoutTestRenderProcessObserver::GetInstance() | 67 LayoutTestRenderProcessObserver::GetInstance() |
72 ->main_test_runner() | 68 ->main_test_runner() |
73 ->OnReplicateTestConfiguration(test_config); | 69 ->OnReplicateTestConfiguration(test_config); |
74 | 70 |
75 OnReplicateLayoutDumpFlagsChanges(accumulated_layout_dump_flags_changes); | 71 OnReplicateLayoutDumpFlagsChanges(accumulated_layout_dump_flags_changes); |
76 } | 72 } |
77 | 73 |
78 void LayoutTestRenderFrameObserver::OnSetTestConfiguration( | 74 void LayoutTestRenderFrameObserver::OnSetTestConfiguration( |
79 const ShellTestConfiguration& test_config) { | 75 const ShellTestConfiguration& test_config) { |
80 LayoutTestRenderProcessObserver::GetInstance() | 76 LayoutTestRenderProcessObserver::GetInstance() |
81 ->main_test_runner() | 77 ->main_test_runner() |
82 ->OnSetTestConfiguration(test_config); | 78 ->OnSetTestConfiguration(test_config); |
83 } | 79 } |
84 | 80 |
85 } // namespace content | 81 } // namespace content |
OLD | NEW |