MediaRouterIntegrationTest#testBasic started failing flakily for multiple reasons |
|||||
Issue descriptionorg.chromium.chrome.browser.media.router.MediaRouterIntegrationTest#testBasic Error log for linux: https://build.chromium.org/p/chromium.linux/builders/Android%20Tests/builds/34569 java.lang.SecurityException: Injecting to another application requires INJECT_EVENTS permission at android.os.Parcel.readException(Parcel.java:1465) at android.os.Parcel.readException(Parcel.java:1419) at android.hardware.input.IInputManager$Stub$Proxy.injectInputEvent(IInputManager.java:356) at android.hardware.input.InputManager.injectInputEvent(InputManager.java:641) at android.app.Instrumentation.sendPointerSync(Instrumentation.java:937) at org.chromium.chrome.browser.media.RouterTestUtils.sendMouseAction(RouterTestUtils.java:153) at org.chromium.chrome.browser.media.RouterTestUtils.mouseSingleClickView(RouterTestUtils.java:2166) at org.chromium.chrome.browser.media.RouterTestUtils.mouseSingleClickView(RouterTestUtils.java:195) at org.chromium.chrome.browser.media.router.MediaRouterIntegrationTest.testBasic(MediaRouterIntegrationTest.java:216) Error log for lollipop: https://build.chromium.org/p/chromium.android/builders/Lollipop%20Phone%20Tester/builds/7831 org.chromium.chrome.browser.media.router.MediaRouterIntegrationTest#testBasic (run #1): junit.framework.AssertionFailedError: Expect connection state to be "connecting", actual "connected" at org.chromium.chrome.browser.media.router.MediaRouterIntegrationTest.executeJavaScriptApi(MediaRouterIntegrationTest.java:172) at org.chromium.chrome.browser.media.router.MediaRouterIntegrationTest.executeJavaScriptApi(MediaRouterIntegrationTest.java:149) at org.chromium.chrome.browser.media.router.MediaRouterIntegrationTest.testBasic(MediaRouterIntegrationTest.java:217) at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214) at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199) at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192) at org.chromium.chrome.test.ChromeActivityTestCaseBase.runTest(ChromeActivityTestCaseBase.java:726) at org.chromium.base.test.BaseTestResult.runParameterized(BaseTestResult.java:161) Overall flakiness dashboard: https://test-results.appspot.com/dashboards/flakiness_dashboard.html#tests=org.chromium.chrome.browser.media.router.MediaRouterIntegrationTest%23testBasic&testType=chrome_public_test_apk I don't see any reason for this to have started failing recently. @zqzhang, can you please triage this failure?
,
Nov 11 2016
The first failure happens to any test using mouse or keyboard events when something is obscuring the Chrome activity. To fix it we'd need to fix whatever is crashing on the device or showing some other bit of UI. I suspect https://codereview.chromium.org/2470023002/ is the reason for the second failure. Perhaps the test page gets the connected state change too soon for the test page to catch it? +zhaobin
,
Nov 11 2016
Looking into the second failure.
,
Nov 11 2016
Re the patch in #2: in Blink we are resolving the PresentationRequest promise [1] and dispatching the state change event to "connected" [2] as two separate tasks. Despite this, the state change has already occurred by the time the statements chained to the promise is run, since [1] isn't synchronous with the chained code being executed. This makes it a bit tricky to always ensure the initial PresentationConnection state is always connecting when the start() promise is resolved. In fact I am not sure if it is possible in general. For now I think it would be acceptable to change the assertion of the test to either connected or connecting. Anton, Mounir: WDYT? [1] https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.cpp?q=f:webkit+f:presentation+onsuccess&sq=package:chromium&dr=CSs&l=36 [2] https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp?dr&sq=package:chromium&rcl=1478881111&l=418
,
Nov 12 2016
It seems, we send two mojo messages from PresentationServiceImpl synchronously, right? [1] I assume Mojo preserves the order. If the messages are processed separately on the renderer message loop, but in the same order, we shouldn't have a problem - there'd be a message loop cycle between the promise being resolved and the state being changed to 'connected'. It is possible the two Mojo messages are buffered and processed on the same call stack, then the promise is resolved and then the state changes to 'connected' immediately but again in the right order. AFAIK, both promise resolving and event dispatching in Blink are synchronous so we shouldn't have a problem either. However, if promise resolving is async, the event would be processed earlier. Is this what's really happening? I'm fine with fixing the test by changing the expected state, esp. short term, but I think it would be better if we could fix the order for the developers (what if they count on the order of 'connecting' and then 'connected' event for their pages working?). [1] https://cs.chromium.org/chromium/src/content/browser/presentation/presentation_service_impl.cc?rcl=0&l=307
,
Nov 12 2016
Anton: from what I can infer, that's what's happening. The PresentationRequest resolver is resolved in a task on the renderer message loop first, then the state change event is dispatched in a later task on that same message loop. V8's ScriptPromiseResolver implementation has a conditional that implies that the promise does not get settled right away in all cases [1] - in cases where the test was failing, maybe we are hitting that case? [1] https://cs.chromium.org/chromium/src/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolver.h?sq=package:chromium&dr=CSs&rcl=1478895861&l=120
,
Nov 12 2016
Hm, this condition (active DOM objects suspended) might be hit when the page is in the background or something like that IIRC. Mounir might know more.
,
Nov 14 2016
On my side, just to remind that the Android test is a Java implementation of the native browsertest. See: https://cs.chromium.org/chromium/src/chrome/test/media_router/media_router_integration_browsertest.cc?rcl=0&l=408 The test steps/behaviors on desktop and Android should be consistent.
,
Nov 14 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/8b0e9501ddf062423fd35f1ef00ba39085614dcc commit 8b0e9501ddf062423fd35f1ef00ba39085614dcc Author: zhaobin <zhaobin@chromium.org> Date: Mon Nov 14 22:42:51 2016 [Presentation API] Fix integration test - initial state of connection can be 'connecting' or 'connected' presentationRequest.start().then(function(connection) { // connection state could be 'connecting' or 'connected' here }); We created two async tasks on page: 1. resolve start() and invoke callback in then(); 2. change connection state to 'connected'. It seems that execution order of these two tasks is random. Will allow both state for now. More details in crbug.com/664629 BUG= 664629 Review-Url: https://codereview.chromium.org/2492393002 Cr-Commit-Position: refs/heads/master@{#431926} [modify] https://crrev.com/8b0e9501ddf062423fd35f1ef00ba39085614dcc/chrome/test/media_router/resources/common.js
,
Nov 28 2016
|
|||||
►
Sign in to add a comment |
|||||
Comment 1 by zqzh...@chromium.org
, Nov 11 2016Owner: avayvod@chromium.org