summaryrefslogtreecommitdiffstats
path: root/tests/BrowserPowerTest
diff options
context:
space:
mode:
authorYu Shan Emily Lau <yslau@google.com>2009-09-20 21:21:18 -0700
committerYu Shan Emily Lau <yslau@google.com>2009-09-21 13:48:24 -0700
commitd2ef9e31e6f2492d79062f776a7138ed9235172b (patch)
tree9a38bcd2ddde8a1cce85a65e02d40e3006010edd /tests/BrowserPowerTest
parent58992eac8373ba7260d99dd832a6fc9e3d164460 (diff)
downloadframeworks_base-d2ef9e31e6f2492d79062f776a7138ed9235172b.zip
frameworks_base-d2ef9e31e6f2492d79062f776a7138ed9235172b.tar.gz
frameworks_base-d2ef9e31e6f2492d79062f776a7138ed9235172b.tar.bz2
Added a workaround to clear the browser cache.
modified: BrowserPowerTest/src/com/android/browserpowertest/PowerMeasurement.java
Diffstat (limited to 'tests/BrowserPowerTest')
-rw-r--r--tests/BrowserPowerTest/src/com/android/browserpowertest/PowerMeasurement.java21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/BrowserPowerTest/src/com/android/browserpowertest/PowerMeasurement.java b/tests/BrowserPowerTest/src/com/android/browserpowertest/PowerMeasurement.java
index 74ac865..861e37b 100644
--- a/tests/BrowserPowerTest/src/com/android/browserpowertest/PowerMeasurement.java
+++ b/tests/BrowserPowerTest/src/com/android/browserpowertest/PowerMeasurement.java
@@ -12,7 +12,8 @@ public class PowerMeasurement extends ActivityInstrumentationTestCase2<PowerTest
private static final String LOGTAG = "PowerMeasurement";
private static final String PKG_NAME = "com.android.browserpowertest";
- private static final String TESTING_URL = "http://www.espn.com";
+ private static final String TESTING_URL =
+ "http://75.17.48.204:10088/nyt/index.html";
private static final int TIME_OUT = 2 * 60 * 1000;
private static final int DELAY = 0;
@@ -46,6 +47,24 @@ public class PowerMeasurement extends ActivityInstrumentationTestCase2<PowerTest
pageErrorFlag);
Log.v(LOGTAG, "Page is loaded in " + activity.getPageLoadTime() + " ms.");
+ // Force to clean up the cache dir so that it get back to the clean
+ // state
+ Runtime fileRemoval = Runtime.getRuntime();
+ String cmdBecomeSu = "su";
+ boolean clearCacheSuccess = false;
+ try{
+ Process runsum = fileRemoval.exec(cmdBecomeSu);
+ int exitVal = runsum.waitFor();
+ String rmfile = "rm -r /data/data/com.android.browserpowertest/cache";
+ Process removal = fileRemoval.exec(rmfile);
+ exitVal = removal.waitFor();
+ if (exitVal == 0) {
+ clearCacheSuccess = true;
+ }
+ } catch ( Exception e){
+ assertTrue("Fails to clear the cahche", false);
+ }
+ assertTrue("Fails to clear the cahche", clearCacheSuccess);
activity.finish();
}
}