Merge branch '20816-installOnAndroid' of github.com:NissimHadar/hifi into 20816-installOnAndroid

This commit is contained in:
NissimHadar 2019-02-06 14:29:30 -08:00
commit 89eff9171e
6 changed files with 74 additions and 16 deletions

View file

@ -157,6 +157,13 @@ if (WIN32)
COMMAND "${CMAKE_COMMAND}" -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/AppDataHighFidelity" "AppDataHighFidelity"
)
endif ()
# add a custom command to copy the SSL DLLs
add_custom_command(
TARGET ${TARGET_NAME}
POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_directory "$ENV{VCPKG_ROOT}/installed/x64-windows/bin" "$<TARGET_FILE_DIR:${TARGET_NAME}>"
)
elseif (APPLE)
add_custom_command(
TARGET ${TARGET_NAME}

View file

@ -113,6 +113,7 @@ void Nitpick::setup() {
_ui.folderLineEdit,
_ui.downloadAPKPushbutton,
_ui.installAPKPushbutton,
_ui.runInterfacePushbutton,
_ui.runLatestOnMobileCheckBox,
_ui.urlOnMobileLineEdit,
_ui.statusLabelOnMobile
@ -367,6 +368,10 @@ void Nitpick::on_installAPKPushbutton_clicked() {
_testRunnerMobile->installAPK();
}
void Nitpick::on_runInterfacePushbutton_clicked() {
_testRunnerMobile->runInterface();
}
void Nitpick::on_pullFolderPushbutton_clicked() {
_testRunnerMobile->pullFolder();
}

View file

@ -101,6 +101,7 @@ private slots:
void on_downloadAPKPushbutton_clicked();
void on_installAPKPushbutton_clicked();
void on_runInterfacePushbutton_clicked();
void on_pullFolderPushbutton_clicked();

View file

@ -24,6 +24,7 @@ TestRunnerMobile::TestRunnerMobile(
QLineEdit *folderLineEdit,
QPushButton* downloadAPKPushbutton,
QPushButton* installAPKPushbutton,
QPushButton* runInterfacePushbutton,
QCheckBox* runLatest,
QLineEdit* url,
QLabel* statusLabel,
@ -38,22 +39,16 @@ TestRunnerMobile::TestRunnerMobile(
_folderLineEdit = folderLineEdit;
_downloadAPKPushbutton = downloadAPKPushbutton;
_installAPKPushbutton = installAPKPushbutton;
_runInterfacePushbutton = runInterfacePushbutton;
_runLatest = runLatest;
_url = url;
_statusLabel = statusLabel;
folderLineEdit->setText("/sdcard/DCIM/TEST");
}
TestRunnerMobile::~TestRunnerMobile() {
}
modelNames["SM_G955U1"] = "Samsung S8+ unlocked";
void TestRunnerMobile::setWorkingFolderAndEnableControls() {
setWorkingFolder(_workingFolderLabel);
_connectDeviceButton->setEnabled(true);
// Find ADB (Android Debugging Bridge) before continuing
// Find ADB (Android Debugging Bridge)
#ifdef Q_OS_WIN
if (QProcessEnvironment::systemEnvironment().contains("ADB_PATH")) {
QString adbExePath = QProcessEnvironment::systemEnvironment().value("ADB_PATH") + "/platform-tools";
@ -64,8 +59,8 @@ void TestRunnerMobile::setWorkingFolderAndEnableControls() {
_adbCommand = adbExePath + "/" + _adbExe;
} else {
QMessageBox::critical(0, "PYTHON_PATH not defined",
"Please set PYTHON_PATH to directory containing the Python executable");
QMessageBox::critical(0, "ADB_PATH not defined",
"Please set ADB_PATH to directory containing the `adb` executable");
exit(-1);
}
#elif defined Q_OS_MAC
@ -78,10 +73,19 @@ void TestRunnerMobile::setWorkingFolderAndEnableControls() {
#endif
}
TestRunnerMobile::~TestRunnerMobile() {
}
void TestRunnerMobile::setWorkingFolderAndEnableControls() {
setWorkingFolder(_workingFolderLabel);
_connectDeviceButton->setEnabled(true);
}
void TestRunnerMobile::connectDevice() {
#if defined Q_OS_WIN || defined Q_OS_MAC
QString devicesFullFilename{ _workingFolder + "/devices.txt" };
QString command = _adbCommand + " devices > " + devicesFullFilename;
QString command = _adbCommand + " devices -l > " + devicesFullFilename;
system(command.toStdString().c_str());
if (!QFile::exists(devicesFullFilename)) {
@ -103,7 +107,17 @@ void TestRunnerMobile::connectDevice() {
QMessageBox::critical(0, "Too many devices detected", "Tests will run only if a single device is attached");
} else {
_detectedDeviceLabel->setText(line2.remove(DEVICE));
// Line looks like this: 988a1b47335239434b device product:dream2qlteue model:SM_G955U1 device:dream2qlteue transport_id:2
QStringList tokens = line2.split(QRegExp("[\r\n\t ]+"));
QString deviceID = tokens[0];
QString modelID = tokens[3].split(':')[1];
QString modelName = "UKNOWN";
if (modelNames.count(modelID) == 1) {
modelName = modelNames[modelID];
}
_detectedDeviceLabel->setText(modelName + " [" + deviceID + "]");
_pullFolderButton->setEnabled(true);
_folderLineEdit->setEnabled(true);
_downloadAPKPushbutton->setEnabled(true);
@ -159,6 +173,16 @@ void TestRunnerMobile::installAPK() {
QString command = _adbCommand + " install -r -d " + _workingFolder + "/" + _installerFilename + " >" + _workingFolder + "/installOutput.txt";
system(command.toStdString().c_str());
_statusLabel->setText("Installation complete");
_runInterfacePushbutton->setEnabled(true);
#endif
}
void TestRunnerMobile::runInterface() {
#if defined Q_OS_WIN || defined Q_OS_MAC
_statusLabel->setText("Starting Interface");
QString command = _adbCommand + " shell monkey -p io.highfidelity.hifiinterface -v 1";
system(command.toStdString().c_str());
_statusLabel->setText("Interface started");
#endif
}

View file

@ -11,6 +11,7 @@
#ifndef hifi_testRunnerMobile_h
#define hifi_testRunnerMobile_h
#include <QMap>
#include <QLabel>
#include <QObject>
#include <QPushButton>
@ -28,6 +29,7 @@ public:
QLineEdit *folderLineEdit,
QPushButton* downloadAPKPushbutton,
QPushButton* installAPKPushbutton,
QPushButton* runInterfacePushbutton,
QCheckBox* runLatest,
QLineEdit* url,
QLabel* statusLabel,
@ -41,6 +43,7 @@ public:
void downloadComplete();
void downloadAPK();
void runInterface();
void installAPK();
@ -53,6 +56,7 @@ private:
QLineEdit* _folderLineEdit;
QPushButton* _downloadAPKPushbutton;
QPushButton* _installAPKPushbutton;
QPushButton* _runInterfacePushbutton;
#ifdef Q_OS_WIN
const QString _adbExe{ "adb.exe" };
@ -65,5 +69,6 @@ private:
QString _adbCommand;
std::map<QString, QString> modelNames;
};
#endif

View file

@ -43,7 +43,7 @@
</rect>
</property>
<property name="currentIndex">
<number>0</number>
<number>3</number>
</property>
<widget class="QWidget" name="tab_1">
<attribute name="title">
@ -613,7 +613,7 @@
<property name="geometry">
<rect>
<x>460</x>
<y>350</y>
<y>410</y>
<width>160</width>
<height>30</height>
</rect>
@ -629,7 +629,7 @@
<property name="geometry">
<rect>
<x>10</x>
<y>350</y>
<y>410</y>
<width>440</width>
<height>30</height>
</rect>
@ -725,6 +725,22 @@
<string>Install APK</string>
</property>
</widget>
<widget class="QPushButton" name="runInterfacePushbutton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>300</y>
<width>160</width>
<height>30</height>
</rect>
</property>
<property name="text">
<string>Run Interface</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">