summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2015-12-23 14:55:12 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2015-12-23 14:55:12 -0800
commit7a6076ea9df72f34565d8f316f8c5c19279677b8 (patch)
tree0018a698e9fa97273c5b515b71ccf0b8f7398253 /include
parentd238e00d9b1e78e98392ac2cab30f8a2fcd3c1fd (diff)
downloadqtlocation-mapboxgl-7a6076ea9df72f34565d8f316f8c5c19279677b8.tar.gz
[tests] Test with OnlineFileSource
When we introduce OfflineFileSource, the behavior of existing tests should not change.
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/storage/online_file_source.hpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/include/mbgl/storage/online_file_source.hpp b/include/mbgl/storage/online_file_source.hpp
new file mode 100644
index 0000000000..357b1773d7
--- /dev/null
+++ b/include/mbgl/storage/online_file_source.hpp
@@ -0,0 +1,34 @@
+#ifndef MBGL_STORAGE_ONLINE_FILE_SOURCE
+#define MBGL_STORAGE_ONLINE_FILE_SOURCE
+
+#include <mbgl/storage/file_source.hpp>
+#include <mbgl/storage/file_cache.hpp>
+
+namespace mbgl {
+
+namespace util {
+template <typename T> class Thread;
+} // namespace util
+
+class OnlineFileSource : public FileSource {
+public:
+ OnlineFileSource(FileCache *cache, const std::string &root = "");
+ ~OnlineFileSource() override;
+
+ void setAccessToken(const std::string& t) { accessToken = t; }
+ std::string getAccessToken() const { return accessToken; }
+
+ std::unique_ptr<FileRequest> request(const Resource&, Callback) override;
+
+private:
+ friend class OnlineFileRequest;
+ void cancel(const Resource&, FileRequest*);
+
+ class Impl;
+ const std::unique_ptr<util::Thread<Impl>> thread;
+ std::string accessToken;
+};
+
+} // namespace mbgl
+
+#endif