| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/files/file.h" | 11 #include "base/files/file.h" |
| 12 #include "base/files/file_enumerator.h" | 12 #include "base/files/file_enumerator.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
| 15 #include "base/lazy_instance.h" | 15 #include "base/lazy_instance.h" |
| 16 #include "base/location.h" | 16 #include "base/location.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
| 19 #include "base/run_loop.h" | 19 #include "base/run_loop.h" |
| 20 #include "base/single_thread_task_runner.h" | 20 #include "base/single_thread_task_runner.h" |
| 21 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 22 #include "base/test/thread_test_helper.h" | 22 #include "base/test/thread_test_helper.h" |
| 23 #include "base/threading/thread_restrictions.h" |
| 23 #include "build/build_config.h" | 24 #include "build/build_config.h" |
| 24 #include "content/browser/browser_main_loop.h" | 25 #include "content/browser/browser_main_loop.h" |
| 25 #include "content/browser/indexed_db/indexed_db_class_factory.h" | 26 #include "content/browser/indexed_db/indexed_db_class_factory.h" |
| 26 #include "content/browser/indexed_db/indexed_db_context_impl.h" | 27 #include "content/browser/indexed_db/indexed_db_context_impl.h" |
| 27 #include "content/browser/indexed_db/mock_browsertest_indexed_db_class_factory.h
" | 28 #include "content/browser/indexed_db/mock_browsertest_indexed_db_class_factory.h
" |
| 28 #include "content/browser/web_contents/web_contents_impl.h" | 29 #include "content/browser/web_contents/web_contents_impl.h" |
| 29 #include "content/public/browser/browser_context.h" | 30 #include "content/public/browser/browser_context.h" |
| 30 #include "content/public/browser/browser_thread.h" | 31 #include "content/public/browser/browser_thread.h" |
| 31 #include "content/public/browser/render_process_host.h" | 32 #include "content/public/browser/render_process_host.h" |
| 32 #include "content/public/browser/storage_partition.h" | 33 #include "content/public/browser/storage_partition.h" |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 EXPECT_NE(original_size, new_size); | 419 EXPECT_NE(original_size, new_size); |
| 419 } | 420 } |
| 420 | 421 |
| 421 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, LevelDBLogFileTest) { | 422 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, LevelDBLogFileTest) { |
| 422 // Any page that opens an IndexedDB will work here. | 423 // Any page that opens an IndexedDB will work here. |
| 423 SimpleTest(GetTestUrl("indexeddb", "database_test.html")); | 424 SimpleTest(GetTestUrl("indexeddb", "database_test.html")); |
| 424 base::FilePath leveldb_dir(FILE_PATH_LITERAL("file__0.indexeddb.leveldb")); | 425 base::FilePath leveldb_dir(FILE_PATH_LITERAL("file__0.indexeddb.leveldb")); |
| 425 base::FilePath log_file(FILE_PATH_LITERAL("LOG")); | 426 base::FilePath log_file(FILE_PATH_LITERAL("LOG")); |
| 426 base::FilePath log_file_path = | 427 base::FilePath log_file_path = |
| 427 GetContext()->data_path().Append(leveldb_dir).Append(log_file); | 428 GetContext()->data_path().Append(leveldb_dir).Append(log_file); |
| 428 int64_t size; | 429 { |
| 429 EXPECT_TRUE(base::GetFileSize(log_file_path, &size)); | 430 base::ThreadRestrictions::ScopedAllowIO allow_io_for_test_verification; |
| 430 EXPECT_GT(size, 0); | 431 int64_t size; |
| 432 EXPECT_TRUE(base::GetFileSize(log_file_path, &size)); |
| 433 EXPECT_GT(size, 0); |
| 434 } |
| 431 } | 435 } |
| 432 | 436 |
| 433 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, CanDeleteWhenOverQuotaTest) { | 437 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, CanDeleteWhenOverQuotaTest) { |
| 434 SimpleTest(GetTestUrl("indexeddb", "fill_up_5k.html")); | 438 SimpleTest(GetTestUrl("indexeddb", "fill_up_5k.html")); |
| 435 int64_t size = RequestDiskUsage(); | 439 int64_t size = RequestDiskUsage(); |
| 436 const int kQuotaKilobytes = 2; | 440 const int kQuotaKilobytes = 2; |
| 437 EXPECT_GT(size, kQuotaKilobytes * 1024); | 441 EXPECT_GT(size, kQuotaKilobytes * 1024); |
| 438 SetQuota(kQuotaKilobytes); | 442 SetQuota(kQuotaKilobytes); |
| 439 SimpleTest(GetTestUrl("indexeddb", "delete_over_quota.html")); | 443 SimpleTest(GetTestUrl("indexeddb", "delete_over_quota.html")); |
| 440 } | 444 } |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 command_line->AppendSwitch(switches::kSingleProcess); | 858 command_line->AppendSwitch(switches::kSingleProcess); |
| 855 } | 859 } |
| 856 }; | 860 }; |
| 857 | 861 |
| 858 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestSingleProcess, | 862 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestSingleProcess, |
| 859 RenderThreadShutdownTest) { | 863 RenderThreadShutdownTest) { |
| 860 SimpleTest(GetTestUrl("indexeddb", "shutdown_with_requests.html")); | 864 SimpleTest(GetTestUrl("indexeddb", "shutdown_with_requests.html")); |
| 861 } | 865 } |
| 862 | 866 |
| 863 } // namespace content | 867 } // namespace content |
| OLD | NEW |