OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/callback.h" | 6 #include "base/callback.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "content/browser/fileapi/chrome_blob_storage_context.h" | 10 #include "content/browser/fileapi/chrome_blob_storage_context.h" |
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 sync_run_loop.QuitClosure(), | 754 sync_run_loop.QuitClosure(), |
755 &status)); | 755 &status)); |
756 sync_run_loop.Run(); | 756 sync_run_loop.Run(); |
757 ASSERT_EQ(SERVICE_WORKER_OK, status); | 757 ASSERT_EQ(SERVICE_WORKER_OK, status); |
758 | 758 |
759 // Should 200 after sync event. | 759 // Should 200 after sync event. |
760 FetchOnRegisteredWorker(&result, &response, &blob_data_handle); | 760 FetchOnRegisteredWorker(&result, &response, &blob_data_handle); |
761 EXPECT_EQ(200, response.status_code); | 761 EXPECT_EQ(200, response.status_code); |
762 } | 762 } |
763 | 763 |
764 // ServiceWorkerBrowserTest.Reload is flaky on Android crbug.com/393486 | 764 IN_PROC_BROWSER_TEST_F(ServiceWorkerBrowserTest, Reload) { |
765 #if defined(OS_ANDROID) | |
766 #define MAYBE_Reload DISABLED_Reload | |
767 #else | |
768 #define MAYBE_Reload Reload | |
769 #endif | |
770 IN_PROC_BROWSER_TEST_F(ServiceWorkerBrowserTest, MAYBE_Reload) { | |
771 const std::string kPageUrl = "/service_worker/reload.html"; | 765 const std::string kPageUrl = "/service_worker/reload.html"; |
772 const std::string kWorkerUrl = "/service_worker/fetch_event_reload.js"; | 766 const std::string kWorkerUrl = "/service_worker/fetch_event_reload.js"; |
773 { | 767 { |
774 scoped_refptr<WorkerActivatedObserver> observer = | 768 scoped_refptr<WorkerActivatedObserver> observer = |
775 new WorkerActivatedObserver(wrapper()); | 769 new WorkerActivatedObserver(wrapper()); |
776 observer->Init(); | 770 observer->Init(); |
777 public_context()->RegisterServiceWorker( | 771 public_context()->RegisterServiceWorker( |
778 embedded_test_server()->GetURL(kPageUrl), | 772 embedded_test_server()->GetURL(kPageUrl), |
779 embedded_test_server()->GetURL(kWorkerUrl), | 773 embedded_test_server()->GetURL(kWorkerUrl), |
780 base::Bind(&ExpectResultAndRun, true, base::Bind(&base::DoNothing))); | 774 base::Bind(&ExpectResultAndRun, true, base::Bind(&base::DoNothing))); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 static int CountRenderProcessHosts() { | 856 static int CountRenderProcessHosts() { |
863 int result = 0; | 857 int result = 0; |
864 for (RenderProcessHost::iterator iter(RenderProcessHost::AllHostsIterator()); | 858 for (RenderProcessHost::iterator iter(RenderProcessHost::AllHostsIterator()); |
865 !iter.IsAtEnd(); | 859 !iter.IsAtEnd(); |
866 iter.Advance()) { | 860 iter.Advance()) { |
867 result++; | 861 result++; |
868 } | 862 } |
869 return result; | 863 return result; |
870 } | 864 } |
871 | 865 |
872 // Crashes on Android and flakes on CrOS: http://crbug.com/387045 | 866 IN_PROC_BROWSER_TEST_F(ServiceWorkerBlackBoxBrowserTest, Registration) { |
873 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) | |
874 #define MAYBE_Registration DISABLED_Registration | |
875 #else | |
876 #define MAYBE_Registration Registration | |
877 #endif | |
878 IN_PROC_BROWSER_TEST_F(ServiceWorkerBlackBoxBrowserTest, MAYBE_Registration) { | |
879 // Close the only window to be sure we're not re-using its RenderProcessHost. | 867 // Close the only window to be sure we're not re-using its RenderProcessHost. |
880 shell()->Close(); | 868 shell()->Close(); |
881 EXPECT_EQ(0, CountRenderProcessHosts()); | 869 EXPECT_EQ(0, CountRenderProcessHosts()); |
882 | 870 |
883 const std::string kWorkerUrl = "/service_worker/fetch_event.js"; | 871 const std::string kWorkerUrl = "/service_worker/fetch_event.js"; |
884 | 872 |
885 // Unregistering nothing should return false. | 873 // Unregistering nothing should return false. |
886 { | 874 { |
887 base::RunLoop run_loop; | 875 base::RunLoop run_loop; |
888 public_context()->UnregisterServiceWorker( | 876 public_context()->UnregisterServiceWorker( |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 RunOnIOThread( | 934 RunOnIOThread( |
947 base::Bind(&ServiceWorkerBlackBoxBrowserTest::FindRegistrationOnIO, | 935 base::Bind(&ServiceWorkerBlackBoxBrowserTest::FindRegistrationOnIO, |
948 this, | 936 this, |
949 embedded_test_server()->GetURL("/service_worker/empty.html"), | 937 embedded_test_server()->GetURL("/service_worker/empty.html"), |
950 &status)); | 938 &status)); |
951 EXPECT_EQ(SERVICE_WORKER_ERROR_NOT_FOUND, status); | 939 EXPECT_EQ(SERVICE_WORKER_ERROR_NOT_FOUND, status); |
952 } | 940 } |
953 } | 941 } |
954 | 942 |
955 } // namespace content | 943 } // namespace content |
OLD | NEW |