Commit e4d72b79 authored by Ken Rockot's avatar Ken Rockot Committed by Commit Bot

Fix & Re-enable DOMStorageBrowserTest.DataPersists

There is really no reason to expect the pre-test browser shutdown not to
race with storage commits. This changes the pre-test to effectively wait
for a commit before exiting (by queueing a usage request and waiting
for the reply), ensuring that the database is opened and pending
operations are scheduled before the browser terminates and the actual
test goes on to verify the persistence of data.

Fixed: 1027940
Change-Id: I58eac4ec5fc9d547f8e10f5f2d12cbf41c6d12ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1951765
Commit-Queue: Ken Rockot <rockot@google.com>
Reviewed-by: default avatarDaniel Murphy <dmurph@chromium.org>
Cr-Commit-Position: refs/heads/master@{#721800}
parent ba598ff3
...@@ -106,12 +106,30 @@ IN_PROC_BROWSER_TEST_F(DOMStorageBrowserTest, SanityCheckIncognito) { ...@@ -106,12 +106,30 @@ IN_PROC_BROWSER_TEST_F(DOMStorageBrowserTest, SanityCheckIncognito) {
} }
// http://crbug.com/654704 PRE_ tests aren't supported on Android. // http://crbug.com/654704 PRE_ tests aren't supported on Android.
// Also crbug/1027940: Fails on linux-chromeos-rel and other platforms. #if defined(OS_ANDROID)
#define MAYBE_DataPersists DISABLED_DataPersists
#else
#define MAYBE_DataPersists DataPersists
#endif
IN_PROC_BROWSER_TEST_F(DOMStorageBrowserTest, PRE_DataPersists) { IN_PROC_BROWSER_TEST_F(DOMStorageBrowserTest, PRE_DataPersists) {
SimpleTest(GetTestUrl("dom_storage", "store_data.html"), kNotIncognito); SimpleTest(GetTestUrl("dom_storage", "store_data.html"), kNotIncognito);
// Browser shutdown can always race with async work on non-shutdown-blocking
// task runners. This includes the local storage implementation. If opening
// the database takes too long, by the time it finishes the IO thread may be
// shut down and the Local Storage implementation may be unable to commit its
// pending operations.
//
// Since the point of this test is to verify that committed data is actually
// retrievable by a subsequent browser session, wait for the database to be
// ready.
base::RunLoop loop;
context_wrapper()->GetLocalStorageUsage(base::BindLambdaForTesting(
[&](const std::vector<StorageUsageInfo>&) { loop.Quit(); }));
loop.Run();
} }
IN_PROC_BROWSER_TEST_F(DOMStorageBrowserTest, DISABLED_DataPersists) { IN_PROC_BROWSER_TEST_F(DOMStorageBrowserTest, MAYBE_DataPersists) {
SimpleTest(GetTestUrl("dom_storage", "verify_data.html"), kNotIncognito); SimpleTest(GetTestUrl("dom_storage", "verify_data.html"), kNotIncognito);
} }
......
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