Tests in record_wpr_unittest open the browser and network_controller twice |
|||
Issue description(Found these while cleaning up the network_controller code and fixing tests.) By subclassing from TabTestCase (which isa BrowserTestCase): https://github.com/catapult-project/catapult/blob/37921f135dc61021b8ced4c73375339658ac9953/telemetry/telemetry/record_wpr_unittest.py#L106 (A) The network controller is started and a browser is created in: https://github.com/catapult-project/catapult/blob/37921f135dc61021b8ced4c73375339658ac9953/telemetry/telemetry/testing/browser_test_case.py#L98 (B) Then wpr_recorder.Record(..) in the tests ends up calling story_runner.Run(..), which creates a SharedPageState in the usual way, thus both opening the network controller (again) and then a browser (again). Ideally we would like to remove (A) since these unit tests do not require an existing browser to be running. But this is not easy because the tests do need to compute the url for "blank.html" on the local server [3], and this requires the network controller to be open. [3]: https://github.com/catapult-project/catapult/blob/37921f135dc61021b8ced4c73375339658ac9953/telemetry/telemetry/record_wpr_unittest.py#L115 We could: 1. Entirely remove (A), and do some refactor (how?) so the url computation does not depend on the network controller being open. Note: as things stand, if the shared state for some reason decides to re-open the network controller (as it does now! [4] it probably works by accident?), this could invalidate the url's computed at the beginning of the test. [4]: https://github.com/catapult-project/catapult/blob/37921f135dc61021b8ced4c73375339658ac9953/telemetry/telemetry/page/shared_page_state.py#L92 2. Do not start the browser in (A), but _do_ start the network controller so we can compute the urls. On shared_state, fix the code so it doesn't close but re-use the existing controller if already open. 3. Leave (A) as it is. But still fix the network controller so it re-uses the existing servers. Thoughts?
,
Nov 21 2017
Yep, I think I know how to do this.
,
Nov 21 2017
,
Feb 20 2018
|
|||
►
Sign in to add a comment |
|||
Comment 1 by nedngu...@google.com
, Nov 21 2017