TestNavigationThrottle has the functionality many tests need, and can be adapted more easily in a subclass for some others.
Here's a partial list from what I wrote up on Monday:
ResourceLoadingCancellingThrottle (in ads_page_load_metrics_observer_unittest.cc)
- Cancel asynchronously for WillProcessResponse.
- Call a method when the throttle will cancel.
SubresourceFilterSafeBrowsingActivationThrottleTestWithCancelling (in subresource_filter_safe_browsing_activation_throttle_unittest.cc)
- Allow canceling for each method, synchronously and asynchronously.
DeletingNavigationThrottle (in navigation_handle_impl_unittest.cc)
- Run a callback when each method is called.
- Same callback in each case (resets the navigation handle).
TestNavigationManagerThrottle (in browser_test_utils.cc)
- For WillStartRequest and WillProcessResponse:
- Synchronously DEFER
- Don’t cancel resume from the throttle.
- Call a callback (which will do a little extra work before resuming the navigation by itself).
NavigationThrottleCallbackRunner (in navigation_simulator.cc)
- Currently: run a callback when each method is called (different callback in each case.)
- Actual use case: count calls to each method.
navigation_simulator_unittest.cc
- Allow canceling for each method, synchronously and asynchronously.
- For WillFailRequest(), it will be desirable if the ThrottleCheckResult can be specified.
"TestNavigationThrottle" (in navigation_handle_impl_browsertest.cc)
- Asynchronous callbacks
- Custom responses
- Keep track of the RequestContextType
- Expose Resume() and CancelDeferredNavigation().
- This might not be needed if we add support for aynchronous Resume() in TestNavigationThrottle.
A bunch of these also use custom inserters, and it might be worth looking into upgrading TestNavigationThrottleInserter to handle them. [1]
[1] https://cs.chromium.org/chromium/src/content/public/test/test_navigation_throttle_inserter.cc?sq=package:chromium&dr=CSs
TestNavigationThrottle has the functionality many tests need, and can be adapted more easily in a subclass for some others.
Here's a partial list from what I wrote up on Monday:
ResourceLoadingCancellingThrottle (in ads_page_load_metrics_observer_unittest.cc)
- Cancel asynchronously for WillProcessResponse.
- Call a method when the throttle will cancel.
SubresourceFilterSafeBrowsingActivationThrottleTestWithCancelling (in subresource_filter_safe_browsing_activation_throttle_unittest.cc)
- Allow canceling for each method, synchronously and asynchronously.
DeletingNavigationThrottle (in navigation_handle_impl_unittest.cc)
- Run a callback when each method is called.
- Same callback in each case (resets the navigation handle).
TestNavigationManagerThrottle (in browser_test_utils.cc)
- For WillStartRequest and WillProcessResponse:
- Synchronously DEFER
- Don’t cancel resume from the throttle.
- Call a callback (which will do a little extra work before resuming the navigation by itself).
NavigationThrottleCallbackRunner (in navigation_simulator.cc)
- Currently: run a callback when each method is called (different callback in each case.)
- Actual use case: count calls to each method.
navigation_simulator_unittest.cc
- Allow canceling for each method, synchronously and asynchronously.
- For WillFailRequest(), it will be desirable if the ThrottleCheckResult can be specified.
"TestNavigationThrottle" (in navigation_handle_impl_browsertest.cc)
- Keep track of the RequestContextType
- Custom responses
- Allow waiting for asynchronous callbacks to finish.
- Asynchronous callbacks
- Expose Resume() and CancelDeferredNavigation().
- This might not be needed if we add support for aynchronous Resume() in TestNavigationThrottle.
A bunch of these also use custom inserters, and it might be worth looking into upgrading TestNavigationThrottleInserter to handle them. [1]
[1] https://cs.chromium.org/chromium/src/content/public/test/test_navigation_throttle_inserter.cc?sq=package:chromium&dr=CSs
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.
Sorry for the inconvenience if the bug really should have been left as Available.
For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
lgarron@ is no longer working on Chromium, so I'm reassigning it to clamy@, who drove most of the NavigationThrottle work and adding few other folks on cc.
Comment 1 by lgar...@chromium.org
, Oct 4 2017