Commit f636cbda authored by Paweł Wegner's avatar Paweł Wegner
Browse files

MockProvider: future fix.

parent a7af76ec
...@@ -52,8 +52,7 @@ IItem::Pointer MockProvider::rootDirectory() const { ...@@ -52,8 +52,7 @@ IItem::Pointer MockProvider::rootDirectory() const {
ICloudProvider::ListDirectoryRequest::Pointer MockProvider::listDirectoryAsync( ICloudProvider::ListDirectoryRequest::Pointer MockProvider::listDirectoryAsync(
IItem::Pointer directory, IListDirectoryCallback::Pointer callback) { IItem::Pointer directory, IListDirectoryCallback::Pointer callback) {
return make_unique<MockListDirectoryRequest>(directory, return make_unique<MockListDirectoryRequest>(directory, std::move(callback));
std::move(callback));
} }
ICloudProvider::GetItemRequest::Pointer MockProvider::getItemAsync( ICloudProvider::GetItemRequest::Pointer MockProvider::getItemAsync(
......
...@@ -51,10 +51,10 @@ class MockProvider : public ICloudProvider { ...@@ -51,10 +51,10 @@ class MockProvider : public ICloudProvider {
MockListDirectoryRequest(IItem::Pointer directory, MockListDirectoryRequest(IItem::Pointer directory,
IListDirectoryCallback::Pointer callback); IListDirectoryCallback::Pointer callback);
~MockListDirectoryRequest() { cancel(); } ~MockListDirectoryRequest() { cancel(); }
void finish() { result_.get(); } void finish() { result_.wait(); }
void cancel() { void cancel() {
cancelled_ = true; cancelled_ = true;
result_.get(); result_.wait();
} }
std::vector<IItem::Pointer> result() { return result_.get(); } std::vector<IItem::Pointer> result() { return result_.get(); }
...@@ -79,8 +79,8 @@ class MockProvider : public ICloudProvider { ...@@ -79,8 +79,8 @@ class MockProvider : public ICloudProvider {
public: public:
MockDownloadFileRequest(IItem::Pointer item, MockDownloadFileRequest(IItem::Pointer item,
IDownloadFileCallback::Pointer); IDownloadFileCallback::Pointer);
void finish() { function_.get(); } void finish() { function_.wait(); }
void cancel() { function_.get(); } void cancel() { function_.wait(); }
void result() { function_.get(); } void result() { function_.get(); }
private: private:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment