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

Unified Diff: content/browser/in_process_webkit/indexed_db_browsertest.cc

Issue 10826159: Browser test for migrating from schema v0 to v1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: data files already committed Created 8 years, 4 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 | content/test/data/indexeddb/common.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/in_process_webkit/indexed_db_browsertest.cc
diff --git a/content/browser/in_process_webkit/indexed_db_browsertest.cc b/content/browser/in_process_webkit/indexed_db_browsertest.cc
index bc38a1ce73810d720f3277e7fd204cadbc732b29..ca0f05f99934bddf44bc99529fdb2ad15d492a55 100644
--- a/content/browser/in_process_webkit/indexed_db_browsertest.cc
+++ b/content/browser/in_process_webkit/indexed_db_browsertest.cc
@@ -177,4 +177,42 @@ IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithGCExposed,
SimpleTest(GetTestUrl("indexeddb", "database_callbacks_first.html"));
}
+class IndexedDBBrowserTestWithVersion0Schema : public IndexedDBBrowserTest {
+ public:
+ virtual void SetUpOnMainThread() {
+ BrowserThread::PostTask(
+ BrowserThread::WEBKIT_DEPRECATED, FROM_HERE,
+ base::Bind(
+ &IndexedDBBrowserTestWithVersion0Schema::CopyLevelDBToProfile,
+ shell()));
+ scoped_refptr<base::ThreadTestHelper> helper(
+ new base::ThreadTestHelper(BrowserThread::GetMessageLoopProxyForThread(
+ BrowserThread::WEBKIT_DEPRECATED)));
+ ASSERT_TRUE(helper->Run());
+ }
+ static void CopyLevelDBToProfile(Shell* shell) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
+ FilePath leveldb_dir(FILE_PATH_LITERAL("file__0.indexeddb.leveldb"));
+ FilePath test_data_dir =
+ GetTestFilePath("indexeddb", "migration_from_0").Append(leveldb_dir);
+ IndexedDBContext* context = BrowserContext::GetIndexedDBContext(
+ shell->web_contents()->GetBrowserContext());
+ IndexedDBContextImpl* context_impl =
+ static_cast<IndexedDBContextImpl*>(context);
+ FilePath dest = context_impl->data_path().Append(leveldb_dir);
+ // If we don't create the destination directory first, the contents of the
+ // leveldb directory are copied directly into profile/IndexedDB instead of
+ // profile/IndexedDB/file__0.xxx/
+ ASSERT_TRUE(file_util::CreateDirectory(dest));
+ const bool kRecursive = true;
+ ASSERT_TRUE(file_util::CopyDirectory(test_data_dir,
+ context_impl->data_path(),
+ kRecursive));
+ }
+};
+
+IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithVersion0Schema, MigrationTest) {
+ SimpleTest(GetTestUrl("indexeddb", "migration_test.html"));
+}
+
} // namespace content
« no previous file with comments | « no previous file | content/test/data/indexeddb/common.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698