ความปลอดภัยTestCase
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
ผู้รับเหมาก่อสร้างสาธารณะ
ความปลอดภัยTestCase
public SecurityTestCase ()
วิธีการสาธารณะ
ยืนยันการแข่งขัน
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)
รันฟังก์ชันที่จัดเตรียมไว้ซึ่งรวบรวมสตริงเพื่อทดสอบการรั่วไหลของเคอร์เนลพอยน์เตอร์ การใช้งานฟังก์ชัน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 |
assertWifiเชื่อมต่อแล้ว
public void assertWifiConnected (ITestDevice device)
ยืนยันว่าสถานะการเชื่อมต่อ wifi เชื่อมต่ออยู่ เนื่องจาก STS สามารถรีบูทอุปกรณ์ได้ทันทีก่อนทำการทดสอบ จึงอาจไม่ได้เชื่อมต่อ wifi ก่อนทำการทดสอบ เราสำรวจ wifi จนกว่าเราจะหมดเวลาหรือมีการเชื่อมต่อ wifi
พารามิเตอร์ |
---|
device | ITestDevice : อุปกรณ์ที่จะรัน |
ถือว่าIsSupportedNfcDevice
public void assumeIsSupportedNfcDevice (ITestDevice device)
พารามิเตอร์ |
---|
device | ITestDevice |
buildMetricsReportLog
public static MetricsReportLog buildMetricsReportLog (ITestDevice device)
พารามิเตอร์ |
---|
device | ITestDevice |
การส่งคืน |
---|
MetricsReportLog | |
createWifiHelper
public WifiHelper createWifiHelper ()
ขว้าง |
---|
DeviceNotAvailableException | |
รับอาบี
public static IAbi getAbi (ITestDevice device)
พารามิเตอร์ |
---|
device | ITestDevice |
รับ BuildInfo
public static IBuildInfo getBuildInfo (ITestDevice device)
พารามิเตอร์ |
---|
device | ITestDevice |
รับPocPusher
public static PocPusher getPocPusher (ITestDevice device)
พารามิเตอร์ |
---|
device | ITestDevice |
รับชื่อการทดสอบ
public static String getTestName (ITestDevice device)
พารามิเตอร์ |
---|
device | ITestDevice |
โมดูล IsPlayManaged
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 ()
ตรวจสอบให้แน่ใจว่าโทรศัพท์ออนไลน์อยู่และตรวจสอบว่าอุปกรณ์ขัดข้องหรือไม่
อัพเดต KernelStartTime
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 |