Removed removeAllIcons from tests.
Bug 6345787
WebIconDatabase removes icons on a thread other than the
calling thread. After calling removeAllIcons, we must wait for
that thread to complete or it may not have removed the icons
when the next call is made. These tests do not need to have
the icons removed.
Change-Id: Iacf555b8ae3f97dbbf0dfbcd239b3c0f91604e2c
diff --git a/tests/tests/webkit/src/android/webkit/cts/WebChromeClientTest.java b/tests/tests/webkit/src/android/webkit/cts/WebChromeClientTest.java
index 493ebe4..515c2d5 100644
--- a/tests/tests/webkit/src/android/webkit/cts/WebChromeClientTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/WebChromeClientTest.java
@@ -98,16 +98,16 @@
mOnUiThread.setWebChromeClient(webChromeClient);
runTestOnUiThread(new Runnable() {
-
@Override
public void run() {
// getInstance must run on the UI thread
- WebIconDatabase mIconDb = WebIconDatabase.getInstance();
+ mIconDb = WebIconDatabase.getInstance();
String dbPath = getActivity().getFilesDir().toString() + "/icons";
mIconDb.open(dbPath);
- mIconDb.removeAllIcons();
}
});
+ getInstrumentation().waitForIdleSync();
+ Thread.sleep(100); // Wait for open to be received on the icon db thread.
assertFalse(webChromeClient.hadOnReceivedIcon());
diff --git a/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java b/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java
index 9fb1c46..666c885 100644
--- a/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java
@@ -195,8 +195,18 @@
assertEquals(TestHtmlConstants.WEBPAGE_NOT_AVAILABLE_TITLE, mOnUiThread.getTitle());
}
- public void testAccessCacheMode() throws Exception {
- WebIconDatabase.getInstance().removeAllIcons();
+ public void testAccessCacheMode() throws Throwable {
+ runTestOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ // getInstance must run on the UI thread
+ WebIconDatabase iconDb = WebIconDatabase.getInstance();
+ String dbPath = getActivity().getFilesDir().toString() + "/icons";
+ iconDb.open(dbPath);
+ }
+ });
+ getInstrumentation().waitForIdleSync();
+ Thread.sleep(100); // Wait for open to be received on the icon db thread.
assertEquals(WebSettings.LOAD_DEFAULT, mSettings.getCacheMode());
mSettings.setCacheMode(WebSettings.LOAD_NORMAL);