[tests] Test with OnlineFileSource

When we introduce OfflineFileSource, the behavior of existing tests should
not change.
This commit is contained in:
John Firebaugh
2015-12-23 14:55:12 -08:00
parent d238e00d9b
commit 7a6076ea9d
24 changed files with 76 additions and 77 deletions

View File

@@ -1,6 +1,6 @@
#include "storage.hpp"
#include <mbgl/storage/default_file_source.hpp>
#include <mbgl/storage/online_file_source.hpp>
#include <mbgl/util/exception.hpp>
#include <mbgl/util/chrono.hpp>
#include <mbgl/util/run_loop.hpp>
@@ -14,7 +14,7 @@ TEST_F(Storage, HTTPTest) {
using namespace mbgl;
util::RunLoop loop;
DefaultFileSource fs(nullptr);
OnlineFileSource fs(nullptr);
std::unique_ptr<FileRequest> req1 = fs.request({ Resource::Unknown, "http://127.0.0.1:3000/test" },
[&](Response res) {
@@ -40,7 +40,7 @@ TEST_F(Storage, HTTP404) {
using namespace mbgl;
util::RunLoop loop;
DefaultFileSource fs(nullptr);
OnlineFileSource fs(nullptr);
std::unique_ptr<FileRequest> req2 = fs.request({ Resource::Unknown, "http://127.0.0.1:3000/doesnotexist" },
[&](Response res) {
@@ -68,7 +68,7 @@ TEST_F(Storage, HTTP500) {
using namespace mbgl;
util::RunLoop loop;
DefaultFileSource fs(nullptr);
OnlineFileSource fs(nullptr);
std::unique_ptr<FileRequest> req3 = fs.request({ Resource::Unknown, "http://127.0.0.1:3000/permanent-error" },
[&](Response res) {
@@ -96,7 +96,7 @@ TEST_F(Storage, HTTPNoCallback) {
using namespace mbgl;
util::RunLoop loop;
DefaultFileSource fs(nullptr);
OnlineFileSource fs(nullptr);
try {
fs.request({ Resource::Unknown, "http://127.0.0.1:3000/test" },