| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * This file is part of Adblock Plus <https://adblockplus.org/>, | 2  * This file is part of Adblock Plus <https://adblockplus.org/>, | 
| 3  * Copyright (C) 2006-present eyeo GmbH | 3  * Copyright (C) 2006-present eyeo GmbH | 
| 4  * | 4  * | 
| 5  * Adblock Plus is free software: you can redistribute it and/or modify | 5  * Adblock Plus is free software: you can redistribute it and/or modify | 
| 6  * it under the terms of the GNU General Public License version 3 as | 6  * it under the terms of the GNU General Public License version 3 as | 
| 7  * published by the Free Software Foundation. | 7  * published by the Free Software Foundation. | 
| 8  * | 8  * | 
| 9  * Adblock Plus is distributed in the hope that it will be useful, | 9  * Adblock Plus is distributed in the hope that it will be useful, | 
| 10  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 124     catch (AdblockPlusException e) | 124     catch (AdblockPlusException e) | 
| 125     { | 125     { | 
| 126       // ignored | 126       // ignored | 
| 127     } | 127     } | 
| 128   } | 128   } | 
| 129 | 129 | 
| 130   @Test | 130   @Test | 
| 131   public void testSuccessfulRequest() throws InterruptedException | 131   public void testSuccessfulRequest() throws InterruptedException | 
| 132   { | 132   { | 
| 133     jsEngine.evaluate( | 133     jsEngine.evaluate( | 
| 134       "_webRequest.GET('http://example.com/', {X: 'Y'}, function(result) {foo = 
     result;} )"); | 134       "let foo = true; _webRequest.GET('http://example.com/', {X: 'Y'}, function
     (result) {foo = result;} )"); | 
| 135     assertTrue(jsEngine.evaluate("this.foo").isUndefined()); | 135     assertTrue(jsEngine.evaluate("foo").isBoolean()); | 
|  | 136     assertTrue(jsEngine.evaluate("foo").asBoolean()); | 
| 136 | 137 | 
| 137     Thread.sleep(200); | 138     Thread.sleep(200); | 
| 138 | 139 | 
| 139     assertEquals( | 140     assertEquals( | 
| 140       ServerResponse.NsStatus.OK.getStatusCode(), | 141       ServerResponse.NsStatus.OK.getStatusCode(), | 
| 141       jsEngine.evaluate("foo.status").asLong()); | 142       jsEngine.evaluate("foo.status").asLong()); | 
| 142     assertEquals("http://example.com/\nX\nY", jsEngine.evaluate("foo.responseTex
     t").asString()); | 143     assertEquals("http://example.com/\nX\nY", jsEngine.evaluate("foo.responseTex
     t").asString()); | 
| 143     assertEquals("{\"Foo\":\"Bar\"}", | 144     assertEquals("{\"Foo\":\"Bar\"}", | 
| 144       jsEngine.evaluate("JSON.stringify(foo.responseHeaders)").asString()); | 145       jsEngine.evaluate("JSON.stringify(foo.responseHeaders)").asString()); | 
| 145   } | 146   } | 
| 146 | 147 | 
| 147 } | 148 } | 
| OLD | NEW | 
|---|