Skip to content

Commit

Permalink
Update test case
Browse files Browse the repository at this point in the history
  • Loading branch information
mwilsnd committed Aug 29, 2024
1 parent 40b3755 commit c83cea8
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions test/map/map.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1818,10 +1818,23 @@ TEST(Map, ObserveTileLifecycle) {
break;
}
case TileOperation::EndParse: {
// The tile loader will try the cache first. If a cache hit is found, it starts parsing it while
// loading from the network. In the event data the cache is invalid, the network request will return
// newer data and update the geometry tile worker, which was already parsing the cached data.
EXPECT_THAT(stage, testing::AnyOf(TileOperation::StartParse, TileOperation::LoadFromNetwork));
// The following are both possible:
// * RequestedFromCache -> LoadFromCache -> StartParse -> RequestedFromNetwork -> EndParse ->
// LoadFromNetwork -> StartParse -> EndParse
// The parsing stage is initiated by the cached version. The network request doesn't arrive
// until after the cached version has completed parsing. A new parsing task is spawned, resulting
// in a pair of Start and EndParse events.
//
// * RequestedFromCache -> LoadFromCache -> StartParse ->
// RequestedFromNetwork -> LoadFromNetwork -> EndParse
// The parsing stage is initiated by the cached version before being interrupted
// by data from a new version downloaded over the network. This interruption doesn't cancel the
// ongoing parsing task, so ::EndParse will end up being emitted only once by completion of the
// newer tile's data.
EXPECT_THAT(stage,
testing::AnyOf(TileOperation::StartParse,
TileOperation::LoadFromNetwork,
TileOperation::RequestedFromNetwork));
stage = TileOperation::EndParse;
break;
}
Expand Down

0 comments on commit c83cea8

Please sign in to comment.