summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-10-09 12:59:27 +0200
committerKonstantin Käfer <mail@kkaefer.com>2017-10-12 17:58:03 +0200
commit78ea88d757ecf3a0a75b786ae343d746617ba46b (patch)
tree10efd5d389ce7290526e58b393a4c11b73ce3fe0 /test
parent56446c5d17ac74aa9bf39bdd3c8d1e9629d8fd41 (diff)
downloadqtlocation-mapboxgl-78ea88d757ecf3a0a75b786ae343d746617ba46b.tar.gz
[core] make forcing cache/network only more explicit
Previously, we used the existence of a `prior*` field in the Resource object as an indication for whether we should consult the cache or not. However, this is prone to error, since a failed cache lookup won't set any prior fields. Therefore, we manually set `priorExpires` to 0. This in turn triggered another bug where generated wrong expiration timestamps when the server response we got was expired (or expired between sending and receiving). This commit changes the flags so that we can now explicitly request CacheOnly/NetworkOnly (or All) loading methods, rather than the implicit Optional/Required naming scheme.
Diffstat (limited to 'test')
-rw-r--r--test/algorithm/mock.hpp2
-rw-r--r--test/algorithm/update_renderables.test.cpp230
-rw-r--r--test/storage/default_file_source.test.cpp26
3 files changed, 129 insertions, 129 deletions
diff --git a/test/algorithm/mock.hpp b/test/algorithm/mock.hpp
index d87f55343b..b8eb020105 100644
--- a/test/algorithm/mock.hpp
+++ b/test/algorithm/mock.hpp
@@ -26,7 +26,7 @@ struct MockBucket {};
struct MockTileData {
MockTileData(const mbgl::OverscaledTileID& tileID_) : tileID(tileID_) {}
- bool hasTriedOptional() const {
+ bool hasTriedCache() const {
return triedOptional;
}
diff --git a/test/algorithm/update_renderables.test.cpp b/test/algorithm/update_renderables.test.cpp
index 2d37992579..7d6a0fcb13 100644
--- a/test/algorithm/update_renderables.test.cpp
+++ b/test/algorithm/update_renderables.test.cpp
@@ -45,7 +45,7 @@ std::ostream& operator<<(std::ostream& os, const CreateTileDataAction& action) {
struct RetainTileDataAction {
const OverscaledTileID tileID;
- const Resource::Necessity necessity;
+ const TileNecessity necessity;
bool operator==(const RetainTileDataAction& rhs) const {
return tileID == rhs.tileID && necessity == rhs.necessity;
@@ -56,7 +56,7 @@ std::ostream& operator<<(std::ostream& os, const RetainTileDataAction& action) {
return os << "RetainTileDataAction{ { " << int(action.tileID.overscaledZ) << ", " << int(action.tileID.wrap) << ", { "
<< int(action.tileID.canonical.z) << ", " << action.tileID.canonical.x << ", "
<< action.tileID.canonical.y << " } }, "
- << (action.necessity == Resource::Necessity::Required ? "Required" : "Optional") << " }\n";
+ << (action.necessity == TileNecessity::Required ? "Required" : "Optional") << " }\n";
}
struct RenderTileAction {
@@ -102,7 +102,7 @@ auto createTileDataFn(ActionLog& log, T& dataTiles) {
template <typename = int>
auto retainTileDataFn(ActionLog& log) {
- return [&](auto& tileData, Resource::Necessity necessity) {
+ return [&](auto& tileData, TileNecessity necessity) {
log.emplace_back(RetainTileDataAction{ tileData.tileID, necessity });
};
}
@@ -132,7 +132,7 @@ TEST(UpdateRenderables, SingleTile) {
source.idealTiles, source.zoomRange, 1);
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 1, 0, { 1, 1, 1 } }, Found }, // found ideal tile
- RetainTileDataAction{ { 1, 0, { 1, 1, 1 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 1, 0, { 1, 1, 1 } }, TileNecessity::Required }, //
RenderTileAction{ { 1, 1, 1 }, *tile_1_1_1_1 }, // render ideal tile
}),
log);
@@ -143,7 +143,7 @@ TEST(UpdateRenderables, SingleTile) {
source.idealTiles, source.zoomRange, 1);
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 1, 0, { 1, 1, 1 } }, Found }, // found ideal tile
- RetainTileDataAction{ { 1, 0, { 1, 1, 1 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 1, 0, { 1, 1, 1 } }, TileNecessity::Required }, //
RenderTileAction{ { 1, 1, 1 }, *tile_1_1_1_1 }, // render ideal tile
}),
log);
@@ -156,7 +156,7 @@ TEST(UpdateRenderables, SingleTile) {
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 1, 0, { 1, 0, 1 } }, NotFound }, // missing ideal tile
CreateTileDataAction{ { 1, 0, { 1, 0, 1 } } }, // create ideal tile
- RetainTileDataAction{ { 1, 0, { 1, 0, 1 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 1, 0, { 1, 0, 1 } }, TileNecessity::Required }, //
GetTileDataAction{ { 2, 0, { 2, 0, 2 } }, NotFound }, // four child tiles
GetTileDataAction{ { 2, 0, { 2, 0, 3 } }, NotFound }, // ...
GetTileDataAction{ { 2, 0, { 2, 1, 2 } }, NotFound }, // ...
@@ -164,7 +164,7 @@ TEST(UpdateRenderables, SingleTile) {
GetTileDataAction{ { 0, 0, { 0, 0, 0 } }, NotFound }, // parent tile
GetTileDataAction{ { 1, 0, { 1, 1, 1 } }, Found }, // found ideal tile
- RetainTileDataAction{ { 1, 0, { 1, 1, 1 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 1, 0, { 1, 1, 1 } }, TileNecessity::Required }, //
RenderTileAction{ { 1, 1, 1 }, *tile_1_1_1_1 }, // render found tile
}),
log);
@@ -176,17 +176,17 @@ TEST(UpdateRenderables, SingleTile) {
source.idealTiles, source.zoomRange, 1);
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 1, 0, { 1, 0, 1 } }, Found }, // missing ideal tile
- RetainTileDataAction{ { 1, 0, { 1, 0, 1 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 1, 0, { 1, 0, 1 } }, TileNecessity::Required }, //
GetTileDataAction{ { 2, 0, { 2, 0, 2 } }, NotFound }, // four child tiles
GetTileDataAction{ { 2, 0, { 2, 0, 3 } }, NotFound }, // ...
GetTileDataAction{ { 2, 0, { 2, 1, 2 } }, NotFound }, // ...
GetTileDataAction{ { 2, 0, { 2, 1, 3 } }, NotFound }, // ...
GetTileDataAction{ { 0, 0, { 0, 0, 0 } }, NotFound }, // parent tile
CreateTileDataAction{ { 0, 0, { 0, 0, 0 } } }, // load parent tile
- RetainTileDataAction{ { 0, 0, { 0, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 0, 0, { 0, 0, 0 } }, TileNecessity::Optional }, //
GetTileDataAction{ { 1, 0, { 1, 1, 1 } }, Found }, // found ideal tile
- RetainTileDataAction{ { 1, 0, { 1, 1, 1 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 1, 0, { 1, 1, 1 } }, TileNecessity::Required }, //
RenderTileAction{ { 1, 1, 1 }, *tile_1_1_1_1 }, // render found tile
}),
log);
@@ -199,11 +199,11 @@ TEST(UpdateRenderables, SingleTile) {
source.idealTiles, source.zoomRange, 1);
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 1, 0, { 1, 0, 1 } }, Found }, // newly added tile
- RetainTileDataAction{ { 1, 0, { 1, 0, 1 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 1, 0, { 1, 0, 1 } }, TileNecessity::Required }, //
RenderTileAction{ { 1, 0, 1 }, *tile_1_1_0_1 }, // render ideal tile
GetTileDataAction{ { 1, 0, { 1, 1, 1 } }, Found }, // ideal tile
- RetainTileDataAction{ { 1, 0, { 1, 1, 1 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 1, 0, { 1, 1, 1 } }, TileNecessity::Required }, //
RenderTileAction{ { 1, 1, 1 }, *tile_1_1_1_1 }, // render found tile
}),
log);
@@ -218,21 +218,21 @@ TEST(UpdateRenderables, SingleTile) {
source.idealTiles, source.zoomRange, 1);
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 1, 0, { 1, 0, 0 } }, Found }, // found tile, not ready
- RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 2, 0, { 2, 0, 0 } }, NotFound }, // four child tiles
GetTileDataAction{ { 2, 0, { 2, 0, 1 } }, NotFound }, // ...
GetTileDataAction{ { 2, 0, { 2, 1, 0 } }, NotFound }, // ...
GetTileDataAction{ { 2, 0, { 2, 1, 1 } }, NotFound }, // ...
GetTileDataAction{ { 0, 0, { 0, 0, 0 } }, Found }, // parent tile
- RetainTileDataAction{ { 0, 0, { 0, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 0, 0, { 0, 0, 0 } }, TileNecessity::Optional }, //
// optional parent tile was already created before, but is not renderable
GetTileDataAction{ { 1, 0, { 1, 0, 1 } }, Found }, // ideal tile
- RetainTileDataAction{ { 1, 0, { 1, 0, 1 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 1, 0, { 1, 0, 1 } }, TileNecessity::Required }, //
RenderTileAction{ { 1, 0, 1 }, *tile_1_1_0_1 }, // render ideal tile
GetTileDataAction{ { 1, 0, { 1, 1, 1 } }, Found }, // ideal tile
- RetainTileDataAction{ { 1, 0, { 1, 1, 1 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 1, 0, { 1, 1, 1 } }, TileNecessity::Required }, //
RenderTileAction{ { 1, 1, 1 }, *tile_1_1_1_1 }, // render ideal tile
}),
log);
@@ -244,15 +244,15 @@ TEST(UpdateRenderables, SingleTile) {
source.idealTiles, source.zoomRange, 1);
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 1, 0, { 1, 0, 0 } }, Found }, // found tile, now ready
- RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, TileNecessity::Required }, //
RenderTileAction{ { 1, 0, 0 }, *tile_1_1_0_0 }, //
GetTileDataAction{ { 1, 0, { 1, 0, 1 } }, Found }, // ideal tile
- RetainTileDataAction{ { 1, 0, { 1, 0, 1 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 1, 0, { 1, 0, 1 } }, TileNecessity::Required }, //
RenderTileAction{ { 1, 0, 1 }, *tile_1_1_0_1 }, //
GetTileDataAction{ { 1, 0, { 1, 1, 1 } }, Found }, // ideal tile
- RetainTileDataAction{ { 1, 0, { 1, 1, 1 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 1, 0, { 1, 1, 1 } }, TileNecessity::Required }, //
RenderTileAction{ { 1, 1, 1 }, *tile_1_1_1_1 }, //
}),
log);
@@ -278,24 +278,24 @@ TEST(UpdateRenderables, UseParentTile) {
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 1, 0, { 1, 0, 1 } }, NotFound }, // missing ideal tile
CreateTileDataAction{ { 1, 0, { 1, 0, 1 } } }, //
- RetainTileDataAction{ { 1, 0, { 1, 0, 1 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 1, 0, { 1, 0, 1 } }, TileNecessity::Required }, //
GetTileDataAction{ { 2, 0, { 2, 0, 2 } }, NotFound }, // child tile
GetTileDataAction{ { 2, 0, { 2, 0, 3 } }, NotFound }, // ...
GetTileDataAction{ { 2, 0, { 2, 1, 2 } }, NotFound }, // ...
GetTileDataAction{ { 2, 0, { 2, 1, 3 } }, NotFound }, // ...
GetTileDataAction{ { 0, 0, { 0, 0, 0 } }, Found }, // parent found!
- RetainTileDataAction{ { 0, 0, { 0, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 0, 0, { 0, 0, 0 } }, TileNecessity::Optional }, //
RenderTileAction{ { 0, 0, 0 }, *tile_0_0_0_0 }, // render parent
GetTileDataAction{ { 1, 0, { 1, 1, 0 } }, NotFound }, // missing ideal tile
CreateTileDataAction{ { 1, 0, { 1, 1, 0 } } }, //
- RetainTileDataAction{ { 1, 0, { 1, 1, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 1, 0, { 1, 1, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 2, 0, { 2, 2, 0 } }, NotFound }, // child tile
GetTileDataAction{ { 2, 0, { 2, 2, 1 } }, NotFound }, // ...
GetTileDataAction{ { 2, 0, { 2, 3, 0 } }, NotFound }, // ...
GetTileDataAction{ { 2, 0, { 2, 3, 1 } }, NotFound }, // ...
GetTileDataAction{ { 1, 0, { 1, 1, 1 } }, NotFound }, // missing tile
CreateTileDataAction{ { 1, 0, { 1, 1, 1 } } }, //
- RetainTileDataAction{ { 1, 0, { 1, 1, 1 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 1, 0, { 1, 1, 1 } }, TileNecessity::Required }, //
GetTileDataAction{ { 2, 0, { 2, 2, 2 } }, NotFound }, // child tile
GetTileDataAction{ { 2, 0, { 2, 2, 3 } }, NotFound }, // ...
GetTileDataAction{ { 2, 0, { 2, 3, 2 } }, NotFound }, // ...
@@ -321,7 +321,7 @@ TEST(UpdateRenderables, DontUseWrongParentTile) {
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 2, 0, { 2, 0, 0 } }, NotFound }, // missing ideal tile
CreateTileDataAction{ { 2, 0, { 2, 0, 0 } } }, //
- RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 3, 0, { 3, 0, 0 } }, NotFound }, // child tile
GetTileDataAction{ { 3, 0, { 3, 0, 1 } }, NotFound }, // ...
GetTileDataAction{ { 3, 0, { 3, 1, 0 } }, NotFound }, // ...
@@ -338,14 +338,14 @@ TEST(UpdateRenderables, DontUseWrongParentTile) {
source.idealTiles, source.zoomRange, 2);
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 2, 0, { 2, 0, 0 } }, Found }, // non-ready ideal tile
- RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 3, 0, { 3, 0, 0 } }, NotFound }, // child tile
GetTileDataAction{ { 3, 0, { 3, 0, 1 } }, NotFound }, // ...
GetTileDataAction{ { 3, 0, { 3, 1, 0 } }, NotFound }, // ...
GetTileDataAction{ { 3, 0, { 3, 1, 1 } }, NotFound }, // ...
GetTileDataAction{ { 1, 0, { 1, 0, 0 } }, NotFound }, // parent tile, missing
CreateTileDataAction{ { 1, 0, { 1, 0, 0 } } }, // find optional parent
- RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, TileNecessity::Optional }, //
GetTileDataAction{ { 0, 0, { 0, 0, 0 } }, NotFound }, // parent tile, missing
}),
log);
@@ -357,25 +357,25 @@ TEST(UpdateRenderables, DontUseWrongParentTile) {
source.idealTiles, source.zoomRange, 2);
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 2, 0, { 2, 0, 0 } }, Found }, // non-ready ideal tile
- RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, TileNecessity::Required }, //
// this tile was added by the previous invocation of updateRenderables
GetTileDataAction{ { 3, 0, { 3, 0, 0 } }, NotFound }, // child tile
GetTileDataAction{ { 3, 0, { 3, 0, 1 } }, NotFound }, // ...
GetTileDataAction{ { 3, 0, { 3, 1, 0 } }, NotFound }, // ...
GetTileDataAction{ { 3, 0, { 3, 1, 1 } }, NotFound }, // ...
GetTileDataAction{ { 1, 0, { 1, 0, 0 } }, Found }, // parent tile not ready
- RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, TileNecessity::Optional }, //
GetTileDataAction{ { 0, 0, { 0, 0, 0 } }, NotFound }, // missing parent tile
GetTileDataAction{ { 2, 0, { 2, 2, 0 } }, NotFound }, // missing ideal tile
CreateTileDataAction{ { 2, 0, { 2, 2, 0 } } }, //
- RetainTileDataAction{ { 2, 0, { 2, 2, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 2, 0, { 2, 2, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 3, 0, { 3, 4, 0 } }, NotFound }, // child tile
GetTileDataAction{ { 3, 0, { 3, 4, 1 } }, NotFound }, // ...
GetTileDataAction{ { 3, 0, { 3, 5, 0 } }, NotFound }, // ...
GetTileDataAction{ { 3, 0, { 3, 5, 1 } }, NotFound }, // ...
GetTileDataAction{ { 1, 0, { 1, 1, 0 } }, Found }, // found parent tile
- RetainTileDataAction{ { 1, 0, { 1, 1, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 1, 0, { 1, 1, 0 } }, TileNecessity::Optional }, //
RenderTileAction{ { 1, 1, 0 }, *tile_1_1_1_0 }, // render parent tile
}),
log);
@@ -402,13 +402,13 @@ TEST(UpdateRenderables, UseParentTileWhenChildNotReady) {
source.idealTiles, source.zoomRange, 1);
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 1, 0, { 1, 0, 1 } }, Found }, // found, but not ready
- RetainTileDataAction{ { 1, 0, { 1, 0, 1 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 1, 0, { 1, 0, 1 } }, TileNecessity::Required }, //
GetTileDataAction{ { 2, 0, { 2, 0, 2 } }, NotFound }, // child tile
GetTileDataAction{ { 2, 0, { 2, 0, 3 } }, NotFound }, // ...
GetTileDataAction{ { 2, 0, { 2, 1, 2 } }, NotFound }, // ...
GetTileDataAction{ { 2, 0, { 2, 1, 3 } }, NotFound }, // ...
GetTileDataAction{ { 0, 0, { 0, 0, 0 } }, Found }, // parent tile, ready
- RetainTileDataAction{ { 0, 0, { 0, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 0, 0, { 0, 0, 0 } }, TileNecessity::Optional }, //
RenderTileAction{ { 0, 0, 0 }, *tile_0_0_0_0 }, // render parent tile
}),
log);
@@ -420,7 +420,7 @@ TEST(UpdateRenderables, UseParentTileWhenChildNotReady) {
source.idealTiles, source.zoomRange, 1);
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 1, 0, { 1, 0, 1 } }, Found }, // found and ready
- RetainTileDataAction{ { 1, 0, { 1, 0, 1 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 1, 0, { 1, 0, 1 } }, TileNecessity::Required }, //
RenderTileAction{ { 1, 0, 1 }, *tile_1_1_0_1 }, // render ideal tile
}),
log);
@@ -448,17 +448,17 @@ TEST(UpdateRenderables, UseOverlappingParentTile) {
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 1, 0, { 1, 0, 0 } }, NotFound }, // ideal tile not found
CreateTileDataAction{ { 1, 0, { 1, 0, 0 } } }, //
- RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 2, 0, { 2, 0, 0 } }, NotFound }, // child tile
GetTileDataAction{ { 2, 0, { 2, 0, 1 } }, NotFound }, // ...
GetTileDataAction{ { 2, 0, { 2, 1, 0 } }, NotFound }, // ...
GetTileDataAction{ { 2, 0, { 2, 1, 1 } }, NotFound }, // ...
GetTileDataAction{ { 0, 0, { 0, 0, 0 } }, Found }, // parent tile found
- RetainTileDataAction{ { 0, 0, { 0, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 0, 0, { 0, 0, 0 } }, TileNecessity::Optional }, //
RenderTileAction{ { 0, 0, 0 }, *tile_0_0_0_0 }, //
GetTileDataAction{ { 1, 0, { 1, 0, 1 } }, Found }, // ideal tile found
- RetainTileDataAction{ { 1, 0, { 1, 0, 1 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 1, 0, { 1, 0, 1 } }, TileNecessity::Required }, //
RenderTileAction{ { 1, 0, 1 }, *tile_1_1_0_1 }, //
}),
log);
@@ -484,13 +484,13 @@ TEST(UpdateRenderables, UseChildTiles) {
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 0, 0, { 0, 0, 0 } }, NotFound }, // ideal tile, missing
CreateTileDataAction{ { 0, 0, { 0, 0, 0 } } }, //
- RetainTileDataAction{ { 0, 0, { 0, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 0, 0, { 0, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 1, 0, { 1, 0, 0 } }, Found }, // child tile found
- RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, TileNecessity::Optional }, //
RenderTileAction{ { 1, 0, 0 }, *tile_1_1_0_0 }, // render child tile
GetTileDataAction{ { 1, 0, { 1, 0, 1 } }, NotFound }, // child tile not found
GetTileDataAction{ { 1, 0, { 1, 1, 0 } }, Found }, // child tile found
- RetainTileDataAction{ { 1, 0, { 1, 1, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 1, 0, { 1, 1, 0 } }, TileNecessity::Optional }, //
RenderTileAction{ { 1, 1, 0 }, *tile_1_1_1_0 }, // render child tile
GetTileDataAction{ { 1, 0, { 1, 1, 1 } }, NotFound }, // child tile not found
// no parent tile of 0 to consider
@@ -518,15 +518,15 @@ TEST(UpdateRenderables, PreferChildTiles) {
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 1, 0, { 1, 0, 0 } }, NotFound }, // ideal tile, not found
CreateTileDataAction{ { 1, 0, { 1, 0, 0 } } }, //
- RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 2, 0, { 2, 0, 0 } }, Found }, // child tile, found
- RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, TileNecessity::Optional }, //
RenderTileAction{ { 2, 0, 0 }, *tile_2_2_0_0 }, //
GetTileDataAction{ { 2, 0, { 2, 0, 1 } }, NotFound }, // child tile, not found
GetTileDataAction{ { 2, 0, { 2, 1, 0 } }, NotFound }, // ...
GetTileDataAction{ { 2, 0, { 2, 1, 1 } }, NotFound }, // ...
GetTileDataAction{ { 0, 0, { 0, 0, 0 } }, Found }, // parent tile, found
- RetainTileDataAction{ { 0, 0, { 0, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 0, 0, { 0, 0, 0 } }, TileNecessity::Optional }, //
RenderTileAction{ { 0, 0, 0 }, *tile_0_0_0_0 }, //
}),
log);
@@ -541,17 +541,17 @@ TEST(UpdateRenderables, PreferChildTiles) {
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 1, 0, { 1, 0, 0 } }, Found }, // ideal tile, not ready
// ideal tile was added in previous invocation, but is not yet ready
- RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 2, 0, { 2, 0, 0 } }, Found }, // child tile, found
- RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, TileNecessity::Optional }, //
RenderTileAction{ { 2, 0, 0 }, *tile_2_2_0_0 }, //
GetTileDataAction{ { 2, 0, { 2, 0, 1 } }, Found }, // ...
- RetainTileDataAction{ { 2, 0, { 2, 0, 1 } }, Resource::Necessity::Optional }, // ...
+ RetainTileDataAction{ { 2, 0, { 2, 0, 1 } }, TileNecessity::Optional }, // ...
RenderTileAction{ { 2, 0, 1 }, *tile_2_2_0_1 }, //
GetTileDataAction{ { 2, 0, { 2, 1, 0 } }, NotFound }, // child tile, not found
GetTileDataAction{ { 2, 0, { 2, 1, 1 } }, NotFound }, // ...
GetTileDataAction{ { 0, 0, { 0, 0, 0 } }, Found }, // parent tile, found
- RetainTileDataAction{ { 0, 0, { 0, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 0, 0, { 0, 0, 0 } }, TileNecessity::Optional }, //
RenderTileAction{ { 0, 0, 0 }, *tile_0_0_0_0 }, //
}),
log);
@@ -564,19 +564,19 @@ TEST(UpdateRenderables, PreferChildTiles) {
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 1, 0, { 1, 0, 0 } }, Found }, // ideal tile, not ready
// ideal tile was added in first invocation, but is not yet ready
- RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 2, 0, { 2, 0, 0 } }, Found }, // child tile, found
- RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, TileNecessity::Optional }, //
RenderTileAction{ { 2, 0, 0 }, *tile_2_2_0_0 }, //
GetTileDataAction{ { 2, 0, { 2, 0, 1 } }, Found }, // ...
- RetainTileDataAction{ { 2, 0, { 2, 0, 1 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 2, 0, { 2, 0, 1 } }, TileNecessity::Optional }, //
RenderTileAction{ { 2, 0, 1 }, *tile_2_2_0_1 }, //
GetTileDataAction{ { 2, 0, { 2, 1, 0 } }, Found }, // ...
- RetainTileDataAction{ { 2, 0, { 2, 1, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 2, 0, { 2, 1, 0 } }, TileNecessity::Optional }, //
RenderTileAction{ { 2, 1, 0 }, *tile_2_2_1_0 }, //
GetTileDataAction{ { 2, 0, { 2, 1, 1 } }, NotFound }, // child tile, not found
GetTileDataAction{ { 0, 0, { 0, 0, 0 } }, Found }, // parent tile, found
- RetainTileDataAction{ { 0, 0, { 0, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 0, 0, { 0, 0, 0 } }, TileNecessity::Optional }, //
RenderTileAction{ { 0, 0, 0 }, *tile_0_0_0_0 }, //
}),
log);
@@ -590,18 +590,18 @@ TEST(UpdateRenderables, PreferChildTiles) {
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 1, 0, { 1, 0, 0 } }, Found }, // ideal tile, not ready
// ideal tile was added in first invocation, but is not yet ready
- RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 2, 0, { 2, 0, 0 } }, Found }, // child tile, found
- RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, TileNecessity::Optional }, //
RenderTileAction{ { 2, 0, 0 }, *tile_2_2_0_0 }, //
GetTileDataAction{ { 2, 0, { 2, 0, 1 } }, Found }, // ...
- RetainTileDataAction{ { 2, 0, { 2, 0, 1 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 2, 0, { 2, 0, 1 } }, TileNecessity::Optional }, //
RenderTileAction{ { 2, 0, 1 }, *tile_2_2_0_1 }, //
GetTileDataAction{ { 2, 0, { 2, 1, 0 } }, Found }, // ...
- RetainTileDataAction{ { 2, 0, { 2, 1, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 2, 0, { 2, 1, 0 } }, TileNecessity::Optional }, //
RenderTileAction{ { 2, 1, 0 }, *tile_2_2_1_0 }, //
GetTileDataAction{ { 2, 0, { 2, 1, 1 } }, Found }, // ...
- RetainTileDataAction{ { 2, 0, { 2, 1, 1 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 2, 0, { 2, 1, 1 } }, TileNecessity::Optional }, //
RenderTileAction{ { 2, 1, 1 }, *tile_2_2_1_1 }, //
}),
log);
@@ -628,15 +628,15 @@ TEST(UpdateRenderables, UseParentAndChildTiles) {
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 1, 0, { 1, 0, 0 } }, NotFound }, // ideal tile, missing
CreateTileDataAction{ { 1, 0, { 1, 0, 0 } } }, //
- RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 2, 0, { 2, 0, 0 } }, Found }, // child tile
- RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, TileNecessity::Optional }, //
RenderTileAction{ { 2, 0, 0 }, *tile_2_2_0_0 }, //
GetTileDataAction{ { 2, 0, { 2, 0, 1 } }, NotFound }, //
GetTileDataAction{ { 2, 0, { 2, 1, 0 } }, NotFound }, //
GetTileDataAction{ { 2, 0, { 2, 1, 1 } }, NotFound }, //
GetTileDataAction{ { 0, 0, { 0, 0, 0 } }, Found }, // parent tile
- RetainTileDataAction{ { 0, 0, { 0, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 0, 0, { 0, 0, 0 } }, TileNecessity::Optional }, //
RenderTileAction{ { 0, 0, 0 }, *tile_0_0_0_0 }, //
}),
log);
@@ -648,13 +648,13 @@ TEST(UpdateRenderables, UseParentAndChildTiles) {
source.idealTiles, source.zoomRange, 1);
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 1, 0, { 1, 0, 0 } }, Found }, // ideal tile, not ready
- RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 2, 0, { 2, 0, 0 } }, NotFound }, //
GetTileDataAction{ { 2, 0, { 2, 0, 1 } }, NotFound }, //
GetTileDataAction{ { 2, 0, { 2, 1, 0 } }, NotFound }, //
GetTileDataAction{ { 2, 0, { 2, 1, 1 } }, NotFound }, //
GetTileDataAction{ { 0, 0, { 0, 0, 0 } }, Found }, // parent tile
- RetainTileDataAction{ { 0, 0, { 0, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 0, 0, { 0, 0, 0 } }, TileNecessity::Optional }, //
RenderTileAction{ { 0, 0, 0 }, *tile_0_0_0_0 }, //
}),
log);
@@ -679,7 +679,7 @@ TEST(UpdateRenderables, DontUseTilesLowerThanMinzoom) {
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 2, 0, { 2, 0, 0 } }, NotFound }, // ideal tile, missing
CreateTileDataAction{ { 2, 0, { 2, 0, 0 } } }, //
- RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 3, 0, { 3, 0, 0 } }, NotFound }, //
GetTileDataAction{ { 3, 0, { 3, 0, 1 } }, NotFound }, //
GetTileDataAction{ { 3, 0, { 3, 1, 0 } }, NotFound }, //
@@ -709,7 +709,7 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) {
ActionLog({
GetTileDataAction{ { 2, 0, { 2, 0, 0 } }, NotFound }, // ideal tile, missing
CreateTileDataAction{ { 2, 0, { 2, 0, 0 } } }, //
- RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 3, 0, { 2, 0, 0 } }, NotFound }, // overzoomed tile, not children!
GetTileDataAction{ { 1, 0, { 1, 0, 0 } }, NotFound }, //
GetTileDataAction{ { 0, 0, { 0, 0, 0 } }, NotFound }, //
@@ -724,11 +724,11 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) {
EXPECT_EQ(
ActionLog({
GetTileDataAction{ { 2, 0, { 2, 0, 0 } }, Found }, // ideal tile, missing
- RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 3, 0, { 2, 0, 0 } }, NotFound }, // overzoomed tile, not children!
GetTileDataAction{ { 1, 0, { 1, 0, 0 } }, NotFound }, //
CreateTileDataAction{ { 1, 0, { 1, 0, 0 } } }, //
- RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, TileNecessity::Optional }, //
GetTileDataAction{ { 0, 0, { 0, 0, 0 } }, NotFound }, //
}),
log);
@@ -742,10 +742,10 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) {
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 3, 0, { 2, 0, 0 } }, NotFound }, // ideal tile, missing
CreateTileDataAction{ { 3, 0, { 2, 0, 0 } } }, //
- RetainTileDataAction{ { 3, 0, { 2, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 3, 0, { 2, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 4, 0, { 2, 0, 0 } }, NotFound }, //
GetTileDataAction{ { 2, 0, { 2, 0, 0 } }, Found }, //
- RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, TileNecessity::Optional }, //
RenderTileAction{ { 2, 0, 0 }, *tile_2_2_0_0 }, //
}),
log);
@@ -758,7 +758,7 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) {
source.idealTiles, source.zoomRange, 3);
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 3, 0, { 2, 0, 0 } }, Found }, //
- RetainTileDataAction{ { 3, 0, { 2, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 3, 0, { 2, 0, 0 } }, TileNecessity::Required }, //
RenderTileAction{ { 2, 0, 0 }, *tile_3_2_0_0 }, //
}),
log);
@@ -769,7 +769,7 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) {
source.idealTiles, source.zoomRange, 2);
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 2, 0, { 2, 0, 0 } }, Found }, //
- RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, TileNecessity::Required }, //
RenderTileAction{ { 2, 0, 0 }, *tile_2_2_0_0 }, //
}),
log);
@@ -785,9 +785,9 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) {
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 2, 0, { 2, 0, 0 } }, NotFound }, //
CreateTileDataAction{ { 2, 0, { 2, 0, 0 } } }, //
- RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 3, 0, { 2, 0, 0 } }, Found }, // use overzoomed tile!
- RetainTileDataAction{ { 3, 0, { 2, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 3, 0, { 2, 0, 0 } }, TileNecessity::Optional }, //
RenderTileAction{ { 2, 0, 0 }, *tile_3_2_0_0 }, //
}),
log);
@@ -811,7 +811,7 @@ TEST(UpdateRenderables, AscendToNonOverzoomedTiles) {
source.idealTiles, source.zoomRange, 3);
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 3, 0, { 2, 0, 0 } }, Found }, //
- RetainTileDataAction{ { 3, 0, { 2, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 3, 0, { 2, 0, 0 } }, TileNecessity::Required }, //
RenderTileAction{ { 2, 0, 0 }, *tile_3_2_0_0 }, //
}),
log);
@@ -827,10 +827,10 @@ TEST(UpdateRenderables, AscendToNonOverzoomedTiles) {
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 3, 0, { 2, 0, 0 } }, NotFound }, //
CreateTileDataAction{ { 3, 0, { 2, 0, 0 } } }, //
- RetainTileDataAction{ { 3, 0, { 2, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 3, 0, { 2, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 4, 0, { 2, 0, 0 } }, NotFound }, // prefer using a child first
GetTileDataAction{ { 2, 0, { 2, 0, 0 } }, Found }, //
- RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, TileNecessity::Optional }, //
RenderTileAction{ { 2, 0, 0 }, *tile_2_2_0_0 }, //
}),
log);
@@ -845,11 +845,11 @@ TEST(UpdateRenderables, AscendToNonOverzoomedTiles) {
source.idealTiles, source.zoomRange, 3);
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 3, 0, { 2, 0, 0 } }, Found }, // ideal tile, not ready
- RetainTileDataAction{ { 3, 0, { 2, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 3, 0, { 2, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 4, 0, { 2, 0, 0 } }, NotFound }, //
GetTileDataAction{ { 2, 0, { 2, 0, 0 } }, NotFound }, //
GetTileDataAction{ { 1, 0, { 1, 0, 0 } }, Found }, //
- RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, TileNecessity::Optional }, //
RenderTileAction{ { 1, 0, 0 }, *tile_1_1_0_0 }, //
}),
log);
@@ -861,13 +861,13 @@ TEST(UpdateRenderables, AscendToNonOverzoomedTiles) {
source.idealTiles, source.zoomRange, 3);
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 3, 0, { 2, 0, 0 } }, Found }, // ideal tile, not ready
- RetainTileDataAction{ { 3, 0, { 2, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 3, 0, { 2, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 4, 0, { 2, 0, 0 } }, NotFound }, //
GetTileDataAction{ { 2, 0, { 2, 0, 0 } }, NotFound }, //
CreateTileDataAction{ { 2, 0, { 2, 0, 0 } } }, //
- RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, TileNecessity::Optional }, //
GetTileDataAction{ { 1, 0, { 1, 0, 0 } }, Found }, //
- RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, TileNecessity::Optional }, //
RenderTileAction{ { 1, 0, 0 }, *tile_1_1_0_0 }, //
}),
log);
@@ -889,7 +889,7 @@ TEST(UpdateRenderables, DoNotAscendMultipleTimesIfNotFound) {
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 8, 0, { 8, 0, 0 } }, NotFound }, // ideal tile
CreateTileDataAction{ { 8, 0, { 8, 0, 0 } } }, //
- RetainTileDataAction{ { 8, 0, { 8, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 8, 0, { 8, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 9, 0, { 9, 0, 0 } }, NotFound }, // child tile
GetTileDataAction{ { 9, 0, { 9, 0, 1 } }, NotFound }, // ...
GetTileDataAction{ { 9, 0, { 9, 1, 0 } }, NotFound }, // ...
@@ -905,7 +905,7 @@ TEST(UpdateRenderables, DoNotAscendMultipleTimesIfNotFound) {
GetTileDataAction{ { 8, 0, { 8, 1, 0 } }, NotFound }, // ideal tile
CreateTileDataAction{ { 8, 0, { 8, 1, 0 } } }, //
- RetainTileDataAction{ { 8, 0, { 8, 1, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 8, 0, { 8, 1, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 9, 0, { 9, 2, 0 } }, NotFound }, // child tile
GetTileDataAction{ { 9, 0, { 9, 2, 1 } }, NotFound }, // ...
GetTileDataAction{ { 9, 0, { 9, 3, 0 } }, NotFound }, // ...
@@ -923,7 +923,7 @@ TEST(UpdateRenderables, DoNotAscendMultipleTimesIfNotFound) {
source.idealTiles, source.zoomRange, 8);
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 8, 0, { 8, 0, 0 } }, Found }, // ideal tile, not ready
- RetainTileDataAction{ { 8, 0, { 8, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 8, 0, { 8, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 9, 0, { 9, 0, 0 } }, NotFound }, // child tile
GetTileDataAction{ { 9, 0, { 9, 0, 1 } }, NotFound }, // ...
GetTileDataAction{ { 9, 0, { 9, 1, 0 } }, NotFound }, // ...
@@ -932,11 +932,11 @@ TEST(UpdateRenderables, DoNotAscendMultipleTimesIfNotFound) {
GetTileDataAction{ { 6, 0, { 6, 0, 0 } }, NotFound }, // ...
GetTileDataAction{ { 5, 0, { 5, 0, 0 } }, NotFound }, // ...
GetTileDataAction{ { 4, 0, { 4, 0, 0 } }, Found }, // stops ascent
- RetainTileDataAction{ { 4, 0, { 4, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 4, 0, { 4, 0, 0 } }, TileNecessity::Optional }, //
RenderTileAction{ { 4, 0, 0 }, *tile_4_0_0_0 }, //
GetTileDataAction{ { 8, 0, { 8, 1, 0 } }, Found }, // ideal tile, not ready
- RetainTileDataAction{ { 8, 0, { 8, 1, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 8, 0, { 8, 1, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 9, 0, { 9, 2, 0 } }, NotFound }, // child tile
GetTileDataAction{ { 9, 0, { 9, 2, 1 } }, NotFound }, // ...
GetTileDataAction{ { 9, 0, { 9, 3, 0 } }, NotFound }, // ...
@@ -963,13 +963,13 @@ TEST(UpdateRenderables, DontRetainUnusedNonIdealTiles) {
source.idealTiles, source.zoomRange, 2);
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 2, 0, { 2, 0, 0 } }, Found }, // ideal tile, not ready
- RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 3, 0, { 3, 0, 0 } }, NotFound }, //
GetTileDataAction{ { 3, 0, { 3, 0, 1 } }, NotFound }, //
GetTileDataAction{ { 3, 0, { 3, 1, 0 } }, NotFound }, //
GetTileDataAction{ { 3, 0, { 3, 1, 1 } }, NotFound }, //
GetTileDataAction{ { 1, 0, { 1, 0, 0 } }, Found }, // parent tile, not ready
- RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, TileNecessity::Optional }, //
GetTileDataAction{ { 0, 0, { 0, 0, 0 } }, NotFound }, //
}),
log);
@@ -996,7 +996,7 @@ TEST(UpdateRenderables, WrappedTiles) {
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 1, -1, { 1, 1, 0 } }, NotFound }, // ideal tile 1/-1/0 (wrapped to -1)
CreateTileDataAction{ { 1, -1, { 1, 1, 0 } } }, //
- RetainTileDataAction{ { 1, -1, { 1, 1, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 1, -1, { 1, 1, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 2, -1, { 2, 2, 0 } }, NotFound }, //
GetTileDataAction{ { 2, -1, { 2, 2, 1 } }, NotFound }, //
GetTileDataAction{ { 2, -1, { 2, 3, 0 } }, NotFound }, //
@@ -1005,18 +1005,18 @@ TEST(UpdateRenderables, WrappedTiles) {
GetTileDataAction{ { 1, 0, { 1, 0, 0 } }, NotFound }, // ideal tile 1/0/0
CreateTileDataAction{ { 1, 0, { 1, 0, 0 } } }, //
- RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 1, 0, { 1, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 2, 0, { 2, 0, 0 } }, NotFound }, //
GetTileDataAction{ { 2, 0, { 2, 0, 1 } }, NotFound }, //
GetTileDataAction{ { 2, 0, { 2, 1, 0 } }, NotFound }, //
GetTileDataAction{ { 2, 0, { 2, 1, 1 } }, NotFound }, //
GetTileDataAction{ { 0, 0, { 0, 0, 0 } }, Found }, //
- RetainTileDataAction{ { 0, 0, { 0, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 0, 0, { 0, 0, 0 } }, TileNecessity::Optional }, //
RenderTileAction{ { 0, 0, 0 }, *tile_0_0_0_0 }, //
GetTileDataAction{ { 1, 0, { 1, 1, 0 } }, NotFound }, // ideal tile 1/1/0, doesn't match 1/-/1/0
CreateTileDataAction{ { 1, 0, { 1, 1, 0 } } },
- RetainTileDataAction{ { 1, 0, { 1, 1, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 1, 0, { 1, 1, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 2, 0, { 2, 2, 0 } }, NotFound }, //
GetTileDataAction{ { 2, 0, { 2, 2, 1 } }, NotFound }, //
GetTileDataAction{ { 2, 0, { 2, 3, 0 } }, NotFound }, //
@@ -1025,7 +1025,7 @@ TEST(UpdateRenderables, WrappedTiles) {
GetTileDataAction{ { 1, 1, { 1, 0, 0 } }, NotFound }, // ideal tile 1/2/0 (wrapped to 1)
CreateTileDataAction{ { 1, 1, { 1, 0, 0 } } },
- RetainTileDataAction{ { 1, 1, { 1, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 1, 1, { 1, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 2, 1, { 2, 0, 0 } }, NotFound }, //
GetTileDataAction{ { 2, 1, { 2, 0, 1 } }, NotFound }, //
GetTileDataAction{ { 2, 1, { 2, 1, 0 } }, NotFound }, //
@@ -1050,7 +1050,7 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) {
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 6, 0, { 6, 0, 0 } }, NotFound }, // ideal tile, not found
CreateTileDataAction{ { 6, 0, { 6, 0, 0 } } }, //
- RetainTileDataAction{ { 6, 0, { 6, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 6, 0, { 6, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 7, 0, { 7, 0, 0 } }, NotFound }, // children
GetTileDataAction{ { 7, 0, { 7, 0, 1 } }, NotFound }, // ...
GetTileDataAction{ { 7, 0, { 7, 1, 0 } }, NotFound }, // ...
@@ -1070,7 +1070,7 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) {
source.idealTiles, source.zoomRange, 6);
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 6, 0, { 6, 0, 0 } }, Found }, // ideal tile, not ready
- RetainTileDataAction{ { 6, 0, { 6, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 6, 0, { 6, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 7, 0, { 7, 0, 0 } }, NotFound }, // children
GetTileDataAction{ { 7, 0, { 7, 0, 1 } }, NotFound }, // ...
GetTileDataAction{ { 7, 0, { 7, 1, 0 } }, NotFound }, // ...
@@ -1091,14 +1091,14 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) {
source.idealTiles, source.zoomRange, 6);
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 6, 0, { 6, 0, 0 } }, Found }, // ideal tile, not ready
- RetainTileDataAction{ { 6, 0, { 6, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 6, 0, { 6, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 7, 0, { 7, 0, 0 } }, NotFound }, // children
GetTileDataAction{ { 7, 0, { 7, 0, 1 } }, NotFound }, // ...
GetTileDataAction{ { 7, 0, { 7, 1, 0 } }, NotFound }, // ...
GetTileDataAction{ { 7, 0, { 7, 1, 1 } }, NotFound }, // ...
GetTileDataAction{ { 5, 0, { 5, 0, 0 } }, NotFound }, // ascent
CreateTileDataAction{ { 5, 0, { 5, 0, 0 } } }, //
- RetainTileDataAction{ { 5, 0, { 5, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 5, 0, { 5, 0, 0 } }, TileNecessity::Optional }, //
GetTileDataAction{ { 4, 0, { 4, 0, 0 } }, NotFound }, // ...
GetTileDataAction{ { 3, 0, { 3, 0, 0 } }, NotFound }, // ...
GetTileDataAction{ { 2, 0, { 2, 0, 0 } }, NotFound }, // ...
@@ -1113,13 +1113,13 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) {
source.idealTiles, source.zoomRange, 6);
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 6, 0, { 6, 0, 0 } }, Found }, // ideal tile, not ready
- RetainTileDataAction{ { 6, 0, { 6, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 6, 0, { 6, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 7, 0, { 7, 0, 0 } }, NotFound }, // children
GetTileDataAction{ { 7, 0, { 7, 0, 1 } }, NotFound }, // ...
GetTileDataAction{ { 7, 0, { 7, 1, 0 } }, NotFound }, // ...
GetTileDataAction{ { 7, 0, { 7, 1, 1 } }, NotFound }, // ...
GetTileDataAction{ { 5, 0, { 5, 0, 0 } }, Found }, // ascent
- RetainTileDataAction{ { 5, 0, { 5, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 5, 0, { 5, 0, 0 } }, TileNecessity::Optional }, //
GetTileDataAction{ { 4, 0, { 4, 0, 0 } }, NotFound }, // ...
GetTileDataAction{ { 3, 0, { 3, 0, 0 } }, NotFound }, // ...
GetTileDataAction{ { 2, 0, { 2, 0, 0 } }, NotFound }, // ...
@@ -1135,16 +1135,16 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) {
source.idealTiles, source.zoomRange, 6);
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 6, 0, { 6, 0, 0 } }, Found }, // ideal tile, not ready
- RetainTileDataAction{ { 6, 0, { 6, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 6, 0, { 6, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 7, 0, { 7, 0, 0 } }, NotFound }, // children
GetTileDataAction{ { 7, 0, { 7, 0, 1 } }, NotFound }, // ...
GetTileDataAction{ { 7, 0, { 7, 1, 0 } }, NotFound }, // ...
GetTileDataAction{ { 7, 0, { 7, 1, 1 } }, NotFound }, // ...
GetTileDataAction{ { 5, 0, { 5, 0, 0 } }, Found }, // ascent
- RetainTileDataAction{ { 5, 0, { 5, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 5, 0, { 5, 0, 0 } }, TileNecessity::Optional }, //
GetTileDataAction{ { 4, 0, { 4, 0, 0 } }, NotFound }, // ...
CreateTileDataAction{ { 4, 0, { 4, 0, 0 } } }, //
- RetainTileDataAction{ { 4, 0, { 4, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 4, 0, { 4, 0, 0 } }, TileNecessity::Optional }, //
GetTileDataAction{ { 3, 0, { 3, 0, 0 } }, NotFound }, // ...
GetTileDataAction{ { 2, 0, { 2, 0, 0 } }, NotFound }, // ...
GetTileDataAction{ { 1, 0, { 1, 0, 0 } }, NotFound }, // ...
@@ -1159,18 +1159,18 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) {
source.idealTiles, source.zoomRange, 6);
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 6, 0, { 6, 0, 0 } }, Found }, // ideal tile, not ready
- RetainTileDataAction{ { 6, 0, { 6, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 6, 0, { 6, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 7, 0, { 7, 0, 0 } }, NotFound }, // children
GetTileDataAction{ { 7, 0, { 7, 0, 1 } }, NotFound }, // ...
GetTileDataAction{ { 7, 0, { 7, 1, 0 } }, NotFound }, // ...
GetTileDataAction{ { 7, 0, { 7, 1, 1 } }, NotFound }, // ...
GetTileDataAction{ { 5, 0, { 5, 0, 0 } }, Found }, // ascent
- RetainTileDataAction{ { 5, 0, { 5, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 5, 0, { 5, 0, 0 } }, TileNecessity::Optional }, //
GetTileDataAction{ { 4, 0, { 4, 0, 0 } }, Found }, // ...
- RetainTileDataAction{ { 4, 0, { 4, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 4, 0, { 4, 0, 0 } }, TileNecessity::Optional }, //
GetTileDataAction{ { 3, 0, { 3, 0, 0 } }, NotFound }, // ...
CreateTileDataAction{ { 3, 0, { 3, 0, 0 } } }, //
- RetainTileDataAction{ { 3, 0, { 3, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 3, 0, { 3, 0, 0 } }, TileNecessity::Optional }, //
GetTileDataAction{ { 2, 0, { 2, 0, 0 } }, NotFound }, // ...
GetTileDataAction{ { 1, 0, { 1, 0, 0 } }, NotFound }, // ...
GetTileDataAction{ { 0, 0, { 0, 0, 0 } }, NotFound }, // ...
@@ -1184,20 +1184,20 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) {
source.idealTiles, source.zoomRange, 6);
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 6, 0, { 6, 0, 0 } }, Found }, // ideal tile, not ready
- RetainTileDataAction{ { 6, 0, { 6, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 6, 0, { 6, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 7, 0, { 7, 0, 0 } }, NotFound }, // children
GetTileDataAction{ { 7, 0, { 7, 0, 1 } }, NotFound }, // ...
GetTileDataAction{ { 7, 0, { 7, 1, 0 } }, NotFound }, // ...
GetTileDataAction{ { 7, 0, { 7, 1, 1 } }, NotFound }, // ...
GetTileDataAction{ { 5, 0, { 5, 0, 0 } }, Found }, // ascent
- RetainTileDataAction{ { 5, 0, { 5, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 5, 0, { 5, 0, 0 } }, TileNecessity::Optional }, //
GetTileDataAction{ { 4, 0, { 4, 0, 0 } }, Found }, // ...
- RetainTileDataAction{ { 4, 0, { 4, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 4, 0, { 4, 0, 0 } }, TileNecessity::Optional }, //
GetTileDataAction{ { 3, 0, { 3, 0, 0 } }, Found }, // ...
- RetainTileDataAction{ { 3, 0, { 3, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 3, 0, { 3, 0, 0 } }, TileNecessity::Optional }, //
GetTileDataAction{ { 2, 0, { 2, 0, 0 } }, NotFound }, // ...
CreateTileDataAction{ { 2, 0, { 2, 0, 0 } } }, //
- RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 2, 0, { 2, 0, 0 } }, TileNecessity::Optional }, //
GetTileDataAction{ { 1, 0, { 1, 0, 0 } }, NotFound }, // ...
GetTileDataAction{ { 0, 0, { 0, 0, 0 } }, NotFound }, // ...
}),
@@ -1211,17 +1211,17 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) {
source.idealTiles, source.zoomRange, 6);
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 6, 0, { 6, 0, 0 } }, Found }, // ideal tile, not ready
- RetainTileDataAction{ { 6, 0, { 6, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 6, 0, { 6, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 7, 0, { 7, 0, 0 } }, NotFound }, // children
GetTileDataAction{ { 7, 0, { 7, 0, 1 } }, NotFound }, // ...
GetTileDataAction{ { 7, 0, { 7, 1, 0 } }, NotFound }, // ...
GetTileDataAction{ { 7, 0, { 7, 1, 1 } }, NotFound }, // ...
GetTileDataAction{ { 5, 0, { 5, 0, 0 } }, Found }, // ascent
- RetainTileDataAction{ { 5, 0, { 5, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 5, 0, { 5, 0, 0 } }, TileNecessity::Optional }, //
GetTileDataAction{ { 4, 0, { 4, 0, 0 } }, Found }, // ...
- RetainTileDataAction{ { 4, 0, { 4, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 4, 0, { 4, 0, 0 } }, TileNecessity::Optional }, //
GetTileDataAction{ { 3, 0, { 3, 0, 0 } }, Found }, // ...
- RetainTileDataAction{ { 3, 0, { 3, 0, 0 } }, Resource::Necessity::Optional }, //
+ RetainTileDataAction{ { 3, 0, { 3, 0, 0 } }, TileNecessity::Optional }, //
RenderTileAction{ { 3, 0, 0 }, *tile_3_3_0_0 }, //
}),
log);
@@ -1246,11 +1246,11 @@ TEST(UpdateRenderables, LoadRequiredIfIdealTileCantBeFound) {
source.idealTiles, source.zoomRange, 6);
EXPECT_EQ(ActionLog({
GetTileDataAction{ { 6, 0, { 6, 0, 0 } }, Found }, // ideal tile, not found
- RetainTileDataAction{ { 6, 0, { 6, 0, 0 } }, Resource::Necessity::Required }, //
+ RetainTileDataAction{ { 6, 0, { 6, 0, 0 } }, TileNecessity::Required }, //
GetTileDataAction{ { 7, 0, { 6, 0, 0 } }, NotFound }, // overzoomed child
GetTileDataAction{ { 5, 0, { 5, 0, 0 } }, NotFound }, // ascent
CreateTileDataAction{ { 5, 0, { 5, 0, 0 } } },
- RetainTileDataAction{ { 5, 0, { 5, 0, 0 } }, Resource::Necessity::Required },
+ RetainTileDataAction{ { 5, 0, { 5, 0, 0 } }, TileNecessity::Required },
GetTileDataAction{ { 4, 0, { 4, 0, 0 } }, NotFound }, // ...
GetTileDataAction{ { 3, 0, { 3, 0, 0 } }, NotFound }, // ...
GetTileDataAction{ { 2, 0, { 2, 0, 0 } }, NotFound }, // ...
diff --git a/test/storage/default_file_source.test.cpp b/test/storage/default_file_source.test.cpp
index b5686b5ffe..c11d442270 100644
--- a/test/storage/default_file_source.test.cpp
+++ b/test/storage/default_file_source.test.cpp
@@ -251,7 +251,7 @@ TEST(DefaultFileSource, OptionalNonExpired) {
util::RunLoop loop;
DefaultFileSource fs(":memory:", ".");
- const Resource optionalResource { Resource::Unknown, "http://127.0.0.1:3000/test", {}, Resource::Optional };
+ const Resource optionalResource { Resource::Unknown, "http://127.0.0.1:3000/test", {}, Resource::LoadingMethod::CacheOnly };
using namespace std::chrono_literals;
@@ -281,7 +281,7 @@ TEST(DefaultFileSource, OptionalExpired) {
util::RunLoop loop;
DefaultFileSource fs(":memory:", ".");
- const Resource optionalResource { Resource::Unknown, "http://127.0.0.1:3000/test", {}, Resource::Optional };
+ const Resource optionalResource { Resource::Unknown, "http://127.0.0.1:3000/test", {}, Resource::LoadingMethod::CacheOnly };
using namespace std::chrono_literals;
@@ -327,7 +327,7 @@ TEST(DefaultFileSource, OptionalNotFound) {
util::RunLoop loop;
DefaultFileSource fs(":memory:", ".");
- const Resource optionalResource { Resource::Unknown, "http://127.0.0.1:3000/test", {}, Resource::Optional };
+ const Resource optionalResource { Resource::Unknown, "http://127.0.0.1:3000/test", {}, Resource::LoadingMethod::CacheOnly };
using namespace std::chrono_literals;
@@ -348,13 +348,13 @@ TEST(DefaultFileSource, OptionalNotFound) {
loop.run();
}
-// Test that we can make a request with etag data that doesn't first try to load
-// from cache like a regular request
+// Test that a network only request doesn't attempt to load data from the cache.
TEST(DefaultFileSource, TEST_REQUIRES_SERVER(NoCacheRefreshEtagNotModified)) {
util::RunLoop loop;
DefaultFileSource fs(":memory:", ".");
Resource resource { Resource::Unknown, "http://127.0.0.1:3000/revalidate-same" };
+ resource.loadingMethod = Resource::LoadingMethod::NetworkOnly;
resource.priorEtag.emplace("snowfall");
using namespace std::chrono_literals;
@@ -383,13 +383,13 @@ TEST(DefaultFileSource, TEST_REQUIRES_SERVER(NoCacheRefreshEtagNotModified)) {
loop.run();
}
-// Test that we can make a request with etag data that doesn't first try to load
-// from cache like a regular request
+// Test that a network only request doesn't attempt to load data from the cache.
TEST(DefaultFileSource, TEST_REQUIRES_SERVER(NoCacheRefreshEtagModified)) {
util::RunLoop loop;
DefaultFileSource fs(":memory:", ".");
Resource resource { Resource::Unknown, "http://127.0.0.1:3000/revalidate-same" };
+ resource.loadingMethod = Resource::LoadingMethod::NetworkOnly;
resource.priorEtag.emplace("sunshine");
using namespace std::chrono_literals;
@@ -418,15 +418,13 @@ TEST(DefaultFileSource, TEST_REQUIRES_SERVER(NoCacheRefreshEtagModified)) {
loop.run();
}
-// Test that we can make a request that doesn't first try to load
-// from cache like a regular request.
+// Test that a network only request doesn't attempt to load data from the cache.
TEST(DefaultFileSource, TEST_REQUIRES_SERVER(NoCacheFull)) {
util::RunLoop loop;
DefaultFileSource fs(":memory:", ".");
Resource resource { Resource::Unknown, "http://127.0.0.1:3000/revalidate-same" };
- // Setting any prior field results in skipping the cache.
- resource.priorExpires.emplace(Seconds(0));
+ resource.loadingMethod = Resource::LoadingMethod::NetworkOnly;
using namespace std::chrono_literals;
@@ -461,6 +459,7 @@ TEST(DefaultFileSource, TEST_REQUIRES_SERVER(NoCacheRefreshModifiedNotModified))
DefaultFileSource fs(":memory:", ".");
Resource resource { Resource::Unknown, "http://127.0.0.1:3000/revalidate-modified" };
+ resource.loadingMethod = Resource::LoadingMethod::NetworkOnly;
resource.priorModified.emplace(Seconds(1420070400)); // January 1, 2015
using namespace std::chrono_literals;
@@ -496,6 +495,7 @@ TEST(DefaultFileSource, TEST_REQUIRES_SERVER(NoCacheRefreshModifiedModified)) {
DefaultFileSource fs(":memory:", ".");
Resource resource { Resource::Unknown, "http://127.0.0.1:3000/revalidate-modified" };
+ resource.loadingMethod = Resource::LoadingMethod::NetworkOnly;
resource.priorModified.emplace(Seconds(1417392000)); // December 1, 2014
using namespace std::chrono_literals;
@@ -578,7 +578,7 @@ TEST(DefaultFileSource, TEST_REQUIRES_SERVER(RespondToStaleMustRevalidate)) {
DefaultFileSource fs(":memory:", ".");
Resource resource { Resource::Unknown, "http://127.0.0.1:3000/revalidate-same" };
- resource.necessity = Resource::Necessity::Optional;
+ resource.loadingMethod = Resource::LoadingMethod::CacheOnly;
// using namespace std::chrono_literals;
@@ -621,7 +621,7 @@ TEST(DefaultFileSource, TEST_REQUIRES_SERVER(RespondToStaleMustRevalidate)) {
// Now run this request again, with the data we gathered from the previous stale/unusable
// request. We're replacing the data so that we can check that the DefaultFileSource doesn't
// attempt another database access if we already have the value.
- resource.necessity = Resource::Necessity::Required;
+ resource.loadingMethod = Resource::LoadingMethod::NetworkOnly;
resource.priorData = std::make_shared<std::string>("Prior value");
req = fs.request(resource, [&](Response res) {