From dcf904192630d1c180d60ff7989e3629ca5fc1b7 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Mon, 18 Jul 2016 15:50:41 +0600 Subject: TESTBED: Fix CloudTests Now work with all available Storages. --- engines/testbed/cloud.cpp | 28 +++++++++++++++++----------- engines/testbed/cloud.h | 1 + 2 files changed, 18 insertions(+), 11 deletions(-) (limited to 'engines/testbed') diff --git a/engines/testbed/cloud.cpp b/engines/testbed/cloud.cpp index 9d10d7d051..775ae1037c 100644 --- a/engines/testbed/cloud.cpp +++ b/engines/testbed/cloud.cpp @@ -81,6 +81,12 @@ bool CloudTests::waitForCallbackMore() { return true; } +const char *CloudTests::getRemoteTestPath() { + if (CloudMan.getStorageIndex() == Cloud::kStorageDropboxId) + return "/testbed"; + return "testbed"; +} + void CloudTests::infoCallback(Cloud::Storage::StorageInfoResponse response) { ConfParams.setCloudTestCallbackCalled(true); Testsuite::logPrintf("Info! User's ID: %s\n", response.value.uid().c_str()); @@ -286,7 +292,7 @@ TestExitStatus CloudTests::testDirectoryCreating() { // create 'testbed' if (CloudMan.getCurrentStorage()->createDirectory( - "/testbed", + getRemoteTestPath(), new Common::GlobalFunctionCallback(&directoryCreatedCallback), new Common::GlobalFunctionCallback(&errorCallback) ) == nullptr) { @@ -359,7 +365,7 @@ TestExitStatus CloudTests::testUploading() { if (CloudMan.getCurrentStorage()->uploadStreamSupported()) { if (CloudMan.getCurrentStorage()->upload( - "/testbed/testfile.txt", + Common::String(getRemoteTestPath()) + "/testfile.txt", node.createReadStream(), new Common::GlobalFunctionCallback(&fileUploadedCallback), new Common::GlobalFunctionCallback(&errorCallback) @@ -369,10 +375,10 @@ TestExitStatus CloudTests::testUploading() { } else { Common::String filepath = node.getPath(); if (CloudMan.getCurrentStorage()->upload( - "/testbed/testfile.txt", - filepath.c_str(), - new Common::GlobalFunctionCallback(&fileUploadedCallback), - new Common::GlobalFunctionCallback(&errorCallback) + Common::String(getRemoteTestPath()) + "/testfile.txt", + filepath.c_str(), + new Common::GlobalFunctionCallback(&fileUploadedCallback), + new Common::GlobalFunctionCallback(&errorCallback) ) == nullptr) { Testsuite::logPrintf("Warning! No Request is returned!\n"); } @@ -392,9 +398,9 @@ TestExitStatus CloudTests::testUploading() { ConfParams.setCloudTestCallbackCalled(false); if (CloudMan.listDirectory( - "/testbed/", - new Common::GlobalFunctionCallback(&directoryListedCallback), - new Common::GlobalFunctionCallback(&errorCallback) + getRemoteTestPath(), + new Common::GlobalFunctionCallback(&directoryListedCallback), + new Common::GlobalFunctionCallback(&errorCallback) ) == nullptr) { Testsuite::logPrintf("Warning! No Request is returned!\n"); } @@ -439,7 +445,7 @@ TestExitStatus CloudTests::testDownloading() { Common::FSNode node = gameRoot.getFSNode().getChild("downloaded_file.txt"); Common::String filepath = node.getPath(); if (CloudMan.getCurrentStorage()->download( - "/testbed/testfile.txt", + Common::String(getRemoteTestPath()) + "/testfile.txt", filepath.c_str(), new Common::GlobalFunctionCallback(&fileDownloadedCallback), new Common::GlobalFunctionCallback(&errorCallback) @@ -486,7 +492,7 @@ TestExitStatus CloudTests::testFolderDownloading() { Common::FSNode node = gameRoot.getFSNode().getChild("downloaded_directory"); Common::String filepath = node.getPath(); if (CloudMan.downloadFolder( - "/testbed/", + getRemoteTestPath(), filepath.c_str(), new Common::GlobalFunctionCallback(&directoryDownloadedCallback), new Common::GlobalFunctionCallback(&errorCallback) diff --git a/engines/testbed/cloud.h b/engines/testbed/cloud.h index aa6ed8706e..ed27d7da82 100644 --- a/engines/testbed/cloud.h +++ b/engines/testbed/cloud.h @@ -36,6 +36,7 @@ namespace CloudTests { bool waitForCallback(); bool waitForCallbackMore(); +const char *getRemoteTestPath(); void infoCallback(Cloud::Storage::StorageInfoResponse response); void directoryListedCallback(Cloud::Storage::FileArrayResponse response); void directoryCreatedCallback(Cloud::Storage::BoolResponse response); -- cgit v1.2.3