OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/browser/layout_test/secondary_test_window_observer.h" | 5 #include "content/shell/browser/layout_test/secondary_test_window_observer.h" |
6 | 6 |
7 #include "content/shell/browser/layout_test/blink_test_controller.h" | 7 #include "content/shell/browser/layout_test/blink_test_controller.h" |
8 #include "content/shell/common/shell_messages.h" | 8 #include "content/shell/common/shell_messages.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 | 11 |
12 DEFINE_WEB_CONTENTS_USER_DATA_KEY(SecondaryTestWindowObserver); | 12 DEFINE_WEB_CONTENTS_USER_DATA_KEY(SecondaryTestWindowObserver); |
13 | 13 |
14 SecondaryTestWindowObserver::SecondaryTestWindowObserver( | 14 SecondaryTestWindowObserver::SecondaryTestWindowObserver( |
15 WebContents* web_contents) | 15 WebContents* web_contents) |
16 : WebContentsObserver(web_contents) {} | 16 : WebContentsObserver(web_contents) {} |
17 | 17 |
18 SecondaryTestWindowObserver::~SecondaryTestWindowObserver() {} | 18 SecondaryTestWindowObserver::~SecondaryTestWindowObserver() {} |
19 | 19 |
20 bool SecondaryTestWindowObserver::OnMessageReceived( | |
21 const IPC::Message& message) { | |
22 bool handled = true; | |
23 IPC_BEGIN_MESSAGE_MAP(SecondaryTestWindowObserver, message) | |
24 IPC_MESSAGE_HANDLER(ShellViewHostMsg_TestFinishedInSecondaryRenderer, | |
25 OnTestFinishedInSecondaryRenderer) | |
26 IPC_MESSAGE_UNHANDLED(handled = false) | |
27 IPC_END_MESSAGE_MAP() | |
28 return handled; | |
29 } | |
30 | |
31 void SecondaryTestWindowObserver::OnTestFinishedInSecondaryRenderer() { | |
32 BlinkTestController::Get()->OnTestFinishedInSecondaryRenderer(); | |
33 } | |
34 | |
35 void SecondaryTestWindowObserver::RenderFrameCreated( | 20 void SecondaryTestWindowObserver::RenderFrameCreated( |
36 RenderFrameHost* render_frame_host) { | 21 RenderFrameHost* render_frame_host) { |
37 DCHECK(!BlinkTestController::Get()->IsMainWindow( | 22 DCHECK(!BlinkTestController::Get()->IsMainWindow( |
38 WebContents::FromRenderFrameHost(render_frame_host))); | 23 WebContents::FromRenderFrameHost(render_frame_host))); |
39 BlinkTestController::Get()->HandleNewRenderFrameHost(render_frame_host); | 24 BlinkTestController::Get()->HandleNewRenderFrameHost(render_frame_host); |
40 } | 25 } |
41 | 26 |
42 void SecondaryTestWindowObserver::RenderFrameHostChanged( | 27 void SecondaryTestWindowObserver::RenderFrameHostChanged( |
43 RenderFrameHost* old_host, | 28 RenderFrameHost* old_host, |
44 RenderFrameHost* new_host) { | 29 RenderFrameHost* new_host) { |
45 DCHECK(!BlinkTestController::Get()->IsMainWindow( | 30 DCHECK(!BlinkTestController::Get()->IsMainWindow( |
46 WebContents::FromRenderFrameHost(new_host))); | 31 WebContents::FromRenderFrameHost(new_host))); |
47 BlinkTestController::Get()->HandleNewRenderFrameHost(new_host); | 32 BlinkTestController::Get()->HandleNewRenderFrameHost(new_host); |
48 } | 33 } |
49 | 34 |
50 } // namespace content | 35 } // namespace content |
OLD | NEW |