Print Preview: Fix flaky tests on Mac
A couple tests: PrintPreviewSettingsSelectTest.All PrintPreviewOtherOptionsSettingsTest.All were flaky on Mac. This is because on Mac, the initial settings returned from C++ after the print-preview-app was detached and the new model instance was attached. These tests don't expect print-preview-app to be running as they are unit tests for the elements they test, but print preview app still ran onInitialSettingsSet_ when the new Model instance resolved the whenReady() promise. To fix this, get the model whenReady() promise in attached(), and store it in print-preview-app. Clear it when the app is detached and check its value before dereferencing. This ensures that the app only continues to initialize everything if its own model is still attached. Also changing settings select test to add binding after setting the settings property, for consistency with other tests. Bug: 945846 Change-Id: Id59bd412071af3a88e9e778c61b02bc729234856 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1540072Reviewed-by:Esmael El-Moslimany <aee@chromium.org> Commit-Queue: Rebekah Potter <rbpotter@chromium.org> Cr-Commit-Position: refs/heads/master@{#644899}
Showing
Please register or sign in to comment