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


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 in modalità di riproduzione.

void safeReboot ()
void setUp ()

Attende che il dispositivo sia online, segna l'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 richiamato 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_NONDETERMINISTICO

public static final int TIMEOUT_NONDETERMINISTIC

Valore costante: 315 (0x0000013b)

Campi

pocPusher

public PocPusher pocPusher

nomeprova

public TestName testName

Costruttori pubblici

SecurityTestCase

public SecurityTestCase ()

Metodi pubblici

assertMatches

public void assertMatches (String pattern, 
                String input)

Parametri
pattern String

input String

Lancia
Exception

assertMatchesMultiLine

public void assertMatchesMultiLine (String pattern, 
                String input)

Parametri
pattern String

input String

Lancia
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". Sono consentiti i caratteri finali ad eccezione di [0-9a-fA-F]. Nel caso in cui il puntatore sembri 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 per il riavvio.

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 cambieranno

Lancia
Exception

assertNotMatches

public void assertNotMatches (String pattern, 
                String input)

Parametri
pattern String

input String

Lancia
Exception

assertNotMatchesMultiLine

public void assertNotMatchesMultiLine (String pattern, 
                String input)

Parametri
pattern String

input String

Lancia
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 Wi-Fi fino a quando non viene raggiunto un timeout o il Wi-Fi è connesso.

Parametri
device ITestDevice : dispositivo su cui eseguire

Lancia
Exception

assumereIsSupportedNfcDevice

public void assumeIsSupportedNfcDevice (ITestDevice device)

Parametri
device ITestDevice

Lancia
Exception

buildMetricsReportLog

public static MetricsReportLog buildMetricsReportLog (ITestDevice device)

Parametri
device ITestDevice

ritorna
MetricsReportLog

createWiFiHelper

public WifiHelper createWifiHelper ()

ritorna
WifiHelper

Lancia
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

getNomeTest

public static String getTestName (ITestDevice device)

Parametri
device ITestDevice

ritorna
String

moduleIsPlayManaged

public boolean moduleIsPlayManaged (String modulePackageName)

Restituisce vero se un modulo è gestito in modalità di riproduzione.

Esempio di salto di un test basato sui moduli mainline:

  @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

Lancia
Exception

safeReboot

public void safeReboot ()

Lancia
DeviceNotAvailableException

impostare

public void setUp ()

Attende che il dispositivo sia online, segna l'avvio più recente del dispositivo

Lancia
Exception

demolire

public void tearDown ()

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

Lancia
Exception

aggiornamentoKernelStartTime

public void updateKernelStartTime ()

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

Lancia
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

Lancia
Exception

contieneDriver

protected boolean containsDriver (ITestDevice device, 
                String driver)

Controlla se un driver è presente e leggibile.

Parametri
device ITestDevice

driver String

ritorna
boolean

Lancia
Exception