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)

ยืนยันว่าสถานะการเชื่อมต่อ 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)

แสดงผลเป็น "จริง" หากโมดูลได้รับการจัดการโดย 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)

ช่อง

pocPusher

public PocPusher pocPusher

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 ต้องแสดงผลสตริงที่ขึ้นต้นด้วยเคอร์เซอร์ เช่น "01234567" อนุญาตให้มีอักขระต่อท้ายได้ ยกเว้น [0-9a-fA-F] ในกรณีที่ดูเหมือนว่าเคอร์เซอร์จะมีช่องโหว่ ระบบจะแสดงข้อโต้แย้ง JUnit เนื่องจากเคอร์เนลพอยน์เตอร์สามารถแฮชได้ จึงมีความเป็นไปได้ที่พอยน์เตอร์ที่แฮชจะซ้อนทับในพื้นที่เคอร์เนลปกติ ระบบจะทดสอบอีกครั้งเพื่อให้ผลบวกลวงไม่มีนัยสำคัญทางสถิติ เมื่อเคอร์เนลพอยน์เตอร์ไม่เปลี่ยนแปลงหากไม่มีการรีบูต ให้ระบุอุปกรณ์ที่จะรีบูต

พารามิเตอร์
getPtrFunction Callable: ฟังก์ชันที่แสดงผลสตริงที่ขึ้นต้นด้วยเคอร์เซอร์

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)

ยืนยันว่าสถานะการเชื่อมต่อ 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)

แสดงผลเป็น "จริง" หากโมดูลได้รับการจัดการโดย 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