Add a CTS test for the header map populated by CacheManager.getCacheFile()
We only test the case where the header map is not populated, as we don't place
hard guarantees on exactly how and when it is populated.
See https://android-git.corp.google.com/g/#/c/166978
Change-Id: Ib14030c78962ad91776ad152f7955f8f0a8ce4f9
diff --git a/tests/tests/webkit/src/android/webkit/cts/CacheManager_CacheResultTest.java b/tests/tests/webkit/src/android/webkit/cts/CacheManager_CacheResultTest.java
index c25b6e6..6c3ef93 100755
--- a/tests/tests/webkit/src/android/webkit/cts/CacheManager_CacheResultTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/CacheManager_CacheResultTest.java
@@ -28,6 +28,8 @@
import java.io.File;
import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
public class CacheManager_CacheResultTest
extends ActivityInstrumentationTestCase2<WebViewStubActivity> {
@@ -55,7 +57,7 @@
}
public void testCacheResult() throws Exception {
- final long validity = 5 * 50 * 1000; // 5 min
+ final long validity = 5 * 60 * 1000; // 5 min
final long age = 30 * 60 * 1000; // 30 min
final long tolerance = 5 * 1000; // 5s
@@ -75,7 +77,11 @@
}.run();
final long time = System.currentTimeMillis();
mOnUiThread.loadUrlAndWaitForCompletion(url);
- CacheResult result = CacheManager.getCacheFile(url, null);
+
+ Map<String, String> headers = new HashMap<String, String>();
+ CacheResult result = CacheManager.getCacheFile(url, headers);
+ assertTrue(headers.isEmpty());
+
assertNotNull(result);
assertNotNull(result.getInputStream());
assertTrue(result.getContentLength() > 0);