0

sqlite: Add test case for bad db file path

This CL adds the test case for bad db file path in reference to previous
patch - https://chromium-review.googlesource.com/c/chromium/src/+/3308486

Bug: 1275513
Change-Id: I32a009e913c179d40db615877c48652c0daae522
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3655610
Reviewed-by: Chris Mumford <cmumford@google.com>
Reviewed-by: Austin Sullivan <asully@chromium.org>
Commit-Queue: Aditi Singh <a20.singh@samsung.com>
Cr-Commit-Position: refs/heads/main@{#1007709}
This commit is contained in:
a20.singh
2022-05-26 03:32:45 +00:00
committed by Chromium LUCI CQ
parent 1c609d3e37
commit b0ca112f83
2 changed files with 8 additions and 1 deletions

@ -658,6 +658,7 @@ class COMPONENT_EXPORT(SQL) Database {
FRIEND_TEST_ALL_PREFIXES(SQLDatabaseTest, OnMemoryDump);
FRIEND_TEST_ALL_PREFIXES(SQLDatabaseTest, RegisterIntentToUpload);
FRIEND_TEST_ALL_PREFIXES(SQLiteFeaturesTest, WALNoClose);
FRIEND_TEST_ALL_PREFIXES(SQLEmptyPathDatabaseTest, EmptyPathTest);
// Enables a special behavior for OpenInternal().
enum class OpenMode {

@ -2035,6 +2035,13 @@ TEST_P(SQLDatabaseTest, SchemaFailsAfterCorruptSizeInHeader) {
}
}
TEST(SQLEmptyPathDatabaseTest, EmptyPathTest) {
Database db;
EXPECT_TRUE(db.OpenInMemory());
EXPECT_TRUE(db.is_open());
EXPECT_TRUE(db.DbPath().empty());
}
// WAL mode is currently not supported on Fuchsia.
#if !BUILDFLAG(IS_FUCHSIA)
INSTANTIATE_TEST_SUITE_P(JournalMode, SQLDatabaseTest, testing::Bool());
@ -2047,5 +2054,4 @@ INSTANTIATE_TEST_SUITE_P(JournalMode,
SQLDatabaseTestExclusiveMode,
testing::Values(false));
#endif
} // namespace sql