WCO::ReadyToCommitNavigation invoked inconsistently in tests in plznav vs non-plznav |
|||
Issue descriptionIn bug 621856 , ReadyToCommitNaviation was wired up to work in non-plznav. However, it seems that this method is not wired up consistently in unit tests, from methods such as TestWebContents::CommitPendingNavigation() (or the TestRenderFrameHost equivalent). ReadyToCommitNaviation does get invoked via TestWebContents::CommitPendingNavigation() when plznav is enabled, but does not get invoked when plznav is not enabled. This makes it hard to write unit tests that exercise the same codepaths in both modes. For example, in https://cs.chromium.org/chromium/src/components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc?rcl=80e2a4ce4a074b27512bcc4ae97bdc7eaed2a8c5&l=242, the unit test conditionally invokes the ReadyToCommitNavigation policy method manually, but only when browser side navigation is not enabled. This is making it hard to extend these tests to accurately cover cases where the state of the NavigationHandle passed to ReadyToCommitNaviation needs to be varied. For example, I need to write a test where the page transition type is reload - to make this work in the current flow I have to set up state one way for the browser-side nav flow, and another way for the non browser-side nav flow. This is really fragile. Ideally, ReadyToCommitNavigation would be invoked consistently in both browser side and non browser side navigation flows, and the earlier linked unit test wouldn't have to invoke ReadyToCommitNaviationInternal manually when plznav is disabled. This is currently blocking me from being able to land a change. I'm going to try to work around it, likely by disabling the test in plznav mode, but we should fix this so it doesn't affect other tests going forward.
,
Feb 9 2017
,
Mar 2 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/6b6831f2f18308600d867887809305af8642c2ed commit 6b6831f2f18308600d867887809305af8642c2ed Author: clamy <clamy@chromium.org> Date: Thu Mar 02 16:30:17 2017 Introduce NavigationSimulator to use in unit tests This CL introduces a new helper class to simulate navigations in unit tests, the NavigationSimulator. Simulating navigations has been hard in the past, as numerous unit tests simulate a wrong ordering of IPCs or use the wrong RenderFrameHost to commit the navigation. Some WebContentsObserver methods may also not be called. The goal of the new class is to give users of the content/ API an easy way to simulate navigations that stays up-to-date with the actual code used in production. BUG= 688393 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation Review-Url: https://codereview.chromium.org/2682313002 Cr-Commit-Position: refs/heads/master@{#454279} [modify] https://crrev.com/6b6831f2f18308600d867887809305af8642c2ed/components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc [modify] https://crrev.com/6b6831f2f18308600d867887809305af8642c2ed/content/browser/frame_host/navigation_handle_impl.cc [modify] https://crrev.com/6b6831f2f18308600d867887809305af8642c2ed/content/browser/frame_host/navigation_handle_impl.h [modify] https://crrev.com/6b6831f2f18308600d867887809305af8642c2ed/content/browser/frame_host/render_frame_host_impl.cc [modify] https://crrev.com/6b6831f2f18308600d867887809305af8642c2ed/content/public/common/referrer.cc [modify] https://crrev.com/6b6831f2f18308600d867887809305af8642c2ed/content/public/common/referrer.h [add] https://crrev.com/6b6831f2f18308600d867887809305af8642c2ed/content/public/test/navigation_simulator.cc [add] https://crrev.com/6b6831f2f18308600d867887809305af8642c2ed/content/public/test/navigation_simulator.h [modify] https://crrev.com/6b6831f2f18308600d867887809305af8642c2ed/content/public/test/test_renderer_host.h [modify] https://crrev.com/6b6831f2f18308600d867887809305af8642c2ed/content/test/BUILD.gn
,
Apr 20 2017
|
|||
►
Sign in to add a comment |
|||
Comment 1 by engedy@chromium.org
, Feb 3 2017