Opened 4 years ago

Closed 2 years ago

#4081 closed defect (fixed)

Fix failing MockWebRequestTest test for libadblockplus-android

Reported by: asmirnov Assignee: asmirnov
Priority: P3 Milestone:
Module: Libadblockplus-Android Keywords:
Cc: rjeschke Blocked By: #4031
Blocking: Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):


MockWebRequestTest test similar to

It is failing with assert exception:

     [exec] junit.framework.ComparisonFailure: expected:<{["Foo":"Bar"]}> but was:<{[]}>
     [exec] 	at org.adblockplus.libadblockplus.tests.MockWebRequestTest.testSuccessfulRequest(
     [exec] 	at java.lang.reflect.Method.invokeNative(Native Method)
     [exec] 	at android.test.AndroidTestRunner.runTest(
     [exec] 	at android.test.AndroidTestRunner.runTest(
     [exec] 	at android.test.InstrumentationTestRunner.onStart(
     [exec] 	at$

The reason is (most likely) headers are not mapped from java code to c++ code even if mock webrequest impl with headers is used:

private class LocalMockWebRequest extends WebRequest {
        public ServerResponse httpGET(String url, List<HeaderEntry> headers) {
            try {
            } catch (InterruptedException e) {
                throw new RuntimeException(e);

            ServerResponse result = new ServerResponse();
            result.setReponseHeaders(Arrays.asList(new HeaderEntry("Foo", "Bar")));

                url + "\n" +
                headers.get(0).getKey() + "\n" +
            return result;


    protected void setUp() throws Exception {

        jsEngine.setWebRequest(new LocalMockWebRequest());

Change History (7)

comment:1 Changed 4 years ago by asmirnov

  • Component changed from Unknown to Libadblockplus-Android

comment:2 Changed 4 years ago by asmirnov

  • Owner changed from Anton to asmirnov

comment:4 Changed 4 years ago by asmirnov

  • Status changed from new to reviewing

comment:5 Changed 4 years ago by asmirnov

  • Review URL(s) modified (diff)

comment:6 Changed 4 years ago by abpbot

comment:7 Changed 2 years ago by asmirnov

  • Resolution set to fixed
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.