Enable and fix testAccessAllowFileAccess test. Do not merge.

Cherry pick of  I3de8ebfc74a8644800d5001f281d8493259ee418

Bug: 5773763
Change-Id: I97e2ecc1db4fabf3387a271b3d51ba41ae2c4ed6
diff --git a/tests/tests/webkit/src/android/webkit/cts/TestHtmlConstants.java b/tests/tests/webkit/src/android/webkit/cts/TestHtmlConstants.java
index b2bdfc8..a31e0c04 100644
--- a/tests/tests/webkit/src/android/webkit/cts/TestHtmlConstants.java
+++ b/tests/tests/webkit/src/android/webkit/cts/TestHtmlConstants.java
@@ -56,6 +56,12 @@
 
     public static final String EXT_WEB_URL1 = "http://www.example.com/";
 
+    public static final String LOCAL_FILESYSTEM_URL = "file:///etc/hosts";
+
+    // Must match the title of the page at
+    // android/frameworks/base/core/res/res/raw/loaderror.html
+    public static final String WEBPAGE_NOT_AVAILABLE_TITLE = "Webpage not available";
+
     public static final String getFileUrl(String assetName) {
         if (assetName.contains(":") || assetName.startsWith("/")) {
             throw new IllegalArgumentException();
diff --git a/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java b/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java
index 639f795..05e668b 100644
--- a/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java
@@ -214,7 +214,6 @@
             args = {boolean.class}
         )
     })
-    @ToBeFixed(explanation = "Cannot block file access using setAllowFileAccess(false)")
     public void testAccessAllowFileAccess() {
         assertTrue(mSettings.getAllowFileAccess());
 
@@ -225,11 +224,15 @@
         fileUrl = TestHtmlConstants.getFileUrl(TestHtmlConstants.BR_TAG_URL);
         mSettings.setAllowFileAccess(false);
         assertFalse(mSettings.getAllowFileAccess());
+
         loadUrl(fileUrl);
-        // direct file:// access still works with access disabled
+        // android_asset URLs should still be loaded when even with file access
+        // disabled.
         assertEquals(TestHtmlConstants.BR_TAG_TITLE, mWebView.getTitle());
 
-        // ToBeFixed: How does this API prevent file access?
+        // Files on the file system should not be loaded.
+        loadUrl(TestHtmlConstants.LOCAL_FILESYSTEM_URL);
+        assertEquals(TestHtmlConstants.WEBPAGE_NOT_AVAILABLE_TITLE, mWebView.getTitle());
     }
 
     @TestTargets({