Revert "Allow CacheManager to be initially disabled."
This is no longer needed as the CacheManager should always be enabled.
This reverts commit 0dee316c165ec017d0456eb7fa041a839ef72190.
Bug: 3270236
Change-Id: I481dcd6a81c600f67ddac7000dd8b109d1d96866
diff --git a/tests/tests/webkit/src/android/webkit/cts/CacheManagerTest.java b/tests/tests/webkit/src/android/webkit/cts/CacheManagerTest.java
index e2b90b6..268256e 100644
--- a/tests/tests/webkit/src/android/webkit/cts/CacheManagerTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/CacheManagerTest.java
@@ -122,17 +122,23 @@
@Override
protected boolean check() {
CacheResult result = CacheManager.getCacheFile(url, null);
- if (CacheManager.cacheDisabled()) {
- // Cache is disabled, so the URL should not have been added.
- return result == null;
- } else {
- // Cache enabled, so the last URL loaded should be there.
- return result != null;
- }
+ return result != null;
}
}.run();
}
+ @TestTargetNew(
+ level = TestLevel.PARTIAL,
+ method = "cacheDisabled",
+ args = {}
+ )
+ public void testCacheDisabled() {
+ assertFalse(CacheManager.cacheDisabled());
+
+ // Because setCacheDisabled is package private, we can not call it.
+ // cacheDisabled() always return false. How to let it return true?
+ }
+
private void loadUrl(String url){
mWebView.loadUrl(url);
// check whether loadURL successfully
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 ffb2b60..1a18a86 100644
--- a/tests/tests/webkit/src/android/webkit/cts/CacheManager_CacheResultTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/CacheManager_CacheResultTest.java
@@ -148,30 +148,26 @@
final long time = System.currentTimeMillis();
loadUrl(url);
CacheResult result = CacheManager.getCacheFile(url, null);
- if (CacheManager.cacheDisabled()) {
- assertNull(result);
- } else {
- assertNotNull(result);
- assertNotNull(result.getInputStream());
- assertTrue(result.getContentLength() > 0);
- assertNull(result.getETag());
- assertEquals(time - age,
- DateUtils.parseDate(result.getLastModified()).getTime(), tolerance);
- File file = new File(CacheManager.getCacheFileBaseDir().getPath(), result.getLocalPath());
- assertTrue(file.exists());
- assertNull(result.getLocation());
- assertEquals("text/html", result.getMimeType());
- assertNull(result.getOutputStream());
- assertEquals(time + validity, result.getExpires(), tolerance);
- assertEquals(HttpStatus.SC_OK, result.getHttpStatusCode());
- assertNotNull(result.getEncoding());
+ assertNotNull(result);
+ assertNotNull(result.getInputStream());
+ assertTrue(result.getContentLength() > 0);
+ assertNull(result.getETag());
+ assertEquals(time - age,
+ DateUtils.parseDate(result.getLastModified()).getTime(), tolerance);
+ File file = new File(CacheManager.getCacheFileBaseDir().getPath(), result.getLocalPath());
+ assertTrue(file.exists());
+ assertNull(result.getLocation());
+ assertEquals("text/html", result.getMimeType());
+ assertNull(result.getOutputStream());
+ assertEquals(time + validity, result.getExpires(), tolerance);
+ assertEquals(HttpStatus.SC_OK, result.getHttpStatusCode());
+ assertNotNull(result.getEncoding());
- result.setEncoding("iso-8859-1");
- assertEquals("iso-8859-1", result.getEncoding());
+ result.setEncoding("iso-8859-1");
+ assertEquals("iso-8859-1", result.getEncoding());
- result.setInputStream(null);
- assertNull(result.getInputStream());
- }
+ result.setInputStream(null);
+ assertNull(result.getInputStream());
}
private void loadUrl(String url){