| OLD | NEW |
| 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/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 | 196 |
| 197 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithGCExposed, | 197 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithGCExposed, |
| 198 DatabaseCallbacksTest) { | 198 DatabaseCallbacksTest) { |
| 199 SimpleTest(GetTestUrl("indexeddb", "database_callbacks_first.html")); | 199 SimpleTest(GetTestUrl("indexeddb", "database_callbacks_first.html")); |
| 200 } | 200 } |
| 201 | 201 |
| 202 static void CopyLevelDBToProfile(Shell* shell, | 202 static void CopyLevelDBToProfile(Shell* shell, |
| 203 scoped_refptr<IndexedDBContext> context, | 203 scoped_refptr<IndexedDBContext> context, |
| 204 const std::string& test_directory) { | 204 const std::string& test_directory) { |
| 205 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 205 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 206 FilePath leveldb_dir(FILE_PATH_LITERAL("file__0.indexeddb.leveldb")); | 206 base::FilePath leveldb_dir(FILE_PATH_LITERAL("file__0.indexeddb.leveldb")); |
| 207 FilePath test_data_dir = | 207 base::FilePath test_data_dir = |
| 208 GetTestFilePath("indexeddb", test_directory.c_str()).Append(leveldb_dir); | 208 GetTestFilePath("indexeddb", test_directory.c_str()).Append(leveldb_dir); |
| 209 IndexedDBContextImpl* context_impl = | 209 IndexedDBContextImpl* context_impl = |
| 210 static_cast<IndexedDBContextImpl*>(context.get()); | 210 static_cast<IndexedDBContextImpl*>(context.get()); |
| 211 FilePath dest = context_impl->data_path().Append(leveldb_dir); | 211 base::FilePath dest = context_impl->data_path().Append(leveldb_dir); |
| 212 // If we don't create the destination directory first, the contents of the | 212 // If we don't create the destination directory first, the contents of the |
| 213 // leveldb directory are copied directly into profile/IndexedDB instead of | 213 // leveldb directory are copied directly into profile/IndexedDB instead of |
| 214 // profile/IndexedDB/file__0.xxx/ | 214 // profile/IndexedDB/file__0.xxx/ |
| 215 ASSERT_TRUE(file_util::CreateDirectory(dest)); | 215 ASSERT_TRUE(file_util::CreateDirectory(dest)); |
| 216 const bool kRecursive = true; | 216 const bool kRecursive = true; |
| 217 ASSERT_TRUE(file_util::CopyDirectory(test_data_dir, | 217 ASSERT_TRUE(file_util::CopyDirectory(test_data_dir, |
| 218 context_impl->data_path(), | 218 context_impl->data_path(), |
| 219 kRecursive)); | 219 kRecursive)); |
| 220 } | 220 } |
| 221 | 221 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 | 323 |
| 324 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, LevelDBLogFileTest) { | 324 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, LevelDBLogFileTest) { |
| 325 // Any page that opens an IndexedDB will work here. | 325 // Any page that opens an IndexedDB will work here. |
| 326 SimpleTest(GetTestUrl("indexeddb", "database_test.html")); | 326 SimpleTest(GetTestUrl("indexeddb", "database_test.html")); |
| 327 scoped_refptr<IndexedDBContext> context = | 327 scoped_refptr<IndexedDBContext> context = |
| 328 BrowserContext::GetDefaultStoragePartition( | 328 BrowserContext::GetDefaultStoragePartition( |
| 329 shell()->web_contents()->GetBrowserContext())-> | 329 shell()->web_contents()->GetBrowserContext())-> |
| 330 GetIndexedDBContext(); | 330 GetIndexedDBContext(); |
| 331 IndexedDBContextImpl* context_impl = | 331 IndexedDBContextImpl* context_impl = |
| 332 static_cast<IndexedDBContextImpl*>(context.get()); | 332 static_cast<IndexedDBContextImpl*>(context.get()); |
| 333 FilePath leveldb_dir(FILE_PATH_LITERAL("file__0.indexeddb.leveldb")); | 333 base::FilePath leveldb_dir(FILE_PATH_LITERAL("file__0.indexeddb.leveldb")); |
| 334 FilePath log_file(FILE_PATH_LITERAL("LOG")); | 334 base::FilePath log_file(FILE_PATH_LITERAL("LOG")); |
| 335 FilePath log_file_path = | 335 base::FilePath log_file_path = |
| 336 context_impl->data_path().Append(leveldb_dir).Append(log_file); | 336 context_impl->data_path().Append(leveldb_dir).Append(log_file); |
| 337 int64 size; | 337 int64 size; |
| 338 EXPECT_TRUE(file_util::GetFileSize(log_file_path, &size)); | 338 EXPECT_TRUE(file_util::GetFileSize(log_file_path, &size)); |
| 339 EXPECT_GT(size, 0); | 339 EXPECT_GT(size, 0); |
| 340 } | 340 } |
| 341 | 341 |
| 342 // Complex multi-step (converted from pyauto) tests begin here. | 342 // Complex multi-step (converted from pyauto) tests begin here. |
| 343 | 343 |
| 344 // Verify null key path persists after restarting browser. | 344 // Verify null key path persists after restarting browser. |
| 345 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, PRE_NullKeyPathPersistence) { | 345 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, PRE_NullKeyPathPersistence) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 TitleWatcher title_watcher(new_shell->web_contents(), expected_title16); | 387 TitleWatcher title_watcher(new_shell->web_contents(), expected_title16); |
| 388 | 388 |
| 389 base::KillProcess( | 389 base::KillProcess( |
| 390 shell()->web_contents()->GetRenderProcessHost()->GetHandle(), 0, true); | 390 shell()->web_contents()->GetRenderProcessHost()->GetHandle(), 0, true); |
| 391 shell()->Close(); | 391 shell()->Close(); |
| 392 | 392 |
| 393 EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle()); | 393 EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle()); |
| 394 } | 394 } |
| 395 | 395 |
| 396 } // namespace content | 396 } // namespace content |
| OLD | NEW |