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


Podstawowa klasa testu dla wszystkich testów STS.

Użyj w zamian pola RootSecurityTestCase lub NonRootSecurityTestCase.

Podsumowanie

Stałe

int TIMEOUT_DEFAULT

int TIMEOUT_NONDETERMINISTIC

Fieldsem

public PocPusher pocPusher

public TestName testName

Konstruktory publiczne

SecurityTestCase()

Metody publiczne

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

Uruchamia podawaną funkcję, która zbiera ciąg znaków do testowania pod kątem wycieków wskaźnika jądra.

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

Potwierdza, że stan połączenia Wi-Fi to „połączono”.

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)

Zwraca wartość Prawda, jeśli moduł jest zarządzany przez odtwarzanie.

void safeReboot()
void setUp()

Czeka, aż urządzenie będzie online, oznacza ostatni czas rozruchu urządzenia

void tearDown()

Sprawdzanie, czy telefon jest online, i czy nie uległ awarii

void updateKernelStartTime()

Umożliwia przeprowadzenie testu, jeśli zostanie wywołany po zaplanowanym ponownym uruchomieniu.

Chronione metody

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

Sprawdź, czy na komputerze jest zainstalowany sterownik.

boolean containsDriver(ITestDevice device, String driver)

Sprawdź, czy sterownik jest obecny i czy można go odczytać.

Stałe

TIMEOUT_DEFAULT

protected static final int TIMEOUT_DEFAULT

Wartość stała: 60 (0x0000003c)

TIMEOUT_NONDETERMINISTIC

public static final int TIMEOUT_NONDETERMINISTIC

Wartość stała: 315 (0x0000013b)

Fieldsem

pocPusher

public PocPusher pocPusher

testName

public TestName testName

Konstruktory publiczne

SecurityTestCase

public SecurityTestCase ()

Metody publiczne

assertMatches

public void assertMatches (String pattern, 
                String input)

Parametry
pattern String

input String

Rzuty
Exception

assertMatchesMultiLine

public void assertMatchesMultiLine (String pattern, 
                String input)

Parametry
pattern String

input String

Rzuty
Exception

assertNotKernelPointer

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

Uruchamia podawaną funkcję, która zbiera ciąg znaków do testowania pod kątem wycieków wskaźnika jądra. Implementacja funkcji getPtrFunction musi zwracać ciąg znaków, który zaczyna się od wskaźnika. np. „01234567”. Dozwolone są znaki końcowe z wyjątkiem [0-9a-fA-F]. Jeśli wskaźnik wydaje się być podatny na atak, zostanie wywołane twierdzenie JUnit. Wskaźniki jądra mogą być zaszyfrowane, więc istnieje możliwość, że zaszyfrowany wskaźnik nakłada się na normalną przestrzeń jądra. Test jest ponownie przeprowadzany, aby wyniki fałszywie dodatnie były statystycznie nieistotne. Jeśli wskaźniki jądra nie zmieniają się bez restartu, zrestartuj urządzenie.

Parametry
getPtrFunction Callable: funkcja, która zwraca ciąg znaków zaczynający się od wskaźnika

deviceToReboot ITestDevice: urządzenie ma się zrestartować, gdy wskaźniki jądra się nie zmienią

Rzuty
Exception

assertNotMatches

public void assertNotMatches (String pattern, 
                String input)

Parametry
pattern String

input String

Rzuty
Exception

assertNotMatchesMultiLine

public void assertNotMatchesMultiLine (String pattern, 
                String input)

Parametry
pattern String

input String

Rzuty
Exception

assertWifiConnected

public void assertWifiConnected (ITestDevice device)

Potwierdza, że stan połączenia Wi-Fi to „połączono”. STS może zresetować urządzenie bezpośrednio przed uruchomieniem testu, więc Wi-Fi może nie być połączone przed rozpoczęciem testu. Odpytujemy sieć Wi-Fi, dopóki nie osiągniemy limitu czasu lub nie nawiążemy połączenia z Wi-Fi.

Parametry
device ITestDevice: urządzenie, na którym ma być uruchomiony test

Rzuty
Exception

assumeIsSupportedNfcDevice

public void assumeIsSupportedNfcDevice (ITestDevice device)

Parametry
device ITestDevice

Rzuty
Exception

buildMetricsReportLog

public static MetricsReportLog buildMetricsReportLog (ITestDevice device)

Parametry
device ITestDevice

Zwroty
MetricsReportLog

createWifiHelper

public WifiHelper createWifiHelper ()

Zwroty
WifiHelper

Rzuty
DeviceNotAvailableException

getAbi

public static IAbi getAbi (ITestDevice device)

Parametry
device ITestDevice

Zwroty
IAbi

getBuildInfo

public static IBuildInfo getBuildInfo (ITestDevice device)

Parametry
device ITestDevice

Zwroty
IBuildInfo

getPocPusher

public static PocPusher getPocPusher (ITestDevice device)

Parametry
device ITestDevice

Zwroty
PocPusher

getTestName

public static String getTestName (ITestDevice device)

Parametry
device ITestDevice

Zwroty
String

moduleIsPlayManaged

public boolean moduleIsPlayManaged (String modulePackageName)

Zwraca wartość Prawda, jeśli moduł jest zarządzany przez odtwarzanie.

Przykład pominięcia testu na podstawie modułów głównych:

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

Parametry
modulePackageName String

Zwroty
boolean

Rzuty
Exception

safeReboot

public void safeReboot ()

Rzuty
DeviceNotAvailableException

setUp

public void setUp ()

Czeka, aż urządzenie będzie online, oznacza ostatni czas rozruchu urządzenia

Rzuty
Exception

tearDown

public void tearDown ()

Sprawdzanie, czy telefon jest online, i czy nie uległ awarii

Rzuty
Exception

updateKernelStartTime

public void updateKernelStartTime ()

Umożliwia przeprowadzenie testu, jeśli zostanie wywołany po zaplanowanym ponownym uruchomieniu.

Rzuty
DeviceNotAvailableException

Chronione metody

containsDriver

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

Sprawdź, czy na komputerze jest zainstalowany sterownik.

Parametry
device ITestDevice

driver String

checkReadable boolean

Zwroty
boolean

Rzuty
Exception

containsDriver

protected boolean containsDriver (ITestDevice device, 
                String driver)

Sprawdź, czy sterownik jest obecny i czy można go odczytać.

Parametry
device ITestDevice

driver String

Zwroty
boolean

Rzuty
Exception