OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_path.h" | 5 #include "base/file_path.h" |
6 #include "base/string_util.h" | 6 #include "base/string_util.h" |
7 #include "base/test/test_timeouts.h" | 7 #include "base/test/test_timeouts.h" |
8 #include "base/threading/platform_thread.h" | 8 #include "base/threading/platform_thread.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 | 706 |
707 RunLayoutTest(test_case_file_name, kNoHttpPort); | 707 RunLayoutTest(test_case_file_name, kNoHttpPort); |
708 | 708 |
709 // Navigate to a blank page so that any workers are cleaned up. | 709 // Navigate to a blank page so that any workers are cleaned up. |
710 // This helps leaks trackers do a better job of reporting. | 710 // This helps leaks trackers do a better job of reporting. |
711 scoped_refptr<TabProxy> tab(GetActiveTab()); | 711 scoped_refptr<TabProxy> tab(GetActiveTab()); |
712 ASSERT_TRUE(tab.get()); | 712 ASSERT_TRUE(tab.get()); |
713 GURL about_url(chrome::kAboutBlankURL); | 713 GURL about_url(chrome::kAboutBlankURL); |
714 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(about_url)); | 714 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(about_url)); |
715 } | 715 } |
| 716 |
| 717 void RunWorkerFileSystemLayoutHttpTests(const char* tests[], int num_tests) { |
| 718 FilePath worker_test_dir = FilePath().AppendASCII("http") |
| 719 .AppendASCII("tests"); |
| 720 |
| 721 FilePath filesystem_test_dir = FilePath().AppendASCII("filesystem") |
| 722 .AppendASCII("workers"); |
| 723 InitializeForLayoutTest(worker_test_dir, filesystem_test_dir, kHttpPort); |
| 724 |
| 725 AddResourceForLayoutTest(worker_test_dir.AppendASCII("filesystem"), |
| 726 FilePath().AppendASCII("resources")); |
| 727 |
| 728 AddResourceForLayoutTest(worker_test_dir.AppendASCII("filesystem"), |
| 729 FilePath().AppendASCII("script-tests")); |
| 730 |
| 731 AddResourceForLayoutTest(worker_test_dir.AppendASCII("filesystem"), |
| 732 FilePath().AppendASCII("workers") |
| 733 .AppendASCII("script-tests")); |
| 734 |
| 735 StartHttpServer(new_http_root_dir_); |
| 736 for (int i = 0; i < num_tests; ++i) |
| 737 RunLayoutTest(tests[i], 8000); |
| 738 StopHttpServer(); |
| 739 |
| 740 // Navigate to a blank page so that any workers are cleaned up. |
| 741 // This helps leaks trackers do a better job of reporting. |
| 742 scoped_refptr<TabProxy> tab(GetActiveTab()); |
| 743 ASSERT_TRUE(tab.get()); |
| 744 GURL about_url(chrome::kAboutBlankURL); |
| 745 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(about_url)); |
| 746 } |
716 }; | 747 }; |
717 | 748 |
718 TEST_F(WorkerFileSystemTest, Temporary) { | 749 TEST_F(WorkerFileSystemTest, Temporary) { |
719 RunWorkerFileSystemLayoutTest("simple-temporary.html"); | 750 RunWorkerFileSystemLayoutTest("simple-temporary.html"); |
720 } | 751 } |
721 | 752 |
722 TEST_F(WorkerFileSystemTest, Persistent) { | 753 TEST_F(WorkerFileSystemTest, Persistent) { |
723 RunWorkerFileSystemLayoutTest("simple-persistent.html"); | 754 RunWorkerFileSystemLayoutTest("simple-persistent.html"); |
724 } | 755 } |
725 | 756 |
(...skipping 10 matching lines...) Expand all Loading... |
736 } | 767 } |
737 | 768 |
738 TEST_F(WorkerFileSystemTest, SyncOperations) { | 769 TEST_F(WorkerFileSystemTest, SyncOperations) { |
739 RunWorkerFileSystemLayoutTest("sync-operations.html"); | 770 RunWorkerFileSystemLayoutTest("sync-operations.html"); |
740 } | 771 } |
741 | 772 |
742 TEST_F(WorkerFileSystemTest, FileEntryToURISync) { | 773 TEST_F(WorkerFileSystemTest, FileEntryToURISync) { |
743 RunWorkerFileSystemLayoutTest("file-entry-to-uri-sync.html"); | 774 RunWorkerFileSystemLayoutTest("file-entry-to-uri-sync.html"); |
744 } | 775 } |
745 | 776 |
| 777 TEST_F(WorkerFileSystemTest, ResolveURLHttpTests) { |
| 778 static const char* kLayoutTests[] = { |
| 779 "resolve-url.html", |
| 780 "resolve-url-sync.html" |
| 781 }; |
| 782 RunWorkerFileSystemLayoutHttpTests(kLayoutTests, arraysize(kLayoutTests)); |
| 783 } |
| 784 |
746 #if defined(OS_LINUX) | 785 #if defined(OS_LINUX) |
747 // These tests fail on Linux due to an assert in WebKit's RNG. | 786 // These tests fail on Linux due to an assert in WebKit's RNG. |
748 // See http://webkit.org/b/55728. | 787 // See http://webkit.org/b/55728. |
749 #define FileFromFileEntry DISABLED_FileFromFileEntry | 788 #define FileFromFileEntry DISABLED_FileFromFileEntry |
750 #define FileFromFileEntrySync DISABLED_FileFromFileEntrySync | 789 #define FileFromFileEntrySync DISABLED_FileFromFileEntrySync |
751 #define FileWriterTruncateExtend DISABLED_FileWriterTruncateExtend | 790 #define FileWriterTruncateExtend DISABLED_FileWriterTruncateExtend |
752 #define FileWriterSyncTruncateExtend DISABLED_FileWriterSyncTruncateExtend | 791 #define FileWriterSyncTruncateExtend DISABLED_FileWriterSyncTruncateExtend |
753 #define FileWriterSyncWriteOverlapped DISABLED_FileWriterSyncWriteOverlapped | 792 #define FileWriterSyncWriteOverlapped DISABLED_FileWriterSyncWriteOverlapped |
754 #endif | 793 #endif |
755 TEST_F(WorkerFileSystemTest, FileFromFileEntry) { | 794 TEST_F(WorkerFileSystemTest, FileFromFileEntry) { |
756 RunWorkerFileSystemLayoutTest("file-from-file-entry.html"); | 795 RunWorkerFileSystemLayoutTest("file-from-file-entry.html"); |
757 } | 796 } |
758 | 797 |
759 TEST_F(WorkerFileSystemTest, FileFromFileEntrySync) { | 798 TEST_F(WorkerFileSystemTest, FileFromFileEntrySync) { |
760 RunWorkerFileSystemLayoutTest("file-from-file-entry-sync.html"); | 799 RunWorkerFileSystemLayoutTest("file-from-file-entry-sync.html"); |
761 } | 800 } |
762 | 801 |
763 TEST_F(WorkerFileSystemTest, FileWriterTruncateExtend) { | 802 TEST_F(WorkerFileSystemTest, FileWriterTruncateExtend) { |
764 RunWorkerFileSystemLayoutTest("file-writer-truncate-extend.html"); | 803 RunWorkerFileSystemLayoutTest("file-writer-truncate-extend.html"); |
765 } | 804 } |
766 | 805 |
767 TEST_F(WorkerFileSystemTest, FileWriterSyncTruncateExtend) { | 806 TEST_F(WorkerFileSystemTest, FileWriterSyncTruncateExtend) { |
768 RunWorkerFileSystemLayoutTest("file-writer-sync-truncate-extend.html"); | 807 RunWorkerFileSystemLayoutTest("file-writer-sync-truncate-extend.html"); |
769 } | 808 } |
770 | 809 |
771 TEST_F(WorkerFileSystemTest, FileWriterSyncWriteOverlapped) { | 810 TEST_F(WorkerFileSystemTest, FileWriterSyncWriteOverlapped) { |
772 RunWorkerFileSystemLayoutTest("file-writer-sync-write-overlapped.html"); | 811 RunWorkerFileSystemLayoutTest("file-writer-sync-write-overlapped.html"); |
773 } | 812 } |
OLD | NEW |