From 7cceca4b4576c21c315b445889bad770e7dc4e53 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Wed, 9 Mar 2016 10:44:30 -0800 Subject: [core] Deactivate OfflineDownload when the tile count limit is hit This is a better behavior than sending hundreds or thousands of tileCountLimitExceeded notifications. --- test/storage/offline_download.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/storage/offline_download.cpp b/test/storage/offline_download.cpp index da0b1ac0ee..1b35d561be 100644 --- a/test/storage/offline_download.cpp +++ b/test/storage/offline_download.cpp @@ -371,10 +371,22 @@ TEST(OfflineDownload, TileCountLimitExceeded) { }; auto observer = std::make_unique(); + bool mapboxTileCountLimitExceededCalled = false; observer->mapboxTileCountLimitExceededFn = [&] (uint64_t limit) { + EXPECT_FALSE(mapboxTileCountLimitExceededCalled); EXPECT_EQ(0, limit); - test.loop.stop(); + mapboxTileCountLimitExceededCalled = true; + }; + + observer->statusChangedFn = [&] (OfflineRegionStatus status) { + EXPECT_FALSE(status.complete()); + if (!mapboxTileCountLimitExceededCalled) { + EXPECT_EQ(OfflineRegionDownloadState::Active, status.downloadState); + } else { + EXPECT_EQ(OfflineRegionDownloadState::Inactive, status.downloadState); + test.loop.stop(); + } }; download.setObserver(std::move(observer)); -- cgit v1.2.1