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


Class pengujian dasar untuk semua pengujian STS.

Sebagai gantinya, gunakan RootSecurityTestCase atau NonRootSecurityTestCase.

Ringkasan

Konstanta

int TIMEOUT_DEFAULT

int TIMEOUT_NONDETERMINISTIC

Kolom

public PocPusher pocPusher

public TestName testName

Konstruktor publik

SecurityTestCase()

Metode publik

void assertMatches(String pattern, String input)
void assertMatchesMultiLine(String pattern, String input)
void assertNotKernelPointer(Callable<String> getPtrFunction, ITestDevice deviceToReboot)

Menjalankan fungsi yang disediakan yang mengumpulkan String untuk diuji terhadap kebocoran pointer kernel.

void assertNotMatches(String pattern, String input)
void assertNotMatchesMultiLine(String pattern, String input)
void assertWifiConnected(ITestDevice device)

Menyatakan status koneksi Wi-Fi terhubung.

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)

Menampilkan true jika modul dikelola Play.

void safeReboot()
void setUp()

Menunggu perangkat online, menandai waktu booting terbaru perangkat

void tearDown()

Memastikan ponsel online dan memeriksa apakah perangkat mengalami error

void updateKernelStartTime()

Memungkinkan pengujian lulus jika dipanggil setelah mulai ulang terencana.

Metode yang dilindungi

boolean containsDriver(ITestDevice device, String driver, boolean checkReadable)

Periksa apakah driver ada di komputer.

boolean containsDriver(ITestDevice device, String driver)

Periksa apakah driver ada dan dapat dibaca.

Konstanta

TIMEOUT_DEFAULT

protected static final int TIMEOUT_DEFAULT

Nilai Konstanta: 60 (0x0000003c)

TIMEOUT_NONDETERMINISTIC

public static final int TIMEOUT_NONDETERMINISTIC

Nilai Konstanta: 315 (0x0000013b)

Kolom

pocPusher

public PocPusher pocPusher

testName

public TestName testName

Konstruktor publik

SecurityTestCase

public SecurityTestCase ()

Metode publik

assertMatches

public void assertMatches (String pattern, 
                String input)

Parameter
pattern String

input String

Menampilkan
Exception

assertMatchesMultiLine

public void assertMatchesMultiLine (String pattern, 
                String input)

Parameter
pattern String

input String

Menampilkan
Exception

assertNotKernelPointer

public void assertNotKernelPointer (Callable<String> getPtrFunction, 
                ITestDevice deviceToReboot)

Menjalankan fungsi yang disediakan yang mengumpulkan String untuk diuji terhadap kebocoran pointer kernel. Implementasi fungsi getPtrFunction harus menampilkan String yang dimulai dengan pointer. yaitu "01234567". Karakter di akhir diizinkan kecuali [0-9a-fA-F]. Jika pointer tampaknya rentan, pernyataan JUnit akan ditampilkan. Karena pointer kernel dapat di-hash, ada kemungkinan pointer yang di-hash tumpang-tindih ke ruang kernel normal. Pengujian akan dijalankan kembali untuk membuat positif palsu secara statistik tidak signifikan. Jika pointer kernel tidak akan berubah tanpa memulai ulang, sediakan perangkat untuk memulai ulang.

Parameter
getPtrFunction Callable: fungsi yang menampilkan string yang dimulai dengan pointer

deviceToReboot ITestDevice: perangkat akan dimulai ulang saat pointer kernel tidak akan berubah

Menampilkan
Exception

assertNotMatches

public void assertNotMatches (String pattern, 
                String input)

Parameter
pattern String

input String

Menampilkan
Exception

assertNotMatchesMultiLine

public void assertNotMatchesMultiLine (String pattern, 
                String input)

Parameter
pattern String

input String

Menampilkan
Exception

assertWifiConnected

public void assertWifiConnected (ITestDevice device)

Menyatakan status koneksi Wi-Fi terhubung. Karena STS dapat langsung memulai ulang perangkat sebelum menjalankan pengujian, Wi-Fi mungkin tidak terhubung sebelum pengujian dijalankan. Kita melakukan polling Wi-Fi hingga waktu tunggu habis atau Wi-Fi terhubung.

Parameter
device ITestDevice: perangkat yang akan dijalankan

Menampilkan
Exception

assumeIsSupportedNfcDevice

public void assumeIsSupportedNfcDevice (ITestDevice device)

Parameter
device ITestDevice

Menampilkan
Exception

buildMetricsReportLog

public static MetricsReportLog buildMetricsReportLog (ITestDevice device)

Parameter
device ITestDevice

Hasil
MetricsReportLog

createWifiHelper

public WifiHelper createWifiHelper ()

Hasil
WifiHelper

Menampilkan
DeviceNotAvailableException

getAbi

public static IAbi getAbi (ITestDevice device)

Parameter
device ITestDevice

Hasil
IAbi

getBuildInfo

public static IBuildInfo getBuildInfo (ITestDevice device)

Parameter
device ITestDevice

Hasil
IBuildInfo

getPocPusher

public static PocPusher getPocPusher (ITestDevice device)

Parameter
device ITestDevice

Hasil
PocPusher

getTestName

public static String getTestName (ITestDevice device)

Parameter
device ITestDevice

Hasil
String

moduleIsPlayManaged

public boolean moduleIsPlayManaged (String modulePackageName)

Menampilkan true jika modul dikelola Play.

Contoh melewati pengujian berdasarkan modul utama:

  @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...
  }
 

Parameter
modulePackageName String

Hasil
boolean

Menampilkan
Exception

safeReboot

public void safeReboot ()

Menampilkan
DeviceNotAvailableException

setUp

public void setUp ()

Menunggu perangkat online, menandai waktu booting terbaru perangkat

Menampilkan
Exception

tearDown

public void tearDown ()

Memastikan ponsel online dan memeriksa apakah perangkat mengalami error

Menampilkan
Exception

updateKernelStartTime

public void updateKernelStartTime ()

Memungkinkan pengujian lulus jika dipanggil setelah mulai ulang terencana.

Menampilkan
DeviceNotAvailableException

Metode yang dilindungi

containsDriver

protected boolean containsDriver (ITestDevice device, 
                String driver, 
                boolean checkReadable)

Periksa apakah driver ada di komputer.

Parameter
device ITestDevice

driver String

checkReadable boolean

Hasil
boolean

Menampilkan
Exception

containsDriver

protected boolean containsDriver (ITestDevice device, 
                String driver)

Periksa apakah driver ada dan dapat dibaca.

Parameter
device ITestDevice

driver String

Hasil
boolean

Menampilkan
Exception