自 2026 年起,为了与我们的主干稳定开发模型保持一致,并确保生态系统的平台稳定性,我们将在第 2 季度和第 4 季度将源代码发布到 AOSP。对于构建 AOSP 和向 AOSP 贡献代码,我们建议使用 android-latest-release 而不是 aosp-main。android-latest-release 清单分支将始终引用推送到 AOSP 的最新版本。如需了解详情,请参阅 AOSP 变更。
Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
GTest
public
class
GTest
extends GTestBase
implements
IDeviceTest
在给定设备上运行原生测试软件包的测试。
摘要
公共构造函数
公共方法
isRebootBeforeTestEnabled
public boolean isRebootBeforeTestEnabled ()
setDevice
public void setDevice (ITestDevice device)
注入被测设备。
setNativeTestDevicePath
public void setNativeTestDevicePath (String path)
受保护的方法
createFlagFile
protected String createFlagFile (String filter)
创建一个包含将通过 --gtest_flagfile 使用的过滤器的文件,以避免任何操作系统对实参大小的限制。
executeCommandByScript
protected void executeCommandByScript (ITestDevice testDevice,
String cmd,
IShellOutputReceiver resultParser)
用于从临时脚本运行 gtest 命令的辅助方法,以防命令过长而无法直接通过 adb 运行。
| 参数 |
testDevice |
ITestDevice:要运行命令的设备 |
cmd |
String:要运行的命令字符串 |
resultParser |
IShellOutputReceiver:用于读取测试结果的输出接收器 |
getGTestCmdLine
protected String getGTestCmdLine (String fullPath,
String flags)
用于构建要运行的 gtest 命令的辅助方法。
| 参数 |
fullPath |
String:设备上 gtest 二进制文件的绝对文件系统路径 |
flags |
String:gtest 执行标志 |
| 返回 |
String |
要为 gtest 运行的 shell 命令行 |
loadFilter
protected String loadFilter (String binaryOnDevice)
定义 getFilter 方法。
子类必须实现如何获取自己的过滤器。
| 参数 |
binaryOnDevice |
String:过滤器文件的完整路径。 |
shouldRunFile
protected boolean shouldRunFile (String fullPath)
用于确定是否应执行给定文件的辅助方法。
| 参数 |
fullPath |
String:相关文件的完整路径 |
| 返回 |
boolean |
如果应执行相应文件,则为 true。 |
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-12-04。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-12-04。"],[],[]]