Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1078)

Unified Diff: content/browser/dom_storage/dom_storage_browsertest.cc

Issue 2700003002: Fix flaky MojoDOMStorageBrowserTest (Closed)
Patch Set: slightly nicer Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/dom_storage/dom_storage_browsertest.cc
diff --git a/content/browser/dom_storage/dom_storage_browsertest.cc b/content/browser/dom_storage/dom_storage_browsertest.cc
index 37348051ca0c93e7b257793ed1ef3db899b547b0..543bbf4ed4d20dec35870933dec90bb1e40e7322 100644
--- a/content/browser/dom_storage/dom_storage_browsertest.cc
+++ b/content/browser/dom_storage/dom_storage_browsertest.cc
@@ -49,22 +49,27 @@ class MojoDOMStorageBrowserTest : public DOMStorageBrowserTest {
command_line->AppendSwitch(switches::kMojoLocalStorage);
}
- void Flush() {
- // First make sure a connection to the database was set up.
- LocalStorageContextMojo* context =
- static_cast<DOMStorageContextWrapper*>(
- BrowserContext::GetDefaultStoragePartition(
- shell()->web_contents()->GetBrowserContext())
- ->GetDOMStorageContext())
- ->mojo_state_.get();
+ LocalStorageContextMojo* context() {
+ return static_cast<DOMStorageContextWrapper*>(
+ BrowserContext::GetDefaultStoragePartition(
+ shell()->web_contents()->GetBrowserContext())
+ ->GetDOMStorageContext())
+ ->mojo_state_.get();
+ }
+
+ void EnsureConnected() {
base::RunLoop run_loop;
- context->RunWhenConnected(run_loop.QuitClosure());
+ context()->RunWhenConnected(run_loop.QuitClosure());
run_loop.Run();
- // Then process any tasks that are currently queued, to ensure
+ }
+
+ void Flush() {
+ // Process any tasks that are currently queued, to ensure
// LevelDBWrapperImpl methods get called.
base::RunLoop().RunUntilIdle();
// And finally flush all the now queued up changes to leveldb.
- context->Flush();
+ context()->Flush();
+ base::RunLoop().RunUntilIdle();
}
};
@@ -86,9 +91,6 @@ IN_PROC_BROWSER_TEST_F(DOMStorageBrowserTest, PRE_DataPersists) {
// http://crbug.com/654704 PRE_ tests aren't supported on Android.
#if defined(OS_ANDROID)
#define MAYBE_DataPersists DISABLED_DataPersists
-#elif defined(OS_WIN) || defined(OS_LINUX)
-// Disabled on Windows and Linux due to flake (https://crbug.com/692885).
-#define MAYBE_DataPersists DISABLED_DataPersists
#else
#define MAYBE_DataPersists DataPersists
#endif
@@ -105,6 +107,7 @@ IN_PROC_BROWSER_TEST_F(MojoDOMStorageBrowserTest, SanityCheckIncognito) {
}
IN_PROC_BROWSER_TEST_F(MojoDOMStorageBrowserTest, PRE_DataPersists) {
+ EnsureConnected();
SimpleTest(GetTestUrl("dom_storage", "store_data.html"), kNotIncognito);
Flush();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698