TESTBED: Fix CloudTests to ask users whether to wait

Callbacks might be slow (like in SyncSaves), but they also could hang
forever, so users now are being asked whether they want to wait or to
skip the test.
This commit is contained in:
Alexander Tkachev 2016-07-18 13:05:24 +06:00
parent 4a0a5af52e
commit 721ee9527e
2 changed files with 17 additions and 5 deletions

View File

@ -66,6 +66,17 @@ bool CloudTests::waitForCallback() {
return false;
}
bool CloudTests::waitForCallbackMore() {
while (!waitForCallback()) {
Common::String info = "It takes more time than expected. Do you want to skip the test or wait more?";
if (Testsuite::handleInteractiveInput(info, "Wait", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : info()\n");
return false;
}
}
return true;
}
void CloudTests::infoCallback(Cloud::Storage::StorageInfoResponse response) {
ConfParams.setCloudTestCallbackCalled(true);
Testsuite::logPrintf("Info! User's ID: %s\n", response.value.uid().c_str());
@ -147,7 +158,7 @@ TestExitStatus CloudTests::testInfo() {
Testsuite::logPrintf("Warning! No Request is returned!\n");
}
waitForCallback();
if (!waitForCallbackMore()) return kTestSkipped;
Testsuite::clearScreen();
if (ConfParams.isCloudTestErrorCallbackCalled()) {
@ -184,7 +195,7 @@ TestExitStatus CloudTests::testDirectoryListing() {
Testsuite::logPrintf("Warning! No Request is returned!\n");
}
waitForCallback();
if (!waitForCallbackMore()) return kTestSkipped;
Testsuite::clearScreen();
if (ConfParams.isCloudTestErrorCallbackCalled()) {
@ -226,7 +237,7 @@ TestExitStatus CloudTests::testDirectoryCreating() {
Testsuite::logPrintf("Warning! No Request is returned!\n");
}
waitForCallback();
if (!waitForCallbackMore()) return kTestSkipped;
Testsuite::clearScreen();
if (ConfParams.isCloudTestErrorCallbackCalled()) {
@ -245,7 +256,7 @@ TestExitStatus CloudTests::testDirectoryCreating() {
Testsuite::logPrintf("Warning! No Request is returned!\n");
}
waitForCallback();
if (!waitForCallbackMore()) return kTestSkipped;
Testsuite::clearScreen();
if (ConfParams.isCloudTestErrorCallbackCalled()) {
@ -264,7 +275,7 @@ TestExitStatus CloudTests::testDirectoryCreating() {
Testsuite::logPrintf("Warning! No Request is returned!\n");
}
waitForCallback();
if (!waitForCallbackMore()) return kTestSkipped;
Testsuite::clearScreen();
if (ConfParams.isCloudTestErrorCallbackCalled()) {

View File

@ -35,6 +35,7 @@ namespace CloudTests {
// Helper functions for Cloud tests
bool waitForCallback();
bool waitForCallbackMore();
void infoCallback(Cloud::Storage::StorageInfoResponse response);
void directoryListedCallback(Cloud::Storage::FileArrayResponse response);
void directoryCreatedCallback(Cloud::Storage::BoolResponse response);