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" COMMAND "${CMAKE_COMMAND}" -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/AppDataHighFidelity" "AppDataHighFidelity"
) )
endif () 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) elseif (APPLE)
add_custom_command( add_custom_command(
TARGET ${TARGET_NAME} TARGET ${TARGET_NAME}

View file

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

View file

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

View file

@ -24,6 +24,7 @@ TestRunnerMobile::TestRunnerMobile(
QLineEdit *folderLineEdit, QLineEdit *folderLineEdit,
QPushButton* downloadAPKPushbutton, QPushButton* downloadAPKPushbutton,
QPushButton* installAPKPushbutton, QPushButton* installAPKPushbutton,
QPushButton* runInterfacePushbutton,
QCheckBox* runLatest, QCheckBox* runLatest,
QLineEdit* url, QLineEdit* url,
QLabel* statusLabel, QLabel* statusLabel,
@ -38,22 +39,16 @@ TestRunnerMobile::TestRunnerMobile(
_folderLineEdit = folderLineEdit; _folderLineEdit = folderLineEdit;
_downloadAPKPushbutton = downloadAPKPushbutton; _downloadAPKPushbutton = downloadAPKPushbutton;
_installAPKPushbutton = installAPKPushbutton; _installAPKPushbutton = installAPKPushbutton;
_runInterfacePushbutton = runInterfacePushbutton;
_runLatest = runLatest; _runLatest = runLatest;
_url = url; _url = url;
_statusLabel = statusLabel; _statusLabel = statusLabel;
folderLineEdit->setText("/sdcard/DCIM/TEST"); folderLineEdit->setText("/sdcard/DCIM/TEST");
}
TestRunnerMobile::~TestRunnerMobile() { modelNames["SM_G955U1"] = "Samsung S8+ unlocked";
}
void TestRunnerMobile::setWorkingFolderAndEnableControls() { // Find ADB (Android Debugging Bridge)
setWorkingFolder(_workingFolderLabel);
_connectDeviceButton->setEnabled(true);
// Find ADB (Android Debugging Bridge) before continuing
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
if (QProcessEnvironment::systemEnvironment().contains("ADB_PATH")) { if (QProcessEnvironment::systemEnvironment().contains("ADB_PATH")) {
QString adbExePath = QProcessEnvironment::systemEnvironment().value("ADB_PATH") + "/platform-tools"; QString adbExePath = QProcessEnvironment::systemEnvironment().value("ADB_PATH") + "/platform-tools";
@ -64,8 +59,8 @@ void TestRunnerMobile::setWorkingFolderAndEnableControls() {
_adbCommand = adbExePath + "/" + _adbExe; _adbCommand = adbExePath + "/" + _adbExe;
} else { } else {
QMessageBox::critical(0, "PYTHON_PATH not defined", QMessageBox::critical(0, "ADB_PATH not defined",
"Please set PYTHON_PATH to directory containing the Python executable"); "Please set ADB_PATH to directory containing the `adb` executable");
exit(-1); exit(-1);
} }
#elif defined Q_OS_MAC #elif defined Q_OS_MAC
@ -78,10 +73,19 @@ void TestRunnerMobile::setWorkingFolderAndEnableControls() {
#endif #endif
} }
TestRunnerMobile::~TestRunnerMobile() {
}
void TestRunnerMobile::setWorkingFolderAndEnableControls() {
setWorkingFolder(_workingFolderLabel);
_connectDeviceButton->setEnabled(true);
}
void TestRunnerMobile::connectDevice() { void TestRunnerMobile::connectDevice() {
#if defined Q_OS_WIN || defined Q_OS_MAC #if defined Q_OS_WIN || defined Q_OS_MAC
QString devicesFullFilename{ _workingFolder + "/devices.txt" }; QString devicesFullFilename{ _workingFolder + "/devices.txt" };
QString command = _adbCommand + " devices > " + devicesFullFilename; QString command = _adbCommand + " devices -l > " + devicesFullFilename;
system(command.toStdString().c_str()); system(command.toStdString().c_str());
if (!QFile::exists(devicesFullFilename)) { 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"); QMessageBox::critical(0, "Too many devices detected", "Tests will run only if a single device is attached");
} else { } 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); _pullFolderButton->setEnabled(true);
_folderLineEdit->setEnabled(true); _folderLineEdit->setEnabled(true);
_downloadAPKPushbutton->setEnabled(true); _downloadAPKPushbutton->setEnabled(true);
@ -159,6 +173,16 @@ void TestRunnerMobile::installAPK() {
QString command = _adbCommand + " install -r -d " + _workingFolder + "/" + _installerFilename + " >" + _workingFolder + "/installOutput.txt"; QString command = _adbCommand + " install -r -d " + _workingFolder + "/" + _installerFilename + " >" + _workingFolder + "/installOutput.txt";
system(command.toStdString().c_str()); system(command.toStdString().c_str());
_statusLabel->setText("Installation complete"); _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 #endif
} }

View file

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

View file

@ -43,7 +43,7 @@
</rect> </rect>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>3</number>
</property> </property>
<widget class="QWidget" name="tab_1"> <widget class="QWidget" name="tab_1">
<attribute name="title"> <attribute name="title">
@ -613,7 +613,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>460</x> <x>460</x>
<y>350</y> <y>410</y>
<width>160</width> <width>160</width>
<height>30</height> <height>30</height>
</rect> </rect>
@ -629,7 +629,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>10</x> <x>10</x>
<y>350</y> <y>410</y>
<width>440</width> <width>440</width>
<height>30</height> <height>30</height>
</rect> </rect>
@ -725,6 +725,22 @@
<string>Install APK</string> <string>Install APK</string>
</property> </property>
</widget> </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>
<widget class="QWidget" name="tab_2"> <widget class="QWidget" name="tab_2">
<attribute name="title"> <attribute name="title">