보안테스트케이스

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


모든 STS 테스트에 대한 기본 테스트 클래스입니다.

대신 RootSecurityTestCase 또는 NonRootSecurityTestCase 사용하세요.

요약

상수

int TIMEOUT_DEFAULT

int TIMEOUT_NONDETERMINISTIC

필드

public PocPusher pocPusher

public TestName testName

공개 생성자

SecurityTestCase ()

공개 메소드

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

커널 포인터 누수를 테스트하기 위해 문자열을 수집하는 제공된 함수를 실행합니다.

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

Wi-Fi 연결 상태가 연결되어 있는지 확인합니다.

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)

모듈이 재생 관리되는 경우 true를 반환합니다.

void safeReboot ()
void setUp ()

장치가 온라인 상태가 될 때까지 기다리고 장치의 가장 최근 부팅 시간을 표시합니다.

void tearDown ()

전화가 온라인인지 확인하고 장치가 충돌했는지 확인합니다.

void updateKernelStartTime ()

계획된 재부팅 후에 호출되면 테스트를 통과할 수 있습니다.

보호된 방법

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

컴퓨터에 드라이버가 있는지 확인하세요.

boolean containsDriver (ITestDevice device, String driver)

드라이버가 있고 읽을 수 있는지 확인하십시오.

상수

TIMEOUT_DEFAULT

protected static final int TIMEOUT_DEFAULT

상수값: 60(0x0000003c)

TIMEOUT_NONDETERMINISTIC

public static final int TIMEOUT_NONDETERMINISTIC

상수값: 315(0x0000013b)

필드

poc푸셔

public PocPusher pocPusher

테스트 이름

public TestName testName

공개 생성자

보안테스트케이스

public SecurityTestCase ()

공개 메소드

AssertMatchs

public void assertMatches (String pattern, 
                String input)

매개변수
pattern String

input String

던지기
Exception

AssertMatchesMultiLine

public void assertMatchesMultiLine (String pattern, 
                String input)

매개변수
pattern String

input String

던지기
Exception

주장NotKernelPointer

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

커널 포인터 누수를 테스트하기 위해 문자열을 수집하는 제공된 함수를 실행합니다. getPtrFunction 함수 구현은 포인터로 시작하는 문자열을 반환해야 합니다. 즉, "01234567"입니다. [0-9a-fA-F]를 제외하고 후행 문자가 허용됩니다. 포인터가 취약한 것으로 보이는 경우 JUnit 어설션이 발생합니다. 커널 포인터는 해시될 수 있으므로 해시된 포인터가 일반 커널 공간과 겹칠 가능성이 있습니다. 테스트가 다시 실행되어 거짓 긍정이 통계적으로 중요하지 않게 됩니다. 재부팅 없이 커널 포인터가 변경되지 않는 경우 재부팅할 장치를 제공합니다.

매개변수
getPtrFunction Callable : 포인터로 시작하는 문자열을 반환하는 함수

deviceToReboot ITestDevice : 커널 포인터가 변경되지 않을 때 재부팅할 장치

던지기
Exception

AssertNotMatches

public void assertNotMatches (String pattern, 
                String input)

매개변수
pattern String

input String

던지기
Exception

AssertNotMatchesMultiLine

public void assertNotMatchesMultiLine (String pattern, 
                String input)

매개변수
pattern String

input String

던지기
Exception

Wi-Fi연결됨 주장

public void assertWifiConnected (ITestDevice device)

Wi-Fi 연결 상태가 연결되어 있는지 확인합니다. STS는 테스트를 실행하기 직전에 장치를 재부팅할 수 있으므로 테스트가 실행되기 전에 Wi-Fi가 연결되지 않을 수 있습니다. 시간 초과에 도달하거나 Wi-Fi가 연결될 때까지 Wi-Fi를 폴링합니다.

매개변수
device ITestDevice : 실행될 장치

던지기
Exception

지원되는Nfc장치가 있다고 가정합니다.

public void assumeIsSupportedNfcDevice (ITestDevice device)

매개변수
device ITestDevice

던지기
Exception

빌드메트릭스보고서로그

public static MetricsReportLog buildMetricsReportLog (ITestDevice device)

매개변수
device ITestDevice

보고
MetricsReportLog

createWifiHelper

public WifiHelper createWifiHelper ()

보고
WifiHelper

던지기
DeviceNotAvailableException

getAbi

public static IAbi getAbi (ITestDevice device)

매개변수
device ITestDevice

보고
IAbi

getBuildInfo

public static IBuildInfo getBuildInfo (ITestDevice device)

매개변수
device ITestDevice

보고
IBuildInfo

getPocPusher

public static PocPusher getPocPusher (ITestDevice device)

매개변수
device ITestDevice

보고
PocPusher

getTestName

public static String getTestName (ITestDevice device)

매개변수
device ITestDevice

보고
String

moduleIsPlayManaged

public boolean moduleIsPlayManaged (String modulePackageName)

모듈이 재생 관리되는 경우 true를 반환합니다.

메인라인 모듈 기반 테스트 건너뛰기의 예:

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

매개변수
modulePackageName String

보고
boolean

던지기
Exception

안전 재부팅

public void safeReboot ()

던지기
DeviceNotAvailableException

설정

public void setUp ()

장치가 온라인 상태가 될 때까지 기다리고 장치의 가장 최근 부팅 시간을 표시합니다.

던지기
Exception

분해

public void tearDown ()

전화가 온라인인지 확인하고 장치가 충돌했는지 확인합니다.

던지기
Exception

업데이트KernelStartTime

public void updateKernelStartTime ()

계획된 재부팅 후에 호출되면 테스트를 통과할 수 있습니다.

던지기
DeviceNotAvailableException

보호된 방법

포함드라이버

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

컴퓨터에 드라이버가 있는지 확인하세요.

매개변수
device ITestDevice

driver String

checkReadable boolean

보고
boolean

던지기
Exception

포함드라이버

protected boolean containsDriver (ITestDevice device, 
                String driver)

드라이버가 있고 읽을 수 있는지 확인하십시오.

매개변수
device ITestDevice

driver String

보고
boolean

던지기
Exception