diff options
author | Jinhui Wang <jinhuiw@google.com> | 2016-07-04 15:27:00 -0700 |
---|---|---|
committer | Jinhui Wang <jinhuiw@google.com> | 2016-07-04 15:38:00 -0700 |
commit | 2959481aac7e62edbe9ab6af9b0531f489288974 (patch) | |
tree | 32830368199baa539504bc62de6ef1ed0502612e | |
parent | 3346be9f2def7b061fb2263903bc0acd7a94fe2d (diff) | |
download | AfwTestHarness-2959481aac7e62edbe9ab6af9b0531f489288974.tar.gz |
Wrap AfwTestEncryptDevice to xml config file
Change-Id: I8bd1738e03d953ce26f6cf2d960560482cc48767
-rw-r--r-- | AfwTestCaseList.mk | 3 | ||||
-rw-r--r-- | tests/SuwDoProvisioning/AndroidTest.xml | 2 | ||||
-rw-r--r-- | tests/SuwPoProvisioning/AndroidTest.xml | 2 | ||||
-rw-r--r-- | tests/TestPlanDef.xml | 1 | ||||
-rw-r--r-- | tools/tradefed-host/res/config/afw-test-encrypt-device.xml | 19 | ||||
-rw-r--r-- | tools/tradefed-host/src/com/android/afwtest/tradefed/targetprep/AfwTestEncryptDevice.java | 24 |
6 files changed, 46 insertions, 5 deletions
diff --git a/AfwTestCaseList.mk b/AfwTestCaseList.mk index 611b4d6..adae60f 100644 --- a/AfwTestCaseList.mk +++ b/AfwTestCaseList.mk @@ -18,7 +18,8 @@ afw_th_test_packages := \ AfwTestNfcProvisioningTestCases \ AfwTestNonSuwPoProvisioningTestCases \ - AfwTestSuwDoProvisioningTestCases + AfwTestSuwDoProvisioningTestCases \ + AfwTestSuwPoProvisioningTestCases # Support packages afw_th_support_packages := \ diff --git a/tests/SuwDoProvisioning/AndroidTest.xml b/tests/SuwDoProvisioning/AndroidTest.xml index cf940e8..a94ecf3 100644 --- a/tests/SuwDoProvisioning/AndroidTest.xml +++ b/tests/SuwDoProvisioning/AndroidTest.xml @@ -26,7 +26,7 @@ <include name="afw-test-common"/> <!-- Encrypt Device --> - <target_preparer class="com.android.afwtest.tradefed.targetprep.AfwTestEncryptDevice"/> + <include name="afw-test-encrypt-device"/> <!-- Connect wifi --> <include name="afw-test-wifi"/> diff --git a/tests/SuwPoProvisioning/AndroidTest.xml b/tests/SuwPoProvisioning/AndroidTest.xml index d8283cb..7a6a5f4 100644 --- a/tests/SuwPoProvisioning/AndroidTest.xml +++ b/tests/SuwPoProvisioning/AndroidTest.xml @@ -26,7 +26,7 @@ <include name="afw-test-common"/> <!-- Encrypt Device --> - <target_preparer class="com.android.afwtest.tradefed.targetprep.AfwTestEncryptDevice"/> + <include name="afw-test-encrypt-device"/> <!-- Connect wifi --> <include name="afw-test-wifi"/> diff --git a/tests/TestPlanDef.xml b/tests/TestPlanDef.xml index b4bc3c9..d064d1f 100644 --- a/tests/TestPlanDef.xml +++ b/tests/TestPlanDef.xml @@ -18,6 +18,7 @@ <plan name="afw-userdebug-build"> <package name="AfwTestNfcProvisioningTestCases"/> <package name="AfwTestSuwDoProvisioningTestCases"/> + <package name="AfwTestSuwPoProvisioningTestCases"/> </plan> <!-- For user build--> diff --git a/tools/tradefed-host/res/config/afw-test-encrypt-device.xml b/tools/tradefed-host/res/config/afw-test-encrypt-device.xml new file mode 100644 index 0000000..f6a8d9a --- /dev/null +++ b/tools/tradefed-host/res/config/afw-test-encrypt-device.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2016 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<configuration description="Encrypt device"> + <target_preparer class="com.android.afwtest.tradefed.targetprep.AfwTestEncryptDevice"/> +</configuration> diff --git a/tools/tradefed-host/src/com/android/afwtest/tradefed/targetprep/AfwTestEncryptDevice.java b/tools/tradefed-host/src/com/android/afwtest/tradefed/targetprep/AfwTestEncryptDevice.java index da66069..a060caa 100644 --- a/tools/tradefed-host/src/com/android/afwtest/tradefed/targetprep/AfwTestEncryptDevice.java +++ b/tools/tradefed-host/src/com/android/afwtest/tradefed/targetprep/AfwTestEncryptDevice.java @@ -60,7 +60,7 @@ public class AfwTestEncryptDevice extends AfwTestTargetPreparer implements ITarg CLog.i(String.format("Encrypting device %s: #%d", device.getSerialNumber(), i+1)); // Exit from loop if the device is encrypted successfully - if (device.encryptDevice(mInplace)) { + if (encryptDevice(device)) { break; } @@ -75,7 +75,27 @@ public class AfwTestEncryptDevice extends AfwTestTargetPreparer implements ITarg } device.waitForDeviceAvailable(TimeUnit.SECONDS.toMillis(mTimeoutSecs) * getTimeoutSize()); - CLog.i(String.format("Device %s is encrypted successfully", device.getSerialNumber())); + + postDeviceEncryption(device); + } + + /** + * Encrypts the device. + * + * @param device test device + * @return {@code true} if device was encrypted successfully; {@code false} otherwise + */ + protected boolean encryptDevice(ITestDevice device) throws DeviceNotAvailableException { + return device.encryptDevice(mInplace); + } + + /** + * Actions after encryption. + * + * @param device test device + */ + protected void postDeviceEncryption(ITestDevice device) throws DeviceNotAvailableException { + // By default do nothing. } } |