Make test MediaStreamTrack-gc-no-crash deterministic
The Layout Test MediaStreamTrack-gc-no-crash.html was non-determinstic in that it depend on a race between the JavaScript side declaring the asynchronous test "finished" and the callback to GetUserMedia arriving. It appears there were at least 3 possible outcomes. The first case was that the finishJSTest() would be invoked before the call to GetUserMedia would do anything much, and the test would essentially verify nothing. The second case was that when finishJSTest() was invoked, GetUserMedia would have reach a point where it would have temporarily taken shared ownership of the blink document but the callbacks would not yet have been invoked. The third case would be that finishJSTest() would be invoked after the callback to GetUserMedia had finished running. It looks like in practice, at least on my local machine, the first case was the only one reached so far. When trying to activate the new video capture service with [1], the timing changed so that the second case would typically be reached. This case would lead to the leak detector running at the end of the test reporting leaked blink objects and failing the test. I verified that the same would happen without activating the video capture service, simply by making the call to FakeVideoCaptureDeviceFactory::GetDescriptors() taking a bit longer, via PlatformThread::Sleep(). After this CL, the test should deterministically always reach the third case. [1] https://chromium-review.googlesource.com/c/chromium/src/+/719416 Bug: 789669 Test: third_party/WebKit/Tools/Scripts/run-webkit-tests --target gn_release --enable-leak-detection fast/mediastream/MediaStreamTrack-gc-no-crash.html Change-Id: I17c39e66cfd8c4af89f8f9b078d6512feaedbe6d Reviewed-on: https://chromium-review.googlesource.com/806442Reviewed-by:Hajime Hoshi <hajimehoshi@chromium.org> Commit-Queue: Christian Fremerey <chfremer@chromium.org> Cr-Commit-Position: refs/heads/master@{#521723}
Showing
Please register or sign in to comment