Commit b212a18e authored by bsheedy's avatar bsheedy Committed by Commit Bot

Fix VR Iframe JS Threading

Fixes JavaScript run in iframes during VR instrumentation tests not
being run on the UI thread, which was hitting a recently added DCHECK.

TBR=billorr@chromium.org

Bug: 939410
Change-Id: I5d3eba0e8075306cff0182c7d10c4c81204afc10
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1508582Reviewed-by: default avatarBrian Sheedy <bsheedy@chromium.org>
Commit-Queue: Brian Sheedy <bsheedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#638669}
parent c41b2aac
...@@ -352,9 +352,12 @@ public abstract class XrTestFramework { ...@@ -352,9 +352,12 @@ public abstract class XrTestFramework {
Assert.assertTrue("Did not get a focused frame", rfh != null); Assert.assertTrue("Did not get a focused frame", rfh != null);
final CountDownLatch latch = new CountDownLatch(1); final CountDownLatch latch = new CountDownLatch(1);
final AtomicReference<String> result = new AtomicReference<String>(); final AtomicReference<String> result = new AtomicReference<String>();
rfh.executeJavaScript(js, (String r) -> { // The JS execution needs to be started on the UI thread to avoid hitting a DCHECK.
result.set(r); ThreadUtils.runOnUiThreadBlocking(() -> {
latch.countDown(); rfh.executeJavaScript(js, (String r) -> {
result.set(r);
latch.countDown();
});
}); });
try { try {
if (!latch.await(timeout, TimeUnit.MILLISECONDS) && failOnTimeout) { if (!latch.await(timeout, TimeUnit.MILLISECONDS) && failOnTimeout) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment