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 de test de base pour tous les tests STS.

Utilisez RootSecurityTestCase ou NonRootSecurityTestCase à la place.

Résumé

Constantes

int TIMEOUT_DEFAULT

int TIMEOUT_NONDETERMINISTIC

Champs

public PocPusher pocPusher

public TestName testName

Constructeurs publics

SecurityTestCase()

Méthodes publiques

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

Exécute une fonction fournie qui collecte une chaîne à tester contre les fuites de pointeurs de noyau.

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

Affirme que l'état de la connexion Wi-Fi est "connecté".

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)

Renvoie la valeur "true" si un module est géré par Play.

void safeReboot()
void setUp()

Attend que l'appareil soit en ligne, marque le dernier démarrage de l'appareil

void tearDown()

Vérifie que le téléphone est en ligne et vérifie si l'appareil a planté

void updateKernelStartTime()

Permet à un test de réussir s'il est appelé après un redémarrage planifié.

Méthodes protégées

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

Vérifier si un pilote est présent sur une machine

boolean containsDriver(ITestDevice device, String driver)

Vérifiez si un pilote est présent et lisible.

Constantes

TIMEOUT_DEFAULT

protected static final int TIMEOUT_DEFAULT

Valeur constante : 60 (0x0000003c)

TIMEOUT_NONDETERMINISTIC

public static final int TIMEOUT_NONDETERMINISTIC

Valeur constante : 315 (0x0000013b)

Champs

pocPusher

public PocPusher pocPusher

testName

public TestName testName

Constructeurs publics

SecurityTestCase

public SecurityTestCase ()

Méthodes publiques

assertMatches

public void assertMatches (String pattern, 
                String input)

Paramètres
pattern String

input String

Génère
Exception

assertMatchesMultiLine

public void assertMatchesMultiLine (String pattern, 
                String input)

Paramètres
pattern String

input String

Génère
Exception

assertNotKernelPointer

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

Exécute une fonction fournie qui collecte une chaîne à tester contre les fuites de pointeurs de noyau. L'implémentation de la fonction getPtrFunction doit renvoyer une chaîne commençant par le pointeur. (par exemple, "01234567"). Les caractères de fin sont autorisés, à l'exception de [0-9a-fA-F]. Si le pointeur semble être vulnérable, une assertion JUnit est générée. Étant donné que les pointeurs de noyau peuvent être hachés, il est possible que le pointeur haché chevauche l'espace de noyau normal. Le test est réexécuté pour que les faux positifs soient statistiquement insignifiants. Lorsque les pointeurs du noyau ne changent pas sans redémarrage, fournissez un appareil à redémarrer.

Paramètres
getPtrFunction Callable: fonction qui renvoie une chaîne commençant par un pointeur

deviceToReboot ITestDevice: appareil à redémarrer lorsque les pointeurs du noyau ne changent pas

Génère
Exception

assertNotMatches

public void assertNotMatches (String pattern, 
                String input)

Paramètres
pattern String

input String

Génère
Exception

assertNotMatchesMultiLine

public void assertNotMatchesMultiLine (String pattern, 
                String input)

Paramètres
pattern String

input String

Génère
Exception

assertWifiConnected

public void assertWifiConnected (ITestDevice device)

Affirme que l'état de la connexion Wi-Fi est "connecté". Étant donné que STS peut redémarrer un appareil immédiatement avant d'exécuter un test, il est possible que le Wi-Fi ne soit pas connecté avant l'exécution du test. Nous interrogeons le Wi-Fi jusqu'à ce qu'un délai d'inactivité soit atteint ou que le Wi-Fi soit connecté.

Paramètres
device ITestDevice: appareil sur lequel l'appli doit s'exécuter

Génère
Exception

assumeIsSupportedNfcDevice

public void assumeIsSupportedNfcDevice (ITestDevice device)

Paramètres
device ITestDevice

Génère
Exception

buildMetricsReportLog

public static MetricsReportLog buildMetricsReportLog (ITestDevice device)

Paramètres
device ITestDevice

Renvoie
MetricsReportLog

createWifiHelper

public WifiHelper createWifiHelper ()

Renvoie
WifiHelper

Génère
DeviceNotAvailableException

getAbi

public static IAbi getAbi (ITestDevice device)

Paramètres
device ITestDevice

Renvoie
IAbi

getBuildInfo

public static IBuildInfo getBuildInfo (ITestDevice device)

Paramètres
device ITestDevice

Renvoie
IBuildInfo

getPocPusher

public static PocPusher getPocPusher (ITestDevice device)

Paramètres
device ITestDevice

Renvoie
PocPusher

getTestName

public static String getTestName (ITestDevice device)

Paramètres
device ITestDevice

Renvoie
String

moduleIsPlayManaged

public boolean moduleIsPlayManaged (String modulePackageName)

Renvoie la valeur "true" si un module est géré par Play.

Exemple de suppression d'un test basé sur des modules principaux:

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

Paramètres
modulePackageName String

Renvoie
boolean

Génère
Exception

safeReboot

public void safeReboot ()

Génère
DeviceNotAvailableException

setUp

public void setUp ()

Attend que l'appareil soit en ligne, marque le dernier démarrage de l'appareil

Génère
Exception

tearDown

public void tearDown ()

Vérifie que le téléphone est en ligne et vérifie si l'appareil a planté

Génère
Exception

updateKernelStartTime

public void updateKernelStartTime ()

Permet à un test de réussir s'il est appelé après un redémarrage planifié.

Génère
DeviceNotAvailableException

Méthodes protégées

containsDriver

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

Vérifier si un pilote est présent sur une machine

Paramètres
device ITestDevice

driver String

checkReadable boolean

Renvoie
boolean

Génère
Exception

containsDriver

protected boolean containsDriver (ITestDevice device, 
                String driver)

Vérifiez si un pilote est présent et lisible.

Paramètres
device ITestDevice

driver String

Renvoie
boolean

Génère
Exception