SecurityTestCase
public class SecurityTestCase
extends StsExtraBusinessLogicHostTestBase
java.lang.Object |
↳ | com.android.tradefed.testtype.junit4.BaseHostJUnit4Test |
| ↳ | com.android.compatibility.common.tradefed.testtype.BusinessLogicHostTestBase |
| | ↳ | com.android.compatibility.common.tradefed.testtype.ExtraBusinessLogicHostTestBase |
| | | ↳ | com.android.sts.common.tradefed.testtype.StsExtraBusinessLogicHostTestBase |
| | | | ↳ | com.android.sts.common.tradefed.testtype.SecurityTestCase |
الفئات الفرعية المباشرة المعروفة |
فئة الاختبار الأساسية لجميع اختبارات STS.
استخدم RootSecurityTestCase
أو NonRootSecurityTestCase
بدلاً من ذلك.
ملخص
الطرق المحمية |
---|
boolean | containsDriver (ITestDevice device, String driver, boolean checkReadable) تحقق من وجود برنامج تشغيل على الجهاز. |
boolean | containsDriver (ITestDevice device, String driver) تحقق مما إذا كان السائق موجودًا ومقروءًا. |
الثوابت
TIMEOUT_DEFAULT
protected static final int TIMEOUT_DEFAULT
قيمة ثابتة: 60 (0x0000003c)
TIMEOUT_NONDETERMINISTIC
public static final int TIMEOUT_NONDETERMINISTIC
القيمة الثابتة: 315 (0x0000013b)
مجالات
اسم الاختبار
public TestName testName
المنشأت العامة
SecurityTestCase
public SecurityTestCase ()
الأساليب العامة
assertMatches
public void assertMatches (String pattern,
String input)
المعلمات |
---|
pattern | String |
input | String |
assert المباريات
public void assertMatchesMultiLine (String pattern,
String input)
المعلمات |
---|
pattern | String |
input | String |
تأكيد NotKernelPointer
public void assertNotKernelPointer (Callable<String> getPtrFunction,
ITestDevice deviceToReboot)
يقوم بتشغيل دالة متوفرة تقوم بتجميع سلسلة للاختبار ضد تسريبات مؤشر kernel. يجب أن يقوم تطبيق دالة getPtrFunction بإرجاع سلسلة تبدأ بالمؤشر. على سبيل المثال "01234567". الأحرف اللاحقة مسموح بها باستثناء [0-9a-fA-F]. في حالة ظهور المؤشر على أنه ضعيف ، يتم إلقاء تأكيد JUnit. نظرًا لأنه يمكن تجزئة مؤشرات kernel ، فهناك احتمال أن يتداخل المؤشر المجزأ في مساحة kernel العادية. يتم إعادة إجراء الاختبار لجعل النتائج الإيجابية الزائفة غير ذات دلالة إحصائية. عندما لا تتغير مؤشرات kernel دون إعادة التشغيل ، قم بتوفير جهاز لإعادة التشغيل.
المعلمات |
---|
getPtrFunction | Callable : دالة تقوم بإرجاع سلسلة تبدأ بمؤشر |
deviceToReboot | ITestDevice : جهاز يتم إعادة تشغيله عندما لا تتغير مؤشرات kernel |
assertNotMatches
public void assertNotMatches (String pattern,
String input)
المعلمات |
---|
pattern | String |
input | String |
assertNotMatchesMultiLine
public void assertNotMatchesMultiLine (String pattern,
String input)
المعلمات |
---|
pattern | String |
input | String |
assertWifi متصل
public void assertWifiConnected (ITestDevice device)
يؤكد أن حالة اتصال wifi متصلة. نظرًا لأنه يمكن لـ STS إعادة تشغيل الجهاز فورًا قبل إجراء الاختبار ، فقد لا يتم توصيل wifi قبل إجراء الاختبار. نقوم باستطلاع شبكة wifi حتى ننتهي من المهلة أو يتم توصيل wifi.
المعلمات |
---|
device | ITestDevice : الجهاز المراد تشغيله |
افتراضيسوبورتيدن إفكجهاز
public void assumeIsSupportedNfcDevice (ITestDevice device)
المعلمات |
---|
device | ITestDevice |
buildMetricsReportLog
public static MetricsReportLog buildMetricsReportLog (ITestDevice device)
المعلمات |
---|
device | ITestDevice |
إنشاء WiFiHelper
public WifiHelper createWifiHelper ()
رميات |
---|
DeviceNotAvailableException | |
getAbi
public static IAbi getAbi (ITestDevice device)
المعلمات |
---|
device | ITestDevice |
getBuildInfo
public static IBuildInfo getBuildInfo (ITestDevice device)
المعلمات |
---|
device | ITestDevice |
getPocPusher
public static PocPusher getPocPusher (ITestDevice device)
المعلمات |
---|
device | ITestDevice |
getTestName
public static String getTestName (ITestDevice device)
المعلمات |
---|
device | ITestDevice |
moduleIsPlayManaged
public boolean moduleIsPlayManaged (String modulePackageName)
العودة صحيحًا إذا تم تشغيل الوحدة النمطية.
مثال لتخطي اختبار بناءً على الوحدات النمطية الرئيسية:
@Test
public void testPocCVE_1234_5678() throws Exception {
// This will skip the test if MODULE_METADATA mainline module is play managed.
assumeFalse(moduleIsPlayManaged("com.google.android.captiveportallogin"));
// Do testing...
}
المعلمات |
---|
modulePackageName | String |
آمن
public void safeReboot ()
رميات |
---|
DeviceNotAvailableException | |
اقامة
public void setUp ()
في انتظار اتصال الجهاز بالإنترنت ، يمثل وقت تشغيل الجهاز الأحدث
تمزيق
public void tearDown ()
تأكد من اتصال الهاتف بالإنترنت والتحقق مما إذا كان الجهاز قد تعطل
updateKernelStartTime
public void updateKernelStartTime ()
للسماح باجتياز الاختبار إذا تم استدعاؤه بعد إعادة التشغيل المخطط لها.
رميات |
---|
DeviceNotAvailableException | |
الطرق المحمية
يحتوي على سائق
protected boolean containsDriver (ITestDevice device,
String driver,
boolean checkReadable)
تحقق من وجود برنامج تشغيل على الجهاز.
المعلمات |
---|
device | ITestDevice |
driver | String |
checkReadable | boolean |
يحتوي على سائق
protected boolean containsDriver (ITestDevice device,
String driver)
تحقق مما إذا كان السائق موجودًا ومقروءًا.
المعلمات |
---|
device | ITestDevice |
driver | String |