mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-06 10:17:14 +00:00
TESTBED: Add CloudTests::testSavesSync()
This commit is contained in:
parent
4e27251356
commit
04888cf454
@ -43,6 +43,7 @@ CloudTestSuite::CloudTestSuite() {
|
||||
addTest("FileUpload", &CloudTests::testUploading, true);
|
||||
addTest("FileDownload", &CloudTests::testDownloading, true);
|
||||
addTest("FolderDownload", &CloudTests::testFolderDownloading, true);
|
||||
addTest("SyncSaves", &CloudTests::testSavesSync, true);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -148,6 +149,15 @@ void CloudTests::directoryDownloadedCallback(Cloud::Storage::FileArrayResponse r
|
||||
}
|
||||
}
|
||||
|
||||
void CloudTests::savesSyncedCallback(Cloud::Storage::BoolResponse response) {
|
||||
ConfParams.setCloudTestCallbackCalled(true);
|
||||
if (response.value) {
|
||||
Testsuite::logPrintf("Info! Saves are synced successfully!\n");
|
||||
} else {
|
||||
Testsuite::logPrintf("Warning! Saves were not synced!\n");
|
||||
}
|
||||
}
|
||||
|
||||
void CloudTests::errorCallback(Networking::ErrorResponse response) {
|
||||
ConfParams.setCloudTestErrorCallbackCalled(true);
|
||||
Testsuite::logPrintf("Info! Error Callback was called\n");
|
||||
@ -501,4 +511,49 @@ TestExitStatus CloudTests::testFolderDownloading() {
|
||||
return kTestPassed;
|
||||
}
|
||||
|
||||
TestExitStatus CloudTests::testSavesSync() {
|
||||
ConfParams.setCloudTestCallbackCalled(false);
|
||||
ConfParams.setCloudTestErrorCallbackCalled(false);
|
||||
|
||||
if (CloudMan.getCurrentStorage() == nullptr) {
|
||||
Testsuite::logPrintf("Couldn't find connected Storage\n");
|
||||
return kTestFailed;
|
||||
}
|
||||
|
||||
Common::String info = "Testing Cloud Storage API syncSaves() method.\n"
|
||||
"In this test we'll try to sync your saves.";
|
||||
|
||||
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
|
||||
Testsuite::logPrintf("Info! Skipping test : syncSaves()\n");
|
||||
return kTestSkipped;
|
||||
}
|
||||
|
||||
const Common::String &path = ConfMan.get("path");
|
||||
Common::FSDirectory gameRoot(path);
|
||||
Common::FSNode node = gameRoot.getFSNode().getChild("downloaded_directory");
|
||||
Common::String filepath = node.getPath();
|
||||
if (CloudMan.syncSaves(
|
||||
new Common::GlobalFunctionCallback<Cloud::Storage::BoolResponse>(&savesSyncedCallback),
|
||||
new Common::GlobalFunctionCallback<Networking::ErrorResponse>(&errorCallback)
|
||||
) == nullptr) {
|
||||
Testsuite::logPrintf("Warning! No Request is returned!\n");
|
||||
}
|
||||
|
||||
if (!waitForCallbackMore()) return kTestSkipped;
|
||||
Testsuite::clearScreen();
|
||||
|
||||
if (ConfParams.isCloudTestErrorCallbackCalled()) {
|
||||
Testsuite::logPrintf("Error callback was called\n");
|
||||
return kTestFailed;
|
||||
}
|
||||
|
||||
if (Testsuite::handleInteractiveInput("Was the CloudMan able to sync saves?", "Yes", "No", kOptionRight)) {
|
||||
Testsuite::logDetailedPrintf("Error! Saves were not synced!\n");
|
||||
return kTestFailed;
|
||||
}
|
||||
|
||||
Testsuite::logDetailedPrintf("Saves were synced successfully\n");
|
||||
return kTestPassed;
|
||||
}
|
||||
|
||||
} // End of namespace Testbed
|
||||
|
@ -42,6 +42,7 @@ void directoryCreatedCallback(Cloud::Storage::BoolResponse response);
|
||||
void fileUploadedCallback(Cloud::Storage::UploadResponse response);
|
||||
void fileDownloadedCallback(Cloud::Storage::BoolResponse response);
|
||||
void directoryDownloadedCallback(Cloud::Storage::FileArrayResponse response);
|
||||
void savesSyncedCallback(Cloud::Storage::BoolResponse response);
|
||||
void errorCallback(Networking::ErrorResponse response);
|
||||
|
||||
TestExitStatus testInfo();
|
||||
@ -50,6 +51,7 @@ TestExitStatus testDirectoryCreating();
|
||||
TestExitStatus testUploading();
|
||||
TestExitStatus testDownloading();
|
||||
TestExitStatus testFolderDownloading();
|
||||
TestExitStatus testSavesSync();
|
||||
|
||||
} // End of namespace CloudTests
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user