diff options
author | lukasza <lukasza@chromium.org> | 2016-02-05 11:41:24 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-05 19:42:40 +0000 |
commit | 8119b2606e86a6b3460f608ab7120454724d173c (patch) | |
tree | 10429bf8263c9229fba845dcd68c413146cd05be /content/shell/browser | |
parent | de630dc27c81ce65beb21d4a1a974dab6cdb2a3b (diff) | |
download | chromium_src-8119b2606e86a6b3460f608ab7120454724d173c.zip chromium_src-8119b2606e86a6b3460f608ab7120454724d173c.tar.gz chromium_src-8119b2606e86a6b3460f608ab7120454724d173c.tar.bz2 |
Replicating layout test configuration to new renderer processes.
Some layout tests (i.e.
http/tests/security/referrer-policy-attribute-anchor-origin-when-crossorigin.html)
navigate the page to another origin, which with --site-per-process moves
the page to a new renderer process. Such new renderer process contains
an uninitialized BlinkTestRunner instance - such instance fails to
correctly respond to testRunner.notifyDone(), because it incorrectly
thinks that it is not a |is_main_window_| (and that in turn causes the
test to timeout).
This CL makes sure that we replicate test configuration to new renderer
processes that are associated with the main frame where a layout test
runs. This means that |is_main_window_| is correctly populated when
testRunner.notifyDone() is called. It also helps replicate some test flags
(i.e. ones set by TestInterfaces::ConfigureForTestWithURL).
Rather than adding an override for the deprecated RenderView-related
methods of WebContentsObserver (i.e. for RenderViewHostChanged), the CL
adds a new override to BlinkTestController for RenderFrameHostChanged
and changes RenderViewCreated into a RenderFrameCreated override.
BUG=583485
Review URL: https://codereview.chromium.org/1660653005
Cr-Commit-Position: refs/heads/master@{#373879}
Diffstat (limited to 'content/shell/browser')
-rw-r--r-- | content/shell/browser/blink_test_controller.cc | 29 | ||||
-rw-r--r-- | content/shell/browser/blink_test_controller.h | 4 |
2 files changed, 29 insertions, 4 deletions
diff --git a/content/shell/browser/blink_test_controller.cc b/content/shell/browser/blink_test_controller.cc index 4026af0..f4003a4 100644 --- a/content/shell/browser/blink_test_controller.cc +++ b/content/shell/browser/blink_test_controller.cc @@ -470,18 +470,41 @@ void BlinkTestController::PluginCrashed(const base::FilePath& plugin_path, base::Unretained(this))); } -void BlinkTestController::RenderViewCreated(RenderViewHost* render_view_host) { +void BlinkTestController::RenderFrameCreated( + RenderFrameHost* render_frame_host) { DCHECK(CalledOnValidThread()); + + // Ignore hosts created for frames other than the main / top-level frame. + if (render_frame_host->GetParent() != nullptr) + return; + // Might be kNullProcessHandle, in which case we will receive a notification // later when the RenderProcessHost was created. - if (render_view_host->GetProcess()->GetHandle() != base::kNullProcessHandle) - current_pid_ = base::GetProcId(render_view_host->GetProcess()->GetHandle()); + base::ProcessHandle handle = render_frame_host->GetProcess()->GetHandle(); + if (handle != base::kNullProcessHandle) + current_pid_ = base::GetProcId(handle); + if (!send_configuration_to_next_host_) return; send_configuration_to_next_host_ = false; SendTestConfiguration(); } +void BlinkTestController::RenderFrameHostChanged(RenderFrameHost* old_host, + RenderFrameHost* new_host) { + DCHECK(CalledOnValidThread()); + + // Ignore host changes for frames other than the main / top-level frame. + if (new_host->GetParent() != nullptr) + return; + + base::ProcessHandle process_handle = new_host->GetProcess()->GetHandle(); + DCHECK(process_handle != base::kNullProcessHandle); + current_pid_ = base::GetProcId(process_handle); + + SendTestConfiguration(); +} + void BlinkTestController::RenderProcessGone(base::TerminationStatus status) { DCHECK(CalledOnValidThread()); if (current_pid_ != base::kNullProcessId) { diff --git a/content/shell/browser/blink_test_controller.h b/content/shell/browser/blink_test_controller.h index 92f86a1..3eaad47 100644 --- a/content/shell/browser/blink_test_controller.h +++ b/content/shell/browser/blink_test_controller.h @@ -151,7 +151,9 @@ class BlinkTestController : public base::NonThreadSafe, RenderFrameHost* render_frame_host) override; void PluginCrashed(const base::FilePath& plugin_path, base::ProcessId plugin_pid) override; - void RenderViewCreated(RenderViewHost* render_view_host) override; + void RenderFrameCreated(RenderFrameHost* render_frame_host) override; + void RenderFrameHostChanged(RenderFrameHost* old_host, + RenderFrameHost* new_host) override; void RenderProcessGone(base::TerminationStatus status) override; void WebContentsDestroyed() override; |