Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/MockWebRequestTest.java

Issue 29536596: Issue 5556 - Update to use libadblockplus revision hg:566f64c8a2a8 (Closed) Base URL: github.com:abby-sergz/libadblockplus-android.git
Patch Set: Created Sept. 5, 2017, 12:21 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/GlobalJsObjectTest.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/GlobalJsObjectTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld