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

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

Issue 2649963002: Enable mojo localstorage to actually store on disk. (Closed)
Patch Set: Remove Sync() method, and instead make sure browser test waits long enough. 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 | « components/leveldb/leveldb_mojo_proxy.cc ('k') | content/browser/dom_storage/dom_storage_context_wrapper.h » ('j') | 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 326c91e94c37190375630ec8e1e2f9f9f2f039cc..106834e383dcc5e4019c2c0f1d8d6fb3edbf17f5 100644
--- a/content/browser/dom_storage/dom_storage_browsertest.cc
+++ b/content/browser/dom_storage/dom_storage_browsertest.cc
@@ -3,8 +3,12 @@
// found in the LICENSE file.
#include "base/command_line.h"
+#include "content/browser/dom_storage/dom_storage_context_wrapper.h"
+#include "content/browser/dom_storage/local_storage_context_mojo.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/dom_storage/dom_storage_types.h"
+#include "content/public/browser/browser_context.h"
+#include "content/public/browser/storage_partition.h"
#include "content/public/common/content_paths.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test_utils.h"
@@ -43,6 +47,24 @@ class MojoDOMStorageBrowserTest : public DOMStorageBrowserTest {
ContentBrowserTest::SetUpCommandLine(command_line);
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();
+ base::RunLoop run_loop;
+ context->RunWhenConnected(run_loop.QuitClosure());
+ run_loop.Run();
+ // Then 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();
+ }
};
static const bool kIncognito = true;
@@ -56,6 +78,20 @@ IN_PROC_BROWSER_TEST_F(DOMStorageBrowserTest, SanityCheckIncognito) {
SimpleTest(GetTestUrl("dom_storage", "sanity_check.html"), kIncognito);
}
+IN_PROC_BROWSER_TEST_F(DOMStorageBrowserTest, PRE_DataPersists) {
+ SimpleTest(GetTestUrl("dom_storage", "store_data.html"), kNotIncognito);
+}
+
+// http://crbug.com/654704 PRE_ tests aren't supported on Android.
+#if defined(OS_ANDROID)
+#define MAYBE_DataPersists DISABLED_DataPersists
+#else
+#define MAYBE_DataPersists DataPersists
+#endif
+IN_PROC_BROWSER_TEST_F(DOMStorageBrowserTest, MAYBE_DataPersists) {
+ SimpleTest(GetTestUrl("dom_storage", "verify_data.html"), kNotIncognito);
+}
+
IN_PROC_BROWSER_TEST_F(MojoDOMStorageBrowserTest, SanityCheck) {
SimpleTest(GetTestUrl("dom_storage", "sanity_check.html"), kNotIncognito);
}
@@ -64,4 +100,13 @@ IN_PROC_BROWSER_TEST_F(MojoDOMStorageBrowserTest, SanityCheckIncognito) {
SimpleTest(GetTestUrl("dom_storage", "sanity_check.html"), kIncognito);
}
+IN_PROC_BROWSER_TEST_F(MojoDOMStorageBrowserTest, PRE_DataPersists) {
+ SimpleTest(GetTestUrl("dom_storage", "store_data.html"), kNotIncognito);
+ Flush();
+}
+
+IN_PROC_BROWSER_TEST_F(MojoDOMStorageBrowserTest, MAYBE_DataPersists) {
+ SimpleTest(GetTestUrl("dom_storage", "verify_data.html"), kNotIncognito);
+}
+
} // namespace content
« no previous file with comments | « components/leveldb/leveldb_mojo_proxy.cc ('k') | content/browser/dom_storage/dom_storage_context_wrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698