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

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

Issue 1962393002: Destroy WebWidgetTestClient when its WebWidget is destroyed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
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_proxy.h"
10 #include "components/test_runner/web_test_runner.h" 11 #include "components/test_runner/web_test_runner.h"
11 #include "content/public/renderer/render_frame.h" 12 #include "content/public/renderer/render_frame.h"
13 #include "content/public/test/layouttest_support.h"
12 #include "content/shell/common/shell_messages.h" 14 #include "content/shell/common/shell_messages.h"
13 #include "content/shell/renderer/layout_test/blink_test_runner.h" 15 #include "content/shell/renderer/layout_test/blink_test_runner.h"
14 #include "content/shell/renderer/layout_test/layout_test_render_thread_observer. h" 16 #include "content/shell/renderer/layout_test/layout_test_render_thread_observer. h"
15 #include "ipc/ipc_message_macros.h" 17 #include "ipc/ipc_message_macros.h"
16 #include "third_party/WebKit/public/web/WebLocalFrame.h" 18 #include "third_party/WebKit/public/web/WebLocalFrame.h"
17 19
18 namespace content { 20 namespace content {
19 21
20 LayoutTestRenderFrameObserver::LayoutTestRenderFrameObserver( 22 LayoutTestRenderFrameObserver::LayoutTestRenderFrameObserver(
21 RenderFrame* render_frame) 23 RenderFrame* render_frame)
(...skipping 15 matching lines...) Expand all
37 IPC_MESSAGE_HANDLER(ShellViewMsg_SetTestConfiguration, 39 IPC_MESSAGE_HANDLER(ShellViewMsg_SetTestConfiguration,
38 OnSetTestConfiguration) 40 OnSetTestConfiguration)
39 IPC_MESSAGE_HANDLER(ShellViewMsg_SetupSecondaryRenderer, 41 IPC_MESSAGE_HANDLER(ShellViewMsg_SetupSecondaryRenderer,
40 OnSetupSecondaryRenderer) 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
49 void LayoutTestRenderFrameObserver::FrameDetached() {
50 if (render_frame()->IsMainFrame()) {
51 test_runner::WebTestProxyBase* proxy =
52 GetWebTestProxyBase(render_frame()->GetRenderView());
53 proxy->set_web_widget(nullptr);
54 proxy->set_widget_test_client(nullptr);
55 }
56 }
57
47 void LayoutTestRenderFrameObserver::OnLayoutDumpRequest() { 58 void LayoutTestRenderFrameObserver::OnLayoutDumpRequest() {
48 std::string dump = 59 std::string dump =
49 LayoutTestRenderThreadObserver::GetInstance() 60 LayoutTestRenderThreadObserver::GetInstance()
50 ->test_interfaces() 61 ->test_interfaces()
51 ->TestRunner() 62 ->TestRunner()
52 ->DumpLayout(render_frame()->GetWebFrame()); 63 ->DumpLayout(render_frame()->GetWebFrame());
53 Send(new ShellViewHostMsg_LayoutDumpResponse(routing_id(), dump)); 64 Send(new ShellViewHostMsg_LayoutDumpResponse(routing_id(), dump));
54 } 65 }
55 66
56 void LayoutTestRenderFrameObserver::OnReplicateTestConfiguration( 67 void LayoutTestRenderFrameObserver::OnReplicateTestConfiguration(
57 const ShellTestConfiguration& test_config) { 68 const ShellTestConfiguration& test_config) {
58 BlinkTestRunner::Get(render_frame()->GetRenderView()) 69 BlinkTestRunner::Get(render_frame()->GetRenderView())
59 ->OnReplicateTestConfiguration(test_config); 70 ->OnReplicateTestConfiguration(test_config);
60 } 71 }
61 72
62 void LayoutTestRenderFrameObserver::OnSetTestConfiguration( 73 void LayoutTestRenderFrameObserver::OnSetTestConfiguration(
63 const ShellTestConfiguration& test_config) { 74 const ShellTestConfiguration& test_config) {
64 BlinkTestRunner::Get(render_frame()->GetRenderView()) 75 BlinkTestRunner::Get(render_frame()->GetRenderView())
65 ->OnSetTestConfiguration(test_config); 76 ->OnSetTestConfiguration(test_config);
66 } 77 }
67 78
68 void LayoutTestRenderFrameObserver::OnSetupSecondaryRenderer() { 79 void LayoutTestRenderFrameObserver::OnSetupSecondaryRenderer() {
69 BlinkTestRunner::Get(render_frame()->GetRenderView()) 80 BlinkTestRunner::Get(render_frame()->GetRenderView())
70 ->OnSetupSecondaryRenderer(); 81 ->OnSetupSecondaryRenderer();
71 } 82 }
72 83
73 } // namespace content 84 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698