| 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 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 #else | 875 #else |
| 876 #define MAYBE_Registration Registration | 876 #define MAYBE_Registration Registration |
| 877 #endif | 877 #endif |
| 878 IN_PROC_BROWSER_TEST_F(ServiceWorkerBlackBoxBrowserTest, MAYBE_Registration) { | 878 IN_PROC_BROWSER_TEST_F(ServiceWorkerBlackBoxBrowserTest, MAYBE_Registration) { |
| 879 // Close the only window to be sure we're not re-using its RenderProcessHost. | 879 // Close the only window to be sure we're not re-using its RenderProcessHost. |
| 880 shell()->Close(); | 880 shell()->Close(); |
| 881 EXPECT_EQ(0, CountRenderProcessHosts()); | 881 EXPECT_EQ(0, CountRenderProcessHosts()); |
| 882 | 882 |
| 883 const std::string kWorkerUrl = "/service_worker/fetch_event.js"; | 883 const std::string kWorkerUrl = "/service_worker/fetch_event.js"; |
| 884 | 884 |
| 885 // Unregistering nothing should return true. | 885 // Unregistering nothing should return false. |
| 886 { | 886 { |
| 887 base::RunLoop run_loop; | 887 base::RunLoop run_loop; |
| 888 public_context()->UnregisterServiceWorker( | 888 public_context()->UnregisterServiceWorker( |
| 889 embedded_test_server()->GetURL("/"), | 889 embedded_test_server()->GetURL("/"), |
| 890 base::Bind(&ExpectResultAndRun, true, run_loop.QuitClosure())); | 890 base::Bind(&ExpectResultAndRun, false, run_loop.QuitClosure())); |
| 891 run_loop.Run(); | 891 run_loop.Run(); |
| 892 } | 892 } |
| 893 | 893 |
| 894 // If we use a worker URL that doesn't exist, registration fails. | 894 // If we use a worker URL that doesn't exist, registration fails. |
| 895 { | 895 { |
| 896 base::RunLoop run_loop; | 896 base::RunLoop run_loop; |
| 897 public_context()->RegisterServiceWorker( | 897 public_context()->RegisterServiceWorker( |
| 898 embedded_test_server()->GetURL("/"), | 898 embedded_test_server()->GetURL("/"), |
| 899 embedded_test_server()->GetURL("/does/not/exist"), | 899 embedded_test_server()->GetURL("/does/not/exist"), |
| 900 base::Bind(&ExpectResultAndRun, false, run_loop.QuitClosure())); | 900 base::Bind(&ExpectResultAndRun, false, run_loop.QuitClosure())); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 RunOnIOThread( | 946 RunOnIOThread( |
| 947 base::Bind(&ServiceWorkerBlackBoxBrowserTest::FindRegistrationOnIO, | 947 base::Bind(&ServiceWorkerBlackBoxBrowserTest::FindRegistrationOnIO, |
| 948 this, | 948 this, |
| 949 embedded_test_server()->GetURL("/service_worker/empty.html"), | 949 embedded_test_server()->GetURL("/service_worker/empty.html"), |
| 950 &status)); | 950 &status)); |
| 951 EXPECT_EQ(SERVICE_WORKER_ERROR_NOT_FOUND, status); | 951 EXPECT_EQ(SERVICE_WORKER_ERROR_NOT_FOUND, status); |
| 952 } | 952 } |
| 953 } | 953 } |
| 954 | 954 |
| 955 } // namespace content | 955 } // namespace content |
| OLD | NEW |