summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2020-02-07 12:57:28 +0200
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2020-02-07 14:39:03 +0200
commitbdd7324d62208ef37be0b192f9e71b1ffe6ad06a (patch)
tree12baa61cb541bb416c68b75c543184624a8d8dc1
parent2365cab58cc8f818b60db81f7cda815ae621c817 (diff)
downloadqtlocation-mapboxgl-bdd7324d62208ef37be0b192f9e71b1ffe6ad06a.tar.gz
Add OfflineDatabase.UpdateDatabaseReadOnlyMode unit test
-rw-r--r--test/storage/offline_database.test.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/storage/offline_database.test.cpp b/test/storage/offline_database.test.cpp
index a0b780a4ea..f988457dac 100644
--- a/test/storage/offline_database.test.cpp
+++ b/test/storage/offline_database.test.cpp
@@ -1902,3 +1902,19 @@ TEST(OfflineDatabase, PutResourceReadOnlyMode) {
EXPECT_EQ(0u, log.uncheckedCount());
}
+
+TEST(OfflineDatabase, TEST_REQUIRES_WRITE(UpdateDatabaseReadOnlyMode)) {
+ FixtureLog log;
+ deleteDatabaseFiles();
+
+ OfflineDatabase db(filename);
+ db.reopenDatabaseReadOnly(true /*readOnly*/);
+ db.clearAmbientCache();
+ EXPECT_EQ(1u,
+ log.count({EventSeverity::Error,
+ Event::Database,
+ -1,
+ "Can't clear ambient cache: Cannot modify database in read-only mode"}));
+
+ EXPECT_EQ(0u, log.uncheckedCount());
+}