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

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

Issue 29348972: Issue 4239 - Change indentation to reflect our coding style (Closed)
Patch Set: Created Aug. 2, 2016, 10:43 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/MockWebRequestTest.java
diff --git a/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/MockWebRequestTest.java b/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/MockWebRequestTest.java
index 6377024c869d5a764cf36b6b07169f58c5e59710..df03fb18c77a8dc363bef708f7432e3f18ddf760 100644
--- a/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/MockWebRequestTest.java
+++ b/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/MockWebRequestTest.java
@@ -30,113 +30,113 @@ import java.util.List;
public class MockWebRequestTest extends BaseJsTest
{
- private class LocalMockWebRequest extends WebRequest
+ private class LocalMockWebRequest extends WebRequest
+ {
+ @Override
+ public ServerResponse httpGET(String url, List<HeaderEntry> headers)
{
- @Override
- public ServerResponse httpGET(String url, List<HeaderEntry> headers)
- {
- try
- {
- Thread.sleep(50);
- } catch (InterruptedException e)
- {
- throw new RuntimeException(e);
- }
-
- ServerResponse result = new ServerResponse();
- result.setStatus(ServerResponse.NsStatus.OK);
- result.setResponseStatus(123);
- result.setReponseHeaders(Arrays.asList(new HeaderEntry("Foo", "Bar")));
-
- result.setResponse(
- url + "\n" +
- headers.get(0).getKey() + "\n" +
- headers.get(0).getValue());
- return result;
- }
+ try
+ {
+ Thread.sleep(50);
+ } catch (InterruptedException e)
+ {
+ throw new RuntimeException(e);
+ }
+
+ ServerResponse result = new ServerResponse();
+ result.setStatus(ServerResponse.NsStatus.OK);
+ result.setResponseStatus(123);
+ result.setReponseHeaders(Arrays.asList(new HeaderEntry("Foo", "Bar")));
+
+ result.setResponse(
+ url + "\n" +
+ headers.get(0).getKey() + "\n" +
+ headers.get(0).getValue());
+ return result;
}
+ }
- @Override
- protected void setUp() throws Exception
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ jsEngine.setWebRequest(new LocalMockWebRequest());
+ }
+
+ @Test
+ public void testBadCall()
+ {
+ try
+ {
+ jsEngine.evaluate("_webRequest.GET()");
+ fail();
+ } catch (AdblockPlusException e)
+ {
+ // ignored
+ }
+
+ try
+ {
+ jsEngine.evaluate("_webRequest.GET('', {}, function(){})");
+ fail();
+ } catch (AdblockPlusException e)
{
- super.setUp();
+ // ignored
+ }
- jsEngine.setWebRequest(new LocalMockWebRequest());
+ try
+ {
+ jsEngine.evaluate("_webRequest.GET({toString: false}, {}, function(){})");
+ fail();
+ } catch (AdblockPlusException e)
+ {
+ // ignored
}
- @Test
- public void testBadCall()
+ try
{
- try
- {
- jsEngine.evaluate("_webRequest.GET()");
- fail();
- } catch (AdblockPlusException e)
- {
- // ignored
- }
-
- try
- {
- jsEngine.evaluate("_webRequest.GET('', {}, function(){})");
- fail();
- } catch (AdblockPlusException e)
- {
- // ignored
- }
-
- try
- {
- jsEngine.evaluate("_webRequest.GET({toString: false}, {}, function(){})");
- fail();
- } catch (AdblockPlusException e)
- {
- // ignored
- }
-
- try
- {
- jsEngine.evaluate("_webRequest.GET('http://example.com/', null, function(){})");
- fail();
- } catch (AdblockPlusException e)
- {
- // ignored
- }
-
- try
- {
- jsEngine.evaluate("_webRequest.GET('http://example.com/', {}, null)");
- fail();
- } catch (AdblockPlusException e)
- {
- // ignored
- }
-
- try
- {
- jsEngine.evaluate("_webRequest.GET('http://example.com/', {}, function(){}, 0)");
- fail();
- } catch (AdblockPlusException e)
- {
- // ignored
- }
+ jsEngine.evaluate("_webRequest.GET('http://example.com/', null, function(){})");
+ fail();
+ } catch (AdblockPlusException e)
+ {
+ // ignored
}
- @Test
- public void testSuccessfulRequest() throws InterruptedException
+ try
+ {
+ jsEngine.evaluate("_webRequest.GET('http://example.com/', {}, null)");
+ fail();
+ } catch (AdblockPlusException e)
+ {
+ // ignored
+ }
+
+ try
+ {
+ jsEngine.evaluate("_webRequest.GET('http://example.com/', {}, function(){}, 0)");
+ fail();
+ } catch (AdblockPlusException e)
{
- jsEngine.evaluate(
- "_webRequest.GET('http://example.com/', {X: 'Y'}, function(result) {foo = result;} )");
- assertTrue(jsEngine.evaluate("this.foo").isUndefined());
-
- Thread.sleep(200);
-
- assertEquals(
- ServerResponse.NsStatus.OK.getStatusCode(),
- jsEngine.evaluate("foo.status").asLong());
- assertEquals("http://example.com/\nX\nY", jsEngine.evaluate("foo.responseText").asString());
- assertEquals("{\"Foo\":\"Bar\"}",
- jsEngine.evaluate("JSON.stringify(foo.responseHeaders)").asString());
+ // ignored
}
+ }
+
+ @Test
+ public void testSuccessfulRequest() throws InterruptedException
+ {
+ jsEngine.evaluate(
+ "_webRequest.GET('http://example.com/', {X: 'Y'}, function(result) {foo = result;} )");
+ assertTrue(jsEngine.evaluate("this.foo").isUndefined());
+
+ Thread.sleep(200);
+
+ assertEquals(
+ ServerResponse.NsStatus.OK.getStatusCode(),
+ jsEngine.evaluate("foo.status").asLong());
+ assertEquals("http://example.com/\nX\nY", jsEngine.evaluate("foo.responseText").asString());
+ assertEquals("{\"Foo\":\"Bar\"}",
+ jsEngine.evaluate("JSON.stringify(foo.responseHeaders)").asString());
+ }
}

Powered by Google App Engine
This is Rietveld