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
.
סיכום
קבועים | |
---|---|
int |
TIMEOUT_DEFAULT
|
int |
TIMEOUT_NONDETERMINISTIC
|
שדות | |
---|---|
public
PocPusher |
pocPusher
|
public
TestName |
testName
|
קונסטרוקטורים גלויים לכולם | |
---|---|
SecurityTestCase()
|
שיטות ציבוריות | |
---|---|
void
|
assertMatches(String pattern, String input)
|
void
|
assertMatchesMultiLine(String pattern, String input)
|
void
|
assertNotKernelPointer(Callable<String> getPtrFunction, ITestDevice deviceToReboot)
הפעלת פונקציה שצוינה שמאגרת מחרוזת לבדיקה מפני דליפות של מצביע הליבה. |
void
|
assertNotMatches(String pattern, String input)
|
void
|
assertNotMatchesMultiLine(String pattern, String input)
|
void
|
assertWifiConnected(ITestDevice device)
טענת נכוֹנוּת (assertion) לכך שסטטוס החיבור ל-Wi-Fi הוא 'מחובר'. |
void
|
assumeIsSupportedNfcDevice(ITestDevice device)
|
static
MetricsReportLog
|
buildMetricsReportLog(ITestDevice device)
|
WifiHelper
|
createWifiHelper()
|
static
IAbi
|
getAbi(ITestDevice device)
|
static
IBuildInfo
|
getBuildInfo(ITestDevice device)
|
static
PocPusher
|
getPocPusher(ITestDevice device)
|
static
String
|
getTestName(ITestDevice device)
|
boolean
|
moduleIsPlayManaged(String modulePackageName)
הפונקציה מחזירה את הערך true אם המודול מנוהל על ידי Play. |
void
|
safeReboot()
|
void
|
setUp()
המערכת ממתינה שהמכשיר יהיה מחובר לאינטרנט, ומסמנת את זמן האתחול האחרון של המכשיר |
void
|
tearDown()
מוודאים שהטלפון מחובר לאינטרנט ובודקים אם המכשיר קרס |
void
|
updateKernelStartTime()
מאפשרת לבדיקה לעבור אם היא נקראת אחרי הפעלה מחדש מתוכננת. |
שיטות מוגנות | |
---|---|
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)
שדות
testName
public TestName testName
קונסטרוקטורים גלויים לכולם
SecurityTestCase
public SecurityTestCase ()
שיטות ציבוריות
assertMatches
public void assertMatches (String pattern, String input)
פרמטרים | |
---|---|
pattern |
String |
input |
String |
זריקות | |
---|---|
Exception |
assertMatchesMultiLine
public void assertMatchesMultiLine (String pattern, String input)
פרמטרים | |
---|---|
pattern |
String |
input |
String |
זריקות | |
---|---|
Exception |
assertNotKernelPointer
public void assertNotKernelPointer (Callable<String> getPtrFunction, ITestDevice deviceToReboot)
הפעלת פונקציה שצוינה שמאגרת מחרוזת לבדיקה מפני דליפות של מצביע הליבה. ההטמעה של הפונקציה getPtrFunction חייבת להחזיר מחרוזת שמתחילה ב-pointer. למשל: '01234567'. מותר להשתמש בתווים נלווים, מלבד [0-9a-fA-F]. אם נראה שהעכבר חשוף, תושלח טענת נכוֹנוּת (assert) של JUnit. מכיוון שאפשר לבצע גיבוב של מצביעים בליבה, יש אפשרות שהצבען המגובב יחפיף למרחב הליבה הרגיל. הבדיקה מופעלת מחדש כדי להפוך תוצאות חיוביות שגויות ללא משמעות סטטיסטית. אם מיקומי ה-kernel לא משתנים בלי הפעלה מחדש, צריך לספק מכשיר להפעלה מחדש.
פרמטרים | |
---|---|
getPtrFunction |
Callable : פונקציה שמחזירה מחרוזת שמתחילה ב-pointer |
deviceToReboot |
ITestDevice : הפעלה מחדש של המכשיר כשהצבענים של הליבה לא ישתנו
|
זריקות | |
---|---|
Exception |
assertNotMatches
public void assertNotMatches (String pattern, String input)
פרמטרים | |
---|---|
pattern |
String |
input |
String |
זריקות | |
---|---|
Exception |
assertNotMatchesMultiLine
public void assertNotMatchesMultiLine (String pattern, String input)
פרמטרים | |
---|---|
pattern |
String |
input |
String |
זריקות | |
---|---|
Exception |
assertWifiConnected
public void assertWifiConnected (ITestDevice device)
טענת נכוֹנוּת (assertion) לכך שסטטוס החיבור ל-Wi-Fi הוא 'מחובר'. מאחר ש-STS יכול להפעיל מחדש מכשיר מיד לפני הפעלת בדיקה, יכול להיות שה-Wi-Fi לא יתחבר לפני שהבדיקה תופעל. אנחנו בודקים את ה-Wi-Fi עד שחולף זמן הקצוב לתפוגה או עד שמתבצע חיבור ל-Wi-Fi.
פרמטרים | |
---|---|
device |
ITestDevice : המכשיר שבו רוצים להריץ את הסקריפט
|
זריקות | |
---|---|
Exception |
assumeIsSupportedNfcDevice
public void assumeIsSupportedNfcDevice (ITestDevice device)
פרמטרים | |
---|---|
device |
ITestDevice |
זריקות | |
---|---|
Exception |
buildMetricsReportLog
public static MetricsReportLog buildMetricsReportLog (ITestDevice device)
פרמטרים | |
---|---|
device |
ITestDevice |
החזרות | |
---|---|
MetricsReportLog |
createWifiHelper
public WifiHelper createWifiHelper ()
החזרות | |
---|---|
WifiHelper |
זריקות | |
---|---|
DeviceNotAvailableException |
getAbi
public static IAbi getAbi (ITestDevice device)
פרמטרים | |
---|---|
device |
ITestDevice |
החזרות | |
---|---|
IAbi |
getBuildInfo
public static IBuildInfo getBuildInfo (ITestDevice device)
פרמטרים | |
---|---|
device |
ITestDevice |
החזרות | |
---|---|
IBuildInfo |
getPocPusher
public static PocPusher getPocPusher (ITestDevice device)
פרמטרים | |
---|---|
device |
ITestDevice |
החזרות | |
---|---|
PocPusher |
getTestName
public static String getTestName (ITestDevice device)
פרמטרים | |
---|---|
device |
ITestDevice |
החזרות | |
---|---|
String |
moduleIsPlayManaged
public boolean moduleIsPlayManaged (String modulePackageName)
הפונקציה מחזירה את הערך true אם המודול מנוהל על ידי Play.
דוגמה לדילוג על בדיקה על סמך מודולים ראשיים:
@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 |
החזרות | |
---|---|
boolean |
זריקות | |
---|---|
Exception |
safeReboot
public void safeReboot ()
זריקות | |
---|---|
DeviceNotAvailableException |
setUp
public void setUp ()
המערכת ממתינה שהמכשיר יהיה מחובר לאינטרנט, ומסמנת את זמן האתחול האחרון של המכשיר
זריקות | |
---|---|
Exception |
tearDown
public void tearDown ()
מוודאים שהטלפון מחובר לאינטרנט ובודקים אם המכשיר קרס
זריקות | |
---|---|
Exception |
updateKernelStartTime
public void updateKernelStartTime ()
מאפשרת לבדיקה לעבור אם היא נקראת אחרי הפעלה מחדש מתוכננת.
זריקות | |
---|---|
DeviceNotAvailableException |
שיטות מוגנות
containsDriver
protected boolean containsDriver (ITestDevice device, String driver, boolean checkReadable)
איך בודקים אם מנהל התקן נמצא במכונה.
פרמטרים | |
---|---|
device |
ITestDevice |
driver |
String |
checkReadable |
boolean |
החזרות | |
---|---|
boolean |
זריקות | |
---|---|
Exception |
containsDriver
protected boolean containsDriver (ITestDevice device, String driver)
בודקים אם מנהל ההתקן קיים ואפשר לקרוא אותו.
פרמטרים | |
---|---|
device |
ITestDevice |
driver |
String |
החזרות | |
---|---|
boolean |
זריקות | |
---|---|
Exception |