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


すべての 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)

モジュールが Play 管理対象の場合は 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

testName

public TestName testName

パブリック コンストラクタ

SecurityTestCase

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

assumeIsSupportedNfcDevice

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

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)

モジュールが Play 管理対象の場合は true を返します。

Mainline モジュールに基づいてテストをスキップする例:

  @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

setUp

public void setUp ()

デバイスがオンラインになるまで待機し、デバイスの最新の起動時間をマークします。

例外
Exception

tearDown

public void tearDown ()

スマートフォンがオンラインであることを確認して、デバイスがクラッシュしたかどうかを確認します。

例外
Exception

updateKernelStartTime

public void updateKernelStartTime ()

計画された再起動後に呼び出された場合に、テストが合格するようにします。

例外
DeviceNotAvailableException

保護されたメソッド

containsDriver

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

マシンにドライバが存在するかどうかを確認します。

パラメータ
device ITestDevice

driver String

checkReadable boolean

戻り値
boolean

例外
Exception

containsDriver

protected boolean containsDriver (ITestDevice device, 
                String driver)

ドライバが存在し、読み取り可能かどうかを確認します。

パラメータ
device ITestDevice

driver String

戻り値
boolean

例外
Exception