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 |
assertMatchesMultiLine
public void assertMatchesMultiLine (String pattern,
String input)
פרמטרים |
---|
pattern | String |
input | String |
assertNotKernelPointer
public void assertNotKernelPointer (Callable<String> getPtrFunction,
ITestDevice deviceToReboot)
מפעיל פונקציה מסופקת שאוספת String כדי לבדוק נגד דליפות מצביע ליבה. יישום הפונקציה getPtrFunction חייב להחזיר מחרוזת שמתחילה עם המצביע. כלומר "01234567". תווים נגררים מותרים למעט [0-9a-fA-F]. במקרה שהמצביע נראה פגיע, נזרק טענה של JUnit. מכיוון שניתן לגיבוב מצביעי ליבה, ישנה אפשרות שהמצביע הגיבוב חופף למרחב הקרנל הרגיל. הבדיקה חוזרת על מנת להפוך תוצאות חיוביות כוזבות לבלתי מובהקות סטטיסטית. כאשר מצביעי הליבה לא ישתנו ללא אתחול מחדש, ספק התקן לאתחול מחדש.
פרמטרים |
---|
getPtrFunction | ניתן Callable : פונקציה שמחזירה מחרוזת שמתחילה במצביע |
deviceToReboot | ITestDevice : מכשיר לאתחל כאשר מצביעי הליבה לא ישתנו |
assertNotMatches
public void assertNotMatches (String pattern,
String input)
פרמטרים |
---|
pattern | String |
input | String |
assertNotMatchesMultiLine
public void assertNotMatchesMultiLine (String pattern,
String input)
פרמטרים |
---|
pattern | String |
input | String |
assertWifiConnected
public void assertWifiConnected (ITestDevice device)
טוען שמצב חיבור ה-WiFi מחובר. מכיוון ש-STS יכול לאתחל מכשיר מיד לפני הפעלת בדיקה, ייתכן שה- wifi לא יהיה מחובר לפני שהבדיקה רצה. אנו מסקרים את ה-wifi עד שנגיע לפסק זמן או שה-wifi מחובר.
פרמטרים |
---|
device | ITestDevice : מכשיר להפעלה |
assumeIsSupportedNfcDevice
public void assumeIsSupportedNfcDevice (ITestDevice device)
פרמטרים |
---|
device | ITestDevice |
buildMetricsReportLog
public static MetricsReportLog buildMetricsReportLog (ITestDevice device)
פרמטרים |
---|
device | ITestDevice |
createWifiHelper
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)
החזר true אם מודול מנוהל משחק.
דוגמה לדילוג על מבחן המבוסס על מודולים מרכזיים:
@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 |