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/files/scoped_temp_dir.h" | 5 #include "base/files/scoped_temp_dir.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "content/browser/browser_thread_impl.h" | 8 #include "content/browser/browser_thread_impl.h" |
9 #include "content/browser/service_worker/embedded_worker_registry.h" | 9 #include "content/browser/service_worker/embedded_worker_registry.h" |
10 #include "content/browser/service_worker/embedded_worker_test_helper.h" | 10 #include "content/browser/service_worker/embedded_worker_test_helper.h" |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
577 bool find_called = false; | 577 bool find_called = false; |
578 storage()->FindRegistrationForPattern( | 578 storage()->FindRegistrationForPattern( |
579 pattern, | 579 pattern, |
580 SaveFoundRegistration( | 580 SaveFoundRegistration( |
581 SERVICE_WORKER_ERROR_NOT_FOUND, &find_called, ®istration)); | 581 SERVICE_WORKER_ERROR_NOT_FOUND, &find_called, ®istration)); |
582 | 582 |
583 base::RunLoop().RunUntilIdle(); | 583 base::RunLoop().RunUntilIdle(); |
584 ASSERT_EQ(scoped_refptr<ServiceWorkerRegistration>(), registration); | 584 ASSERT_EQ(scoped_refptr<ServiceWorkerRegistration>(), registration); |
585 } | 585 } |
586 | 586 |
587 TEST_F(ServiceWorkerJobTest, AbortAll) { | |
588 GURL pattern("http://www.example.com/*"); | |
589 GURL script_url("http://www.example.com/service_worker.js"); | |
590 | |
591 bool registration_called = false; | |
592 scoped_refptr<ServiceWorkerRegistration> registration; | |
593 job_coordinator()->Register( | |
594 pattern, | |
595 script_url, | |
596 render_process_id_, | |
597 SaveRegistration(SERVICE_WORKER_ERROR_ABORT, | |
598 ®istration_called, ®istration)); | |
599 | |
600 bool unregistration_called = false; | |
601 job_coordinator()->Unregister( | |
602 pattern, | |
603 SaveUnregistration(SERVICE_WORKER_ERROR_ABORT, | |
604 &unregistration_called)); | |
605 | |
606 ASSERT_FALSE(registration_called); | |
607 ASSERT_FALSE(unregistration_called); | |
608 job_coordinator()->AbortAll(); | |
609 | |
610 base::RunLoop().RunUntilIdle(); | |
611 ASSERT_TRUE(registration_called); | |
612 ASSERT_TRUE(unregistration_called); | |
613 | |
614 bool find_called = false; | |
615 storage()->FindRegistrationForPattern( | |
616 pattern, | |
617 SaveFoundRegistration( | |
618 SERVICE_WORKER_ERROR_NOT_FOUND, &find_called, ®istration)); | |
619 | |
620 base::RunLoop().RunUntilIdle(); | |
621 ASSERT_TRUE(find_called); | |
622 ASSERT_EQ(scoped_refptr<ServiceWorkerRegistration>(), registration); | |
623 } | |
624 | |
625 | |
falken
2014/06/19 03:45:55
extra newline?
nhiroki
2014/06/19 05:53:09
Done.
| |
587 } // namespace content | 626 } // namespace content |
OLD | NEW |