/** {@inheritDoc} */
 @Override
 public Collection<VersionedFile> getFiles() {
   Collection<VersionedFile> combinedFiles = new LinkedList<VersionedFile>();
   combinedFiles.addAll(mBaselineBuild.getFiles());
   combinedFiles.addAll(mOtaBuild.getFiles());
   return combinedFiles;
 }
 /** Test {@link DeviceSetup#setUp(ITestDevice, IBuildInfo)} when build does not boot */
 public void testSetup_buildError() throws Exception {
   mMockDevice.setRecoveryMode(RecoveryMode.ONLINE);
   mMockFlasher.overrideDeviceOptions(mMockDevice);
   mMockFlasher.setForceSystemFlash(false);
   mMockFlasher.setDataWipeSkipList(Arrays.asList(new String[] {}));
   mMockFlasher.flash(mMockDevice, mMockBuildInfo);
   mMockDevice.waitForDeviceOnline();
   EasyMock.expect(mMockDevice.enableAdbRoot()).andStubReturn(Boolean.TRUE);
   mMockDevice.setDate(null);
   EasyMock.expect(mMockDevice.getBuildId()).andReturn(mMockBuildInfo.getBuildId());
   EasyMock.expect(mMockDevice.getBuildFlavor()).andReturn(mMockBuildInfo.getBuildFlavor());
   EasyMock.expect(mMockDevice.isEncryptionSupported()).andStubReturn(Boolean.TRUE);
   EasyMock.expect(mMockDevice.isDeviceEncrypted()).andStubReturn(Boolean.FALSE);
   mMockDevice.clearLogcat();
   mMockDevice.waitForDeviceAvailable(EasyMock.anyLong());
   EasyMock.expectLastCall().andThrow(new DeviceUnresponsiveException("foo"));
   mMockDevice.setRecoveryMode(RecoveryMode.AVAILABLE);
   EasyMock.replay(mMockFlasher, mMockDevice);
   try {
     mDeviceFlashPreparer.setUp(mMockDevice, mMockBuildInfo);
     fail("DeviceFlashPreparerTest not thrown");
   } catch (BuildError e) {
     // expected; use the general version to make absolutely sure that
     // DeviceFailedToBootError properly masquerades as a BuildError.
     assertTrue(e instanceof DeviceFailedToBootError);
   }
   EasyMock.verify(mMockFlasher, mMockDevice);
 }
 /** {@inheritDoc} */
 @Override
 public IBuildInfo clone() {
   OtaDeviceBuildInfo clone = new OtaDeviceBuildInfo();
   if (mBaselineBuild != null) {
     clone.setBaselineBuild((IDeviceBuildInfo) mBaselineBuild.clone());
   }
   if (mOtaBuild != null) {
     clone.setOtaBuild((IDeviceBuildInfo) mOtaBuild.clone());
   }
   return clone;
 }
  /** {@inheritDoc} */
  @Override
  protected void setUp() throws Exception {
    super.setUp();
    mMockFlasher = EasyMock.createMock(IDeviceFlasher.class);
    mMockDevice = EasyMock.createMock(ITestDevice.class);
    EasyMock.expect(mMockDevice.getSerialNumber()).andReturn("foo").anyTimes();
    mMockBuildInfo = new DeviceBuildInfo("0", "", "");
    mMockBuildInfo.setBuildFlavor("flavor");
    mDeviceFlashPreparer =
        new DeviceFlashPreparer() {
          @Override
          protected IDeviceFlasher createFlasher(ITestDevice device) {
            return mMockFlasher;
          }

          @Override
          int getDeviceBootPollTimeMs() {
            return 100;
          }
        };
    mDeviceFlashPreparer.setDeviceBootTime(100);
    // expect this call
    mMockFlasher.setUserDataFlashOption(UserDataFlashOption.FLASH);
    mTmpDir = FileUtil.createTempDir("tmp");
  }
 /** Set EasyMock expectations for a normal setup call */
 private void doSetupExpectations() throws TargetSetupError, DeviceNotAvailableException {
   mMockDevice.setRecoveryMode(RecoveryMode.ONLINE);
   mMockFlasher.overrideDeviceOptions(mMockDevice);
   mMockFlasher.setForceSystemFlash(false);
   mMockFlasher.setDataWipeSkipList(Arrays.asList(new String[] {}));
   mMockFlasher.flash(mMockDevice, mMockBuildInfo);
   mMockDevice.waitForDeviceOnline();
   EasyMock.expect(mMockDevice.enableAdbRoot()).andStubReturn(Boolean.TRUE);
   mMockDevice.setDate(null);
   EasyMock.expect(mMockDevice.getBuildId()).andReturn(mMockBuildInfo.getBuildId());
   EasyMock.expect(mMockDevice.getBuildFlavor()).andReturn(mMockBuildInfo.getBuildFlavor());
   EasyMock.expect(mMockDevice.isEncryptionSupported()).andStubReturn(Boolean.TRUE);
   EasyMock.expect(mMockDevice.isDeviceEncrypted()).andStubReturn(Boolean.FALSE);
   mMockDevice.clearLogcat();
   mMockDevice.waitForDeviceAvailable(EasyMock.anyLong());
   mMockDevice.setRecoveryMode(RecoveryMode.AVAILABLE);
   mMockDevice.postBootSetup();
 }
 /** {@inheritDoc} */
 @Override
 public File getRamdiskFile() {
   return mBaselineBuild.getRamdiskFile();
 }
 /** {@inheritDoc} */
 @Override
 public void setMkbootimgFile(File mkbootimg, String version) {
   mBaselineBuild.setMkbootimgFile(mkbootimg, version);
 }
 /** {@inheritDoc} */
 @Override
 public String getBuildBranch() {
   return mBaselineBuild.getBuildBranch();
 }
 /** {@inheritDoc} */
 @Override
 public String getDeviceSerial() {
   return mBaselineBuild.getDeviceSerial();
 }
 /** {@inheritDoc} */
 @Override
 public void setTestsDir(File testsZipFile, String version) {
   mBaselineBuild.setTestsDir(testsZipFile, version);
 }
 /** {@inheritDoc} */
 @Override
 public void cleanUp() {
   mBaselineBuild.cleanUp();
   mOtaBuild.cleanUp();
 }
 /** {@inheritDoc} */
 @Override
 public void setBootloaderImageFile(File bootloaderImgFile, String version) {
   mBaselineBuild.setBootloaderImageFile(bootloaderImgFile, version);
 }
 /** {@inheritDoc} */
 @Override
 public String getBootloaderVersion() {
   return mBaselineBuild.getBootloaderVersion();
 }
 /** {@inheritDoc} */
 @Override
 public File getBootloaderImageFile() {
   return mBaselineBuild.getBootloaderImageFile();
 }
 /** {@inheritDoc} */
 @Override
 public void setBasebandImage(File basebandFile, String version) {
   mBaselineBuild.setBasebandImage(basebandFile, version);
 }
 /** {@inheritDoc} */
 @Override
 public String getBasebandVersion() {
   return mBaselineBuild.getBasebandVersion();
 }
 /** {@inheritDoc} */
 @Override
 public File getBasebandImageFile() {
   return mBaselineBuild.getBasebandImageFile();
 }
 /** {@inheritDoc} */
 @Override
 public String getRamdiskVersion() {
   return mBaselineBuild.getRamdiskVersion();
 }
 /** {@inheritDoc} */
 @Override
 public void setRamdiskFile(File ramdisk, String version) {
   mBaselineBuild.setRamdiskFile(ramdisk, version);
 }
 /** {@inheritDoc} */
 @Override
 public String getBuildTargetName() {
   return mBaselineBuild.getBuildTargetName();
 }
 /** {@inheritDoc} */
 @Override
 public File getOtaPackageFile() {
   return mBaselineBuild.getOtaPackageFile();
 }
 /** {@inheritDoc} */
 @Override
 public String getTestsDirVersion() {
   return mBaselineBuild.getTestsDirVersion();
 }
 /** {@inheritDoc} */
 @Override
 public String getTestTag() {
   return mBaselineBuild.getTestTag();
 }
 /** {@inheritDoc} */
 @Override
 public String getOtaPackageVersion() {
   return mBaselineBuild.getOtaPackageVersion();
 }
 /** {@inheritDoc} */
 @Override
 public String getBuildFlavor() {
   return mBaselineBuild.getBuildFlavor();
 }
 /** {@inheritDoc} */
 @Override
 public void setOtaPackageFile(File otaFile, String version) {
   mBaselineBuild.setOtaPackageFile(otaFile, version);
 }
 /** {@inheritDoc} */
 @Override
 public void setBuildFlavor(String buildFlavor) {
   mBaselineBuild.setBuildFlavor(buildFlavor);
 }
 /** {@inheritDoc} */
 @Override
 public File getMkbootimgFile() {
   return mBaselineBuild.getMkbootimgFile();
 }
 /** {@inheritDoc} */
 @Override
 public void setBuildBranch(String branch) {
   mBaselineBuild.setBuildBranch(branch);
 }
 /** {@inheritDoc} */
 @Override
 public String getMkbootimgVersion() {
   return mBaselineBuild.getMkbootimgVersion();
 }