Android 工厂模式增加Type-A功能测试
收到客户需求想要增加Type-A测试项来验证Type-A功能,具体功能实现参照如下:
/vendor/freeme/packages/apps/FreemeFactoryTest/src/com/freeme/factory/usb/TypeAUSB.java
文章来源:https://www.toymoban.com/news/detail-718260.html
package com.freeme.factory.usb;
import android.os.Bundle;
import android.widget.TextView;
import java.io.File;
import android.os.Handler;
import com.freeme.factory.FactoryTest;
import com.freeme.factory.R;
import com.freeme.factory.base.BaseTest;
public class TypeAUSB extends BaseTest {
private TextView mText;
private final Runnable parseScanRunnable = new Runnable() {
public void run() {
test();
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.typea_usb);
mText = (TextView) findViewById(R.id.text);
mText.setText(R.string.typea_hint);
testActionCompleted(false);
Handler mHandler = new Handler();
mHandler.postDelayed(parseScanRunnable, 1000);
}
public void test() {
String mUSB0Path = "/dev/hidraw0";
String mUSB1Path = "/dev/hidraw1";
File usb0File = new File(mUSB0Path);
File usb1File = new File(mUSB1Path);
boolean usb0Exists = usb0File.exists();
boolean usb1Exists = usb1File.exists();
mText.setText("usb0Exists : " + usb0Exists + "\n" + "usb1Exists : " + usb1Exists);
if (usb0File.exists() && usb1File.exists()) {
mText.setText(R.string.typea_found);
testActionCompleted(true);
if (FactoryTest.getTestMode() != 0) {
testResultCommit(true);
}
}
}
@Override
protected void onPause() {
super.onPause();
}
@Override
protected void onStop() {
super.onStop();
}
@Override
protected void onDestroy() {
super.onDestroy();
}
}
重新编译验证,修改生效,工厂模式Type-A功能验证通过文章来源地址https://www.toymoban.com/news/detail-718260.html
到了这里,关于Android 工厂模式增加Type-A功能测试的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!