mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-06 10:17:14 +00:00
TESTBED: Add CloudTests::testFolderDownloading()
This commit is contained in:
parent
7a34abe39e
commit
4e27251356
@ -42,6 +42,7 @@ CloudTestSuite::CloudTestSuite() {
|
||||
addTest("CreateDirectory", &CloudTests::testDirectoryCreating, true);
|
||||
addTest("FileUpload", &CloudTests::testUploading, true);
|
||||
addTest("FileDownload", &CloudTests::testDownloading, true);
|
||||
addTest("FolderDownload", &CloudTests::testFolderDownloading, true);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -138,6 +139,15 @@ void CloudTests::fileDownloadedCallback(Cloud::Storage::BoolResponse response) {
|
||||
}
|
||||
}
|
||||
|
||||
void CloudTests::directoryDownloadedCallback(Cloud::Storage::FileArrayResponse response) {
|
||||
ConfParams.setCloudTestCallbackCalled(true);
|
||||
if (response.value.size() == 0) {
|
||||
Testsuite::logPrintf("Info! Directory is downloaded successfully!\n");
|
||||
} else {
|
||||
Testsuite::logPrintf("Warning! %lu files were not downloaded during folder downloading!\n", response.value.size());
|
||||
}
|
||||
}
|
||||
|
||||
void CloudTests::errorCallback(Networking::ErrorResponse response) {
|
||||
ConfParams.setCloudTestErrorCallbackCalled(true);
|
||||
Testsuite::logPrintf("Info! Error Callback was called\n");
|
||||
@ -444,4 +454,51 @@ TestExitStatus CloudTests::testDownloading() {
|
||||
return kTestPassed;
|
||||
}
|
||||
|
||||
TestExitStatus CloudTests::testFolderDownloading() {
|
||||
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 downloadFolder() method.\n"
|
||||
"In this test we'll try to download remote 'testbed/' directory.";
|
||||
|
||||
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
|
||||
Testsuite::logPrintf("Info! Skipping test : downloadFolder()\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.downloadFolder(
|
||||
"/testbed/",
|
||||
filepath.c_str(),
|
||||
new Common::GlobalFunctionCallback<Cloud::Storage::FileArrayResponse>(&directoryDownloadedCallback),
|
||||
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 download into 'testbed/downloaded_directory'?", "Yes", "No", kOptionRight)) {
|
||||
Testsuite::logDetailedPrintf("Error! Directory was not downloaded!\n");
|
||||
return kTestFailed;
|
||||
}
|
||||
|
||||
Testsuite::logDetailedPrintf("Directory was downloaded\n");
|
||||
return kTestPassed;
|
||||
}
|
||||
|
||||
} // End of namespace Testbed
|
||||
|
@ -41,6 +41,7 @@ void directoryListedCallback(Cloud::Storage::FileArrayResponse response);
|
||||
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 errorCallback(Networking::ErrorResponse response);
|
||||
|
||||
TestExitStatus testInfo();
|
||||
@ -48,6 +49,7 @@ TestExitStatus testDirectoryListing();
|
||||
TestExitStatus testDirectoryCreating();
|
||||
TestExitStatus testUploading();
|
||||
TestExitStatus testDownloading();
|
||||
TestExitStatus testFolderDownloading();
|
||||
|
||||
} // End of namespace CloudTests
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user