From 721ee9527e9ff8d028aa0ba70fb4e4c80f7e6060 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Mon, 18 Jul 2016 13:05:24 +0600 Subject: 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. --- engines/testbed/cloud.cpp | 21 ++++++++++++++++----- engines/testbed/cloud.h | 1 + 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'engines/testbed') diff --git a/engines/testbed/cloud.cpp b/engines/testbed/cloud.cpp index 655e2f72bc..73b0b8b5c1 100644 --- a/engines/testbed/cloud.cpp +++ b/engines/testbed/cloud.cpp @@ -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()) { diff --git a/engines/testbed/cloud.h b/engines/testbed/cloud.h index 827b231ea5..17bc0938c9 100644 --- a/engines/testbed/cloud.h +++ b/engines/testbed/cloud.h @@ -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); -- cgit v1.2.3