diff --git a/app/src/main/jni/httrack b/app/src/main/jni/httrack index 6bb24d1..eddf187 160000 --- a/app/src/main/jni/httrack +++ b/app/src/main/jni/httrack @@ -1 +1 @@ -Subproject commit 6bb24d1a11d1927f5a935071d7a1bbb16e048e19 +Subproject commit eddf187ca9e181108975e77a7b43feb785b37cac diff --git a/app/src/test/java/com/httrack/android/BrowserLoginEngineLimitsTest.java b/app/src/test/java/com/httrack/android/BrowserLoginEngineLimitsTest.java index a2ba6f2..abe1fa4 100644 --- a/app/src/test/java/com/httrack/android/BrowserLoginEngineLimitsTest.java +++ b/app/src/test/java/com/httrack/android/BrowserLoginEngineLimitsTest.java @@ -105,17 +105,24 @@ public void theCapsKeepEveryLineUnderTheEnginesLineMax() throws IOException { */ @Test public void theBundleWriterIsAnExportedEngineCallThatReadsItsOwnOutputBack() throws IOException { + assertTrue("the JNI calls the flags entry point now, so this test reads the wrong function", + TestSources.read(TestSources.mainFile("jni/htslibjni.c")).contains( + "hts_bundle_from_paste(paste, folder, agent, url")); assertTrue("hts_bundle_from_paste is no longer exported", source("httrack-library.h").contains("HTSEXT_API hts_boolean hts_bundle_from_paste(")); final String paste = source("htsbundle.c"); - // Inside that function, not anywhere in the file, and the failure has to stop the write. - final String body = TestSources.balancedBlock(paste, + final String wrapper = TestSources.balancedBlock(paste, TestSources.indexOf(paste, "HTSEXT_API hts_boolean hts_bundle_from_paste(")); - final int read = body.indexOf("bundle_load_src(opt, &check, &src"); - assertTrue(body, read != -1); - assertTrue(body, body.startsWith("if (!", body.lastIndexOf("if (!", read))); - assertTrue(body, body.indexOf("PASTE_FAIL", read) != -1); - assertTrue(body, body.indexOf("cookie_write_replace", read) > read); + assertTrue(wrapper, wrapper.contains("return hts_bundle_from_paste_flags(")); + final String body = TestSources.balancedBlock(paste, + TestSources.indexOf(paste, "HTSEXT_API hts_boolean hts_bundle_from_paste_flags(")); + // Failing has to be the guard's whole statement, or a bundle the read-back rejected still + // reaches the folder. + final int read = TestSources.indexOf(body, "!bundle_load_src("); + final int ends = body.indexOf(';', read); + final String guard = body.substring(read, ends + 1).replaceAll("\\s+", " "); + assertTrue(guard, guard.matches("!bundle_load_src\\(.*\\)\\) PASTE_FAIL\\(.*;")); + assertTrue(body, body.indexOf("cookie_write_replace") > ends); } /** Our file has to leave the mirror's own cookies.txt room in the same jar. */