Kasus Uji Keamanan

public class SecurityTestCase
extends StsExtraBusinessLogicHostTestBase

java.lang.Objek
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


Kelas tes dasar untuk semua tes STS.

Gunakan RootSecurityTestCase atau NonRootSecurityTestCase sebagai gantinya.

Ringkasan

Konstanta

int TIMEOUT_DEFAULT

int TIMEOUT_NONDETERMINISTIC

Bidang

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 menguji kebocoran penunjuk kernel.

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

Menegaskan status koneksi wifi 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)

Mengembalikan nilai true jika modul dikelola pemutaran.

void safeReboot ()
void setUp ()

Menunggu perangkat online, menandai waktu boot terbaru perangkat

void tearDown ()

Pastikan ponsel online dan periksa apakah perangkat mogok

void updateKernelStartTime ()

Mengizinkan pengujian lulus jika dipanggil setelah reboot yang direncanakan.

Metode yang dilindungi

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

Periksa apakah ada driver pada mesin.

boolean containsDriver (ITestDevice device, String driver)

Periksa apakah driver ada dan dapat dibaca.

Konstanta

TIMEOUT_DEFAULT

protected static final int TIMEOUT_DEFAULT

Nilai Konstan: 60 (0x0000003c)

TIMEOUT_NONDETERMINISTIC

public static final int TIMEOUT_NONDETERMINISTIC

Nilai Konstan: 315 (0x0000013b)

Bidang

pocPusher

public PocPusher pocPusher

nama tes

public TestName testName

Konstruktor publik

Kasus Uji Keamanan

public SecurityTestCase ()

Metode publik

tegaskan Cocok

public void assertMatches (String pattern, 
                String input)

Parameter
pattern String

input String

Melempar
Exception

tegaskanMatchesMultiLine

public void assertMatchesMultiLine (String pattern, 
                String input)

Parameter
pattern String

input String

Melempar
Exception

menegaskanNotKernelPointer

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

Menjalankan fungsi yang disediakan yang mengumpulkan String untuk menguji kebocoran penunjuk kernel. Implementasi fungsi getPtrFunction harus mengembalikan sebuah String yang dimulai dengan pointer. yaitu "01234567". Karakter tambahan diperbolehkan kecuali untuk [0-9a-fA-F]. Jika penunjuk tampak rentan, pernyataan JUnit akan dilempar. Karena penunjuk kernel dapat di-hash, ada kemungkinan penunjuk yang di-hash tumpang tindih dengan ruang kernel normal. Tes dijalankan kembali untuk membuat hasil positif palsu menjadi tidak signifikan secara statistik. Jika penunjuk kernel tidak berubah tanpa reboot, sediakan perangkat untuk reboot.

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

deviceToReboot ITestDevice : perangkat untuk reboot ketika pointer kernel tidak berubah

Melempar
Exception

tegaskanTidak Cocok

public void assertNotMatches (String pattern, 
                String input)

Parameter
pattern String

input String

Melempar
Exception

menegaskanNotMatchesMultiLine

public void assertNotMatchesMultiLine (String pattern, 
                String input)

Parameter
pattern String

input String

Melempar
Exception

menegaskanWifiConnected

public void assertWifiConnected (ITestDevice device)

Menegaskan status koneksi wifi terhubung. Karena STS dapat melakukan reboot perangkat segera sebelum menjalankan pengujian, wifi mungkin tidak tersambung sebelum pengujian dijalankan. Kami melakukan polling wifi hingga mencapai batas waktu atau wifi terhubung.

Parameter
device ITestDevice : perangkat yang akan dijalankan

Melempar
Exception

asumsikanIsSupportedNfcDevice

public void assumeIsSupportedNfcDevice (ITestDevice device)

Parameter
device ITestDevice

Melempar
Exception

buildMetricsReportLog

public static MetricsReportLog buildMetricsReportLog (ITestDevice device)

Parameter
device ITestDevice

Kembali
MetricsReportLog

buat WifiHelper

public WifiHelper createWifiHelper ()

Kembali
WifiHelper

Melempar
DeviceNotAvailableException

dapatkan Abi

public static IAbi getAbi (ITestDevice device)

Parameter
device ITestDevice

Kembali
IAbi

dapatkanBuildInfo

public static IBuildInfo getBuildInfo (ITestDevice device)

Parameter
device ITestDevice

Kembali
IBuildInfo

dapatkanPocPusher

public static PocPusher getPocPusher (ITestDevice device)

Parameter
device ITestDevice

Kembali
PocPusher

dapatkan Nama Tes

public static String getTestName (ITestDevice device)

Parameter
device ITestDevice

Kembali
String

moduleIsPlayManaged

public boolean moduleIsPlayManaged (String modulePackageName)

Mengembalikan nilai true jika modul dikelola pemutaran.

Contoh melewatkan tes berdasarkan modul jalur 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

Kembali
boolean

Melempar
Exception

boot ulang aman

public void safeReboot ()

Melempar
DeviceNotAvailableException

mempersiapkan

public void setUp ()

Menunggu perangkat online, menandai waktu boot terbaru perangkat

Melempar
Exception

menangis

public void tearDown ()

Pastikan ponsel online dan periksa apakah perangkat mogok

Melempar
Exception

perbaruiKernelStartTime

public void updateKernelStartTime ()

Mengizinkan pengujian lulus jika dipanggil setelah reboot yang direncanakan.

Melempar
DeviceNotAvailableException

Metode yang dilindungi

berisiDriver

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

Periksa apakah ada driver pada mesin.

Parameter
device ITestDevice

driver String

checkReadable boolean

Kembali
boolean

Melempar
Exception

berisiDriver

protected boolean containsDriver (ITestDevice device, 
                String driver)

Periksa apakah driver ada dan dapat dibaca.

Parameter
device ITestDevice

driver String

Kembali
boolean

Melempar
Exception