SecurityTestCase

public class SecurityTestCase
extends StsExtraBusinessLogicHostTestBase

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


Classe di test di base per tutti i test STS.

Utilizzare invece RootSecurityTestCase o NonRootSecurityTestCase .

Riepilogo

Costanti

int TIMEOUT_DEFAULT

int TIMEOUT_NONDETERMINISTIC

Campi

public PocPusher pocPusher

public TestName testName

Costruttori pubblici

SecurityTestCase ()

Metodi pubblici

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

Esegue una funzione fornita che raccoglie una stringa per verificare le perdite del puntatore del kernel.

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

Afferma che lo stato della connessione Wi-Fi è connesso.

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)

Restituisce vero se un modulo è gestito dalla riproduzione.

void safeReboot ()
void setUp ()

Attende che il dispositivo sia online, contrassegna l'ora di avvio più recente del dispositivo

void tearDown ()

Si assicura che il telefono sia online e controlla se il dispositivo si è bloccato

void updateKernelStartTime ()

Consente il superamento di un test se chiamato dopo un riavvio pianificato.

Metodi protetti

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

Controlla se un driver è presente su una macchina.

boolean containsDriver (ITestDevice device, String driver)

Controlla se un driver è presente e leggibile.

Costanti

TIMEOUT_DEFAULT

protected static final int TIMEOUT_DEFAULT

Valore costante: 60 (0x0000003c)

TIMEOUT_NONDETERMINISTIC

public static final int TIMEOUT_NONDETERMINISTIC

Valore costante: 315 (0x0000013b)

Campi

pocPusher

public PocPusher pocPusher

provaNome

public TestName testName

Costruttori pubblici

SecurityTestCase

public SecurityTestCase ()

Metodi pubblici

assertCorrispondenze

public void assertMatches (String pattern, 
                String input)

Parametri
pattern String

input String

Getta
Exception

assertMatchesMultiLine

public void assertMatchesMultiLine (String pattern, 
                String input)

Parametri
pattern String

input String

Getta
Exception

assertNotKernelPointer

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

Esegue una funzione fornita che raccoglie una stringa per verificare le perdite del puntatore del kernel. L'implementazione della funzione getPtrFunction deve restituire una stringa che inizia con il puntatore. cioè "01234567". I caratteri finali sono consentiti ad eccezione di [0-9a-fA-F]. Nel caso in cui il puntatore appaia vulnerabile, viene lanciata un'asserzione JUnit. Poiché i puntatori del kernel possono essere sottoposti ad hashing, esiste la possibilità che il puntatore con hash si sovrapponga al normale spazio del kernel. Il test viene ripetuto per rendere i falsi positivi statisticamente insignificanti. Quando i puntatori del kernel non cambiano senza un riavvio, fornire un dispositivo da riavviare.

Parametri
getPtrFunction Callable : una funzione che restituisce una stringa che inizia con un puntatore

deviceToReboot ITestDevice : dispositivo da riavviare quando i puntatori del kernel non cambiano

Getta
Exception

assertNotMatch

public void assertNotMatches (String pattern, 
                String input)

Parametri
pattern String

input String

Getta
Exception

assertNotMatchesMultiLine

public void assertNotMatchesMultiLine (String pattern, 
                String input)

Parametri
pattern String

input String

Getta
Exception

assertWifiConnected

public void assertWifiConnected (ITestDevice device)

Afferma che lo stato della connessione Wi-Fi è connesso. Poiché STS può riavviare un dispositivo immediatamente prima di eseguire un test, il Wi-Fi potrebbe non essere connesso prima dell'esecuzione del test. Effettuiamo il polling del wifi fino a quando non raggiungiamo un timeout o il wifi è connesso.

Parametri
device ITestDevice : dispositivo su cui eseguire

Getta
Exception

assumeIsSupportedNfcDevice

public void assumeIsSupportedNfcDevice (ITestDevice device)

Parametri
device ITestDevice

Getta
Exception

buildMetricsReportLog

public static MetricsReportLog buildMetricsReportLog (ITestDevice device)

Parametri
device ITestDevice

ritorna
MetricsReportLog

createWifiHelper

public WifiHelper createWifiHelper ()

ritorna
WifiHelper

Getta
DeviceNotAvailableException

getAbi

public static IAbi getAbi (ITestDevice device)

Parametri
device ITestDevice

ritorna
IAbi

getBuildInfo

public static IBuildInfo getBuildInfo (ITestDevice device)

Parametri
device ITestDevice

ritorna
IBuildInfo

getPocPusher

public static PocPusher getPocPusher (ITestDevice device)

Parametri
device ITestDevice

ritorna
PocPusher

getTestName

public static String getTestName (ITestDevice device)

Parametri
device ITestDevice

ritorna
String

moduleIsPlayManaged

public boolean moduleIsPlayManaged (String modulePackageName)

Restituisce vero se un modulo è gestito dalla riproduzione.

Esempio di saltare un test basato su moduli principali:

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

Parametri
modulePackageName String

ritorna
boolean

Getta
Exception

safeReboot

public void safeReboot ()

Getta
DeviceNotAvailableException

impostare

public void setUp ()

Attende che il dispositivo sia online, contrassegna l'ora di avvio più recente del dispositivo

Getta
Exception

demolire

public void tearDown ()

Si assicura che il telefono sia online e controlla se il dispositivo si è bloccato

Getta
Exception

updateKernelStartTime

public void updateKernelStartTime ()

Consente il superamento di un test se chiamato dopo un riavvio pianificato.

Getta
DeviceNotAvailableException

Metodi protetti

contieneDriver

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

Controlla se un driver è presente su una macchina.

Parametri
device ITestDevice

driver String

checkReadable boolean

ritorna
boolean

Getta
Exception

contieneDriver

protected boolean containsDriver (ITestDevice device, 
                String driver)

Controlla se un driver è presente e leggibile.

Parametri
device ITestDevice

driver String

ritorna
boolean

Getta
Exception