This source file includes following definitions.
- notifyResultIsReady
- waitForResult
- executeJavaScript
package org.chromium.content.browser;
import junit.framework.Assert;
public class JavaBridgeTestBase extends ContentViewTestBase {
protected class Controller {
private boolean mIsResultReady;
protected synchronized void notifyResultIsReady() {
mIsResultReady = true;
notify();
}
protected synchronized void waitForResult() {
while (!mIsResultReady) {
try {
wait(5000);
} catch (Exception e) {
continue;
}
if (!mIsResultReady) {
Assert.fail("Wait timed out");
}
}
mIsResultReady = false;
}
}
protected void executeJavaScript(final String script) throws Throwable {
runTestOnUiThread(new Runnable() {
@Override
public void run() {
getContentView().loadUrl(new LoadUrlParams(
"javascript:(function() { " + script + " })()"));
}
});
}
}