Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: content/shell/renderer/layout_test/layout_test_render_frame_observer.cc

Issue 2670573002: Revert of Replace IPC messages in layout_test_render_frame_observer. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/shell/renderer/layout_test/layout_test_render_frame_observer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "content/public/common/associated_interface_registry.h"
12 #include "content/public/renderer/render_frame.h" 11 #include "content/public/renderer/render_frame.h"
13 #include "content/shell/common/shell_messages.h" 12 #include "content/shell/common/shell_messages.h"
14 #include "content/shell/renderer/layout_test/blink_test_runner.h" 13 #include "content/shell/renderer/layout_test/blink_test_runner.h"
15 #include "content/shell/renderer/layout_test/layout_test_render_thread_observer. h" 14 #include "content/shell/renderer/layout_test/layout_test_render_thread_observer. h"
16 #include "ipc/ipc_message_macros.h" 15 #include "ipc/ipc_message_macros.h"
17 #include "third_party/WebKit/public/web/WebLocalFrame.h" 16 #include "third_party/WebKit/public/web/WebLocalFrame.h"
18 17
19 namespace content { 18 namespace content {
20 19
21 LayoutTestRenderFrameObserver::LayoutTestRenderFrameObserver( 20 LayoutTestRenderFrameObserver::LayoutTestRenderFrameObserver(
22 RenderFrame* render_frame) 21 RenderFrame* render_frame)
23 : RenderFrameObserver(render_frame), binding_(this) { 22 : RenderFrameObserver(render_frame) {
24 render_frame->GetWebFrame()->setContentSettingsClient( 23 render_frame->GetWebFrame()->setContentSettingsClient(
25 LayoutTestRenderThreadObserver::GetInstance() 24 LayoutTestRenderThreadObserver::GetInstance()
26 ->test_interfaces() 25 ->test_interfaces()
27 ->TestRunner() 26 ->TestRunner()
28 ->GetWebContentSettings()); 27 ->GetWebContentSettings());
29 render_frame->GetAssociatedInterfaceRegistry()->AddInterface(base::Bind(
30 &LayoutTestRenderFrameObserver::BindRequest, base::Unretained(this)));
31 } 28 }
32 29
33 LayoutTestRenderFrameObserver::~LayoutTestRenderFrameObserver() = default; 30 bool LayoutTestRenderFrameObserver::OnMessageReceived(
31 const IPC::Message& message) {
32 bool handled = true;
33 IPC_BEGIN_MESSAGE_MAP(LayoutTestRenderFrameObserver, message)
34 IPC_MESSAGE_HANDLER(ShellViewMsg_LayoutDumpRequest, OnLayoutDumpRequest)
35 IPC_MESSAGE_HANDLER(ShellViewMsg_ReplicateTestConfiguration,
36 OnReplicateTestConfiguration)
37 IPC_MESSAGE_HANDLER(ShellViewMsg_SetTestConfiguration,
38 OnSetTestConfiguration)
39 IPC_MESSAGE_HANDLER(ShellViewMsg_SetupSecondaryRenderer,
40 OnSetupSecondaryRenderer)
41 IPC_MESSAGE_UNHANDLED(handled = false)
42 IPC_END_MESSAGE_MAP()
34 43
35 void LayoutTestRenderFrameObserver::BindRequest( 44 return handled;
36 mojom::LayoutTestControlAssociatedRequest request) {
37 binding_.Bind(std::move(request));
38 } 45 }
39 46
40 void LayoutTestRenderFrameObserver::OnDestruct() { 47 void LayoutTestRenderFrameObserver::OnDestruct() {
41 delete this; 48 delete this;
42 } 49 }
43 50
44 void LayoutTestRenderFrameObserver::LayoutDumpRequest() { 51 void LayoutTestRenderFrameObserver::OnLayoutDumpRequest() {
45 std::string dump = 52 std::string dump =
46 LayoutTestRenderThreadObserver::GetInstance() 53 LayoutTestRenderThreadObserver::GetInstance()
47 ->test_interfaces() 54 ->test_interfaces()
48 ->TestRunner() 55 ->TestRunner()
49 ->DumpLayout(render_frame()->GetWebFrame()); 56 ->DumpLayout(render_frame()->GetWebFrame());
50 Send(new ShellViewHostMsg_LayoutDumpResponse(routing_id(), dump)); 57 Send(new ShellViewHostMsg_LayoutDumpResponse(routing_id(), dump));
51 } 58 }
52 59
53 void LayoutTestRenderFrameObserver::ReplicateTestConfiguration( 60 void LayoutTestRenderFrameObserver::OnReplicateTestConfiguration(
54 mojom::ShellTestConfigurationPtr config) { 61 const ShellTestConfiguration& test_config) {
55 BlinkTestRunner::Get(render_frame()->GetRenderView()) 62 BlinkTestRunner::Get(render_frame()->GetRenderView())
56 ->OnReplicateTestConfiguration(std::move(config)); 63 ->OnReplicateTestConfiguration(test_config);
57 } 64 }
58 65
59 void LayoutTestRenderFrameObserver::SetTestConfiguration( 66 void LayoutTestRenderFrameObserver::OnSetTestConfiguration(
60 mojom::ShellTestConfigurationPtr config) { 67 const ShellTestConfiguration& test_config) {
61 BlinkTestRunner::Get(render_frame()->GetRenderView()) 68 BlinkTestRunner::Get(render_frame()->GetRenderView())
62 ->OnSetTestConfiguration(std::move(config)); 69 ->OnSetTestConfiguration(test_config);
63 } 70 }
64 71
65 void LayoutTestRenderFrameObserver::SetupSecondaryRenderer() { 72 void LayoutTestRenderFrameObserver::OnSetupSecondaryRenderer() {
66 BlinkTestRunner::Get(render_frame()->GetRenderView()) 73 BlinkTestRunner::Get(render_frame()->GetRenderView())
67 ->OnSetupSecondaryRenderer(); 74 ->OnSetupSecondaryRenderer();
68 } 75 }
69 76
70 } // namespace content 77 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/renderer/layout_test/layout_test_render_frame_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698