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.

Utilizza 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 da testare per rilevare perdite di puntatori del kernel.

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

Verifica che lo stato della connessione Wi-Fi sia 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 true se un modulo è gestito da Google Play.

void safeReboot()
void setUp()

Attende che il dispositivo sia online e contrassegna il tempo di avvio più recente del dispositivo

void tearDown()

Verifica che lo smartphone sia online e controlla se il dispositivo ha avuto un arresto anomalo

void updateKernelStartTime()

Consente il superamento di un test se viene 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 è presente e leggibile un driver.

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

testName

public TestName testName

Costruttori pubblici

SecurityTestCase

public SecurityTestCase ()

Metodi pubblici

assertMatches

public void assertMatches (String pattern, 
                String input)

Parametri
pattern String

input String

Lanci
Exception

assertMatchesMultiLine

public void assertMatchesMultiLine (String pattern, 
                String input)

Parametri
pattern String

input String

Lanci
Exception

assertNotKernelPointer

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

Esegue una funzione fornita che raccoglie una stringa da testare per rilevare perdite di puntatori del kernel. L'implementazione della funzione getPtrFunction deve restituire una stringa che inizia con il puntatore. ad esempio "01234567". Sono consentiti caratteri finali, ad eccezione di [0-9a-fA-F]. Se il cursore sembra essere vulnerabile, viene lanciata un'affermazione JUnit. Poiché i puntatori del kernel possono essere sottoposti ad hashing, è possibile che il puntatore sottoposto ad hashing si sovrapponga allo spazio del kernel normale. Il test viene eseguito di nuovo per rendere i falsi positivi statisticamente non significativi. Quando i puntatori del kernel non cambiano senza un riavvio, fornisci un dispositivo da riavviare.

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

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

Lanci
Exception

assertNotMatches

public void assertNotMatches (String pattern, 
                String input)

Parametri
pattern String

input String

Lanci
Exception

assertNotMatchesMultiLine

public void assertNotMatchesMultiLine (String pattern, 
                String input)

Parametri
pattern String

input String

Lanci
Exception

assertWifiConnected

public void assertWifiConnected (ITestDevice device)

Verifica che lo stato della connessione Wi-Fi sia 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. Eseguiamo il polling del Wi-Fi fino a quando non si verifica un timeout o il Wi-Fi è connesso.

Parametri
device ITestDevice: dispositivo su cui eseguire il comando

Lanci
Exception

assumeIsSupportedNfcDevice

public void assumeIsSupportedNfcDevice (ITestDevice device)

Parametri
device ITestDevice

Lanci
Exception

buildMetricsReportLog

public static MetricsReportLog buildMetricsReportLog (ITestDevice device)

Parametri
device ITestDevice

Ritorni
MetricsReportLog

createWifiHelper

public WifiHelper createWifiHelper ()

Ritorni
WifiHelper

Lanci
DeviceNotAvailableException

getAbi

public static IAbi getAbi (ITestDevice device)

Parametri
device ITestDevice

Ritorni
IAbi

getBuildInfo

public static IBuildInfo getBuildInfo (ITestDevice device)

Parametri
device ITestDevice

Ritorni
IBuildInfo

getPocPusher

public static PocPusher getPocPusher (ITestDevice device)

Parametri
device ITestDevice

Ritorni
PocPusher

getTestName

public static String getTestName (ITestDevice device)

Parametri
device ITestDevice

Ritorni
String

moduleIsPlayManaged

public boolean moduleIsPlayManaged (String modulePackageName)

Restituisce true se un modulo è gestito da Google Play.

Esempio di s salto di un test in base ai 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

Ritorni
boolean

Lanci
Exception

safeReboot

public void safeReboot ()

Lanci
DeviceNotAvailableException

setUp

public void setUp ()

Attende che il dispositivo sia online e contrassegna il tempo di avvio più recente del dispositivo

Lanci
Exception

tearDown

public void tearDown ()

Verifica che lo smartphone sia online e controlla se il dispositivo ha avuto un arresto anomalo

Lanci
Exception

updateKernelStartTime

public void updateKernelStartTime ()

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

Lanci
DeviceNotAvailableException

Metodi protetti

containsDriver

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

Controlla se un driver è presente su una macchina.

Parametri
device ITestDevice

driver String

checkReadable boolean

Ritorni
boolean

Lanci
Exception

containsDriver

protected boolean containsDriver (ITestDevice device, 
                String driver)

Controlla se è presente e leggibile un driver.

Parametri
device ITestDevice

driver String

Ritorni
boolean

Lanci
Exception