Index: libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/GlobalJsObjectTest.java |
diff --git a/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/GlobalJsObjectTest.java b/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/GlobalJsObjectTest.java |
index 13b5400a44a870cef0169b9a4050a8f6c8420869..b0509a350455a5f1e3caceb743f4a7ddec15ff6f 100644 |
--- a/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/GlobalJsObjectTest.java |
+++ b/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/GlobalJsObjectTest.java |
@@ -26,19 +26,19 @@ public class GlobalJsObjectTest extends BaseJsTest |
@Test |
public void testSetTimeout() throws InterruptedException |
{ |
- jsEngine.evaluate("setTimeout(function() {foo = 'bar';}, 100)"); |
- assertTrue(jsEngine.evaluate("this.foo").isUndefined()); |
+ jsEngine.evaluate("let foo; setTimeout(function() {foo = 'bar';}, 100)"); |
+ assertTrue(jsEngine.evaluate("foo").isUndefined()); |
Thread.sleep(200); |
- assertEquals("bar", jsEngine.evaluate("this.foo").asString()); |
+ assertEquals("bar", jsEngine.evaluate("foo").asString()); |
} |
@Test |
public void testSetTimeoutWithArgs() throws InterruptedException |
{ |
- jsEngine.evaluate("setTimeout(function(s) {foo = s;}, 100, 'foobar')"); |
- assertTrue(jsEngine.evaluate("this.foo").isUndefined()); |
+ jsEngine.evaluate("let foo; setTimeout(function(s) {foo = s;}, 100, 'foobar')"); |
+ assertTrue(jsEngine.evaluate("foo").isUndefined()); |
Thread.sleep(200); |
- assertEquals("foobar", jsEngine.evaluate("this.foo").asString()); |
+ assertEquals("foobar", jsEngine.evaluate("foo").asString()); |
} |
@Test |
@@ -68,10 +68,10 @@ public class GlobalJsObjectTest extends BaseJsTest |
@Test |
public void testSetMultipleTimeouts() throws InterruptedException |
{ |
- jsEngine.evaluate("foo = []"); |
+ jsEngine.evaluate("let foo = []"); |
jsEngine.evaluate("setTimeout(function(s) {foo.push('1');}, 100)"); |
jsEngine.evaluate("setTimeout(function(s) {foo.push('2');}, 150)"); |
Thread.sleep(200); |
- assertEquals("1,2", jsEngine.evaluate("this.foo").asString()); |
+ assertEquals("1,2", jsEngine.evaluate("foo").asString()); |
} |
} |