Commit 5d199a9f authored by Wez's avatar Wez Committed by Commit Bot

Create a temporary copy of test database in DOMStorageDatabaseTest.

DOMStorageDatabaseTest.TestCanOpenAndReadWebCoreDatabase uses a prepared
test database, and verifies that it can be opened and read. The test
opens the file directly from DIR_TEST_DATA, and so fails if that is
readonly.

Create a copy of the test database to open, to allow for this.

Bug: 798851
Change-Id: I8d99e927c82024be7b0d98cdb4959a6210fe98a8
Reviewed-on: https://chromium-review.googlesource.com/1018491
Commit-Queue: Marijn Kruisselbrink <mek@chromium.org>
Reviewed-by: default avatarMarijn Kruisselbrink <mek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#552100}
parent d7f5857f
...@@ -123,6 +123,8 @@ class CONTENT_EXPORT DOMStorageDatabase { ...@@ -123,6 +123,8 @@ class CONTENT_EXPORT DOMStorageDatabase {
bool failed_to_open_; bool failed_to_open_;
bool tried_to_recreate_; bool tried_to_recreate_;
bool known_to_be_empty_; bool known_to_be_empty_;
DISALLOW_COPY_AND_ASSIGN(DOMStorageDatabase);
}; };
} // namespace content } // namespace content
......
...@@ -311,11 +311,17 @@ TEST(DOMStorageDatabaseTest, TestSimpleRemoveOneValue) { ...@@ -311,11 +311,17 @@ TEST(DOMStorageDatabaseTest, TestSimpleRemoveOneValue) {
TEST(DOMStorageDatabaseTest, TestCanOpenAndReadWebCoreDatabase) { TEST(DOMStorageDatabaseTest, TestCanOpenAndReadWebCoreDatabase) {
base::FilePath dir_test_data; base::FilePath dir_test_data;
ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &dir_test_data)); ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &dir_test_data));
base::FilePath webcore_database = dir_test_data.AppendASCII("dom_storage"); base::FilePath test_data = dir_test_data.AppendASCII("dom_storage");
webcore_database = test_data = test_data.AppendASCII("webcore_test_database.localstorage");
webcore_database.AppendASCII("webcore_test_database.localstorage"); ASSERT_TRUE(base::PathExists(test_data));
ASSERT_TRUE(base::PathExists(webcore_database)); // Create a temporary copy of the WebCore test database, in case DIR_TEST_DATA
// is read-only.
base::ScopedTempDir temp_dir;
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
base::FilePath webcore_database =
temp_dir.GetPath().AppendASCII("dom_storage");
ASSERT_TRUE(base::CopyFile(test_data, webcore_database));
DOMStorageDatabase db(webcore_database); DOMStorageDatabase db(webcore_database);
DOMStorageValuesMap values; DOMStorageValuesMap values;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment