보안테스트케이스

public class SecurityTestCase
extends StsExtraBusinessLogicHostTestBase

java.lang.객체
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)

필드

pocPusher

public PocPusher pocPusher

테스트 이름

public TestName testName

공개 생성자

보안테스트케이스

public SecurityTestCase ()

공개 방법

assertMatches

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

assertNotKernelPointer

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

assertWifiConnected

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

buildMetricsReportLog

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

getPoc푸셔

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

safeReboot

public void safeReboot ()

던지기
DeviceNotAvailableException

설정

public void setUp ()

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

던지기
Exception

tearDown

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