| 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/files/file.h" | 7 #include "base/files/file.h" |
| 8 #include "base/files/file_enumerator.h" | 8 #include "base/files/file_enumerator.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 if (!base::ReadFileToString(resource_path, &file_contents)) | 686 if (!base::ReadFileToString(resource_path, &file_contents)) |
| 687 return scoped_ptr<net::test_server::HttpResponse>(); | 687 return scoped_ptr<net::test_server::HttpResponse>(); |
| 688 http_response->set_content(file_contents); | 688 http_response->set_content(file_contents); |
| 689 return http_response.Pass(); | 689 return http_response.Pass(); |
| 690 } | 690 } |
| 691 | 691 |
| 692 } // namespace | 692 } // namespace |
| 693 | 693 |
| 694 class IndexedDBBrowserCorruptionTest | 694 class IndexedDBBrowserCorruptionTest |
| 695 : public IndexedDBBrowserTest, | 695 : public IndexedDBBrowserTest, |
| 696 public ::testing::WithParamInterface<const char*> {}; | 696 public ::testing::WithParamInterface<const char*> { |
| 697 public: |
| 698 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 699 // Experimental for IDBObjectStore.getAll() |
| 700 command_line->AppendSwitch( |
| 701 switches::kEnableExperimentalWebPlatformFeatures); |
| 702 } |
| 703 }; |
| 697 | 704 |
| 698 IN_PROC_BROWSER_TEST_P(IndexedDBBrowserCorruptionTest, | 705 IN_PROC_BROWSER_TEST_P(IndexedDBBrowserCorruptionTest, |
| 699 OperationOnCorruptedOpenDatabase) { | 706 OperationOnCorruptedOpenDatabase) { |
| 700 ASSERT_TRUE(embedded_test_server()->Started() || | 707 ASSERT_TRUE(embedded_test_server()->Started() || |
| 701 embedded_test_server()->InitializeAndWaitUntilReady()); | 708 embedded_test_server()->InitializeAndWaitUntilReady()); |
| 702 const GURL& origin_url = embedded_test_server()->base_url(); | 709 const GURL& origin_url = embedded_test_server()->base_url(); |
| 703 embedded_test_server()->RegisterRequestHandler( | 710 embedded_test_server()->RegisterRequestHandler( |
| 704 base::Bind(&CorruptDBRequestHandler, | 711 base::Bind(&CorruptDBRequestHandler, |
| 705 base::Unretained(GetContext()), | 712 base::Unretained(GetContext()), |
| 706 origin_url, | 713 origin_url, |
| 707 s_corrupt_db_test_prefix, | 714 s_corrupt_db_test_prefix, |
| 708 this)); | 715 this)); |
| 709 | 716 |
| 710 std::string test_file = s_corrupt_db_test_prefix + | 717 std::string test_file = s_corrupt_db_test_prefix + |
| 711 "corrupted_open_db_detection.html#" + GetParam(); | 718 "corrupted_open_db_detection.html#" + GetParam(); |
| 712 SimpleTest(embedded_test_server()->GetURL(test_file)); | 719 SimpleTest(embedded_test_server()->GetURL(test_file)); |
| 713 | 720 |
| 714 test_file = s_corrupt_db_test_prefix + "corrupted_open_db_recovery.html"; | 721 test_file = s_corrupt_db_test_prefix + "corrupted_open_db_recovery.html"; |
| 715 SimpleTest(embedded_test_server()->GetURL(test_file)); | 722 SimpleTest(embedded_test_server()->GetURL(test_file)); |
| 716 } | 723 } |
| 717 | 724 |
| 718 INSTANTIATE_TEST_CASE_P(IndexedDBBrowserCorruptionTestInstantiation, | 725 INSTANTIATE_TEST_CASE_P(IndexedDBBrowserCorruptionTestInstantiation, |
| 719 IndexedDBBrowserCorruptionTest, | 726 IndexedDBBrowserCorruptionTest, |
| 720 ::testing::Values("failGetBlobJournal", | 727 ::testing::Values("failGetBlobJournal", |
| 721 "get", | 728 "get", |
| 729 "getAll", |
| 722 "failWebkitGetDatabaseNames", | 730 "failWebkitGetDatabaseNames", |
| 723 "iterate", | 731 "iterate", |
| 724 "failTransactionCommit", | 732 "failTransactionCommit", |
| 725 "clearObjectStore")); | 733 "clearObjectStore")); |
| 726 | 734 |
| 727 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, | 735 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, |
| 728 DeleteCompactsBackingStore) { | 736 DeleteCompactsBackingStore) { |
| 729 const GURL test_url = GetTestUrl("indexeddb", "delete_compact.html"); | 737 const GURL test_url = GetTestUrl("indexeddb", "delete_compact.html"); |
| 730 SimpleTest(GURL(test_url.spec() + "#fill")); | 738 SimpleTest(GURL(test_url.spec() + "#fill")); |
| 731 int64 after_filling = RequestDiskUsage(); | 739 int64 after_filling = RequestDiskUsage(); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 command_line->AppendSwitch(switches::kSingleProcess); | 847 command_line->AppendSwitch(switches::kSingleProcess); |
| 840 } | 848 } |
| 841 }; | 849 }; |
| 842 | 850 |
| 843 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestSingleProcess, | 851 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestSingleProcess, |
| 844 RenderThreadShutdownTest) { | 852 RenderThreadShutdownTest) { |
| 845 SimpleTest(GetTestUrl("indexeddb", "shutdown_with_requests.html")); | 853 SimpleTest(GetTestUrl("indexeddb", "shutdown_with_requests.html")); |
| 846 } | 854 } |
| 847 | 855 |
| 848 } // namespace content | 856 } // namespace content |
| OLD | NEW |