/**
  * Wipes the device's external memory of test collateral from prior runs.
  *
  * @throws DeviceNotAvailableException If the device is unavailable or something happened while
  *     deleting files
  */
 private void preTestSetup() throws DeviceNotAvailableException {
   String extStore = mTestDevice.getMountPoint(IDevice.MNT_EXTERNAL_STORAGE);
   mUrlsFilePath = String.format("%s/%s", extStore, URLS_FILE_NAME);
   mStatusFilePath = String.format("%s/%s", extStore, STATUS_FILE_NAME);
   if (!mTestDevice.doesFileExist(mUrlsFilePath)) {
     throw new RuntimeException("missing URL list file at: " + mUrlsFilePath);
   }
   mTestDevice.executeShellCommand("rm " + mStatusFilePath);
 }
 /**
  * Helper method for iterating through popular_urls.txt and reporting back how many pages fail to
  * load.
  *
  * @param runner The {@link IRemoteAndroidTestRunner} for instrumentation
  * @param listener The {@link CollectingTestListener} of test results
  * @return Number of pages that failed to load
  */
 private int runStabilityTest(IRemoteAndroidTestRunner runner, CollectingTestListener listener)
     throws DeviceNotAvailableException {
   boolean exitConditionMet = false;
   int failureCounter = 0;
   while (!exitConditionMet) {
     mTestDevice.runInstrumentationTests(runner, listener);
     // if the status file exists, then the previous instrumentation has crashed
     if (!mTestDevice.doesFileExist(mStatusFilePath)) {
       exitConditionMet = true;
     } else {
       ++failureCounter;
     }
   }
   return failureCounter;
 }