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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/test/data/indexeddb/common.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 virtual void SetUpCommandLine(CommandLine* command_line) { 170 virtual void SetUpCommandLine(CommandLine* command_line) {
171 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc"); 171 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc");
172 } 172 }
173 }; 173 };
174 174
175 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithGCExposed, 175 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithGCExposed,
176 DatabaseCallbacksTest) { 176 DatabaseCallbacksTest) {
177 SimpleTest(GetTestUrl("indexeddb", "database_callbacks_first.html")); 177 SimpleTest(GetTestUrl("indexeddb", "database_callbacks_first.html"));
178 } 178 }
179 179
180 class IndexedDBBrowserTestWithVersion0Schema : public IndexedDBBrowserTest {
181 public:
182 virtual void SetUpOnMainThread() {
183 BrowserThread::PostTask(
184 BrowserThread::WEBKIT_DEPRECATED, FROM_HERE,
185 base::Bind(
186 &IndexedDBBrowserTestWithVersion0Schema::CopyLevelDBToProfile,
187 shell()));
188 scoped_refptr<base::ThreadTestHelper> helper(
189 new base::ThreadTestHelper(BrowserThread::GetMessageLoopProxyForThread(
190 BrowserThread::WEBKIT_DEPRECATED)));
191 ASSERT_TRUE(helper->Run());
192 }
193 static void CopyLevelDBToProfile(Shell* shell) {
194 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
195 FilePath leveldb_dir(FILE_PATH_LITERAL("file__0.indexeddb.leveldb"));
196 FilePath test_data_dir =
197 GetTestFilePath("indexeddb", "migration_from_0").Append(leveldb_dir);
198 IndexedDBContext* context = BrowserContext::GetIndexedDBContext(
199 shell->web_contents()->GetBrowserContext());
200 IndexedDBContextImpl* context_impl =
201 static_cast<IndexedDBContextImpl*>(context);
202 FilePath dest = context_impl->data_path().Append(leveldb_dir);
203 // If we don't create the destination directory first, the contents of the
204 // leveldb directory are copied directly into profile/IndexedDB instead of
205 // profile/IndexedDB/file__0.xxx/
206 ASSERT_TRUE(file_util::CreateDirectory(dest));
207 const bool kRecursive = true;
208 ASSERT_TRUE(file_util::CopyDirectory(test_data_dir,
209 context_impl->data_path(),
210 kRecursive));
211 }
212 };
213
214 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithVersion0Schema, MigrationTest) {
215 SimpleTest(GetTestUrl("indexeddb", "migration_test.html"));
216 }
217
180 } // namespace content 218 } // namespace content
OLDNEW
« 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