OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/public/browser/service_worker_context.h" | 5 #include "content/public/browser/service_worker_context.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/time/time.h" |
13 #include "content/browser/browser_thread_impl.h" | 14 #include "content/browser/browser_thread_impl.h" |
14 #include "content/browser/service_worker/embedded_worker_registry.h" | 15 #include "content/browser/service_worker/embedded_worker_registry.h" |
15 #include "content/browser/service_worker/embedded_worker_test_helper.h" | 16 #include "content/browser/service_worker/embedded_worker_test_helper.h" |
16 #include "content/browser/service_worker/service_worker_context_core.h" | 17 #include "content/browser/service_worker/service_worker_context_core.h" |
17 #include "content/browser/service_worker/service_worker_context_observer.h" | 18 #include "content/browser/service_worker/service_worker_context_observer.h" |
18 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 19 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
19 #include "content/browser/service_worker/service_worker_provider_host.h" | 20 #include "content/browser/service_worker/service_worker_provider_host.h" |
20 #include "content/browser/service_worker/service_worker_registration.h" | 21 #include "content/browser/service_worker/service_worker_registration.h" |
21 #include "content/browser/service_worker/service_worker_storage.h" | 22 #include "content/browser/service_worker/service_worker_storage.h" |
22 #include "content/common/service_worker/embedded_worker_messages.h" | 23 #include "content/common/service_worker/embedded_worker_messages.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 } | 81 } |
81 | 82 |
82 class RejectInstallTestHelper : public EmbeddedWorkerTestHelper { | 83 class RejectInstallTestHelper : public EmbeddedWorkerTestHelper { |
83 public: | 84 public: |
84 RejectInstallTestHelper() : EmbeddedWorkerTestHelper(base::FilePath()) {} | 85 RejectInstallTestHelper() : EmbeddedWorkerTestHelper(base::FilePath()) {} |
85 | 86 |
86 void OnInstallEvent(int embedded_worker_id, | 87 void OnInstallEvent(int embedded_worker_id, |
87 int request_id) override { | 88 int request_id) override { |
88 SimulateSend(new ServiceWorkerHostMsg_InstallEventFinished( | 89 SimulateSend(new ServiceWorkerHostMsg_InstallEventFinished( |
89 embedded_worker_id, request_id, | 90 embedded_worker_id, request_id, |
90 blink::WebServiceWorkerEventResultRejected, true)); | 91 blink::WebServiceWorkerEventResultRejected, true, base::Time::Now())); |
91 } | 92 } |
92 }; | 93 }; |
93 | 94 |
94 class RejectActivateTestHelper : public EmbeddedWorkerTestHelper { | 95 class RejectActivateTestHelper : public EmbeddedWorkerTestHelper { |
95 public: | 96 public: |
96 RejectActivateTestHelper() : EmbeddedWorkerTestHelper(base::FilePath()) {} | 97 RejectActivateTestHelper() : EmbeddedWorkerTestHelper(base::FilePath()) {} |
97 | 98 |
98 void OnActivateEvent(int embedded_worker_id, int request_id) override { | 99 void OnActivateEvent(int embedded_worker_id, int request_id) override { |
99 SimulateSend( | 100 SimulateSend(new ServiceWorkerHostMsg_ActivateEventFinished( |
100 new ServiceWorkerHostMsg_ActivateEventFinished( | 101 embedded_worker_id, request_id, |
101 embedded_worker_id, request_id, | 102 blink::WebServiceWorkerEventResultRejected, base::Time::Now())); |
102 blink::WebServiceWorkerEventResultRejected)); | |
103 } | 103 } |
104 }; | 104 }; |
105 | 105 |
106 enum NotificationType { | 106 enum NotificationType { |
107 REGISTRATION_STORED, | 107 REGISTRATION_STORED, |
108 REGISTRATION_DELETED, | 108 REGISTRATION_DELETED, |
109 STORAGE_RECOVERED, | 109 STORAGE_RECOVERED, |
110 }; | 110 }; |
111 | 111 |
112 struct NotificationLog { | 112 struct NotificationLog { |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 EXPECT_EQ(pattern, notifications_[0].pattern); | 704 EXPECT_EQ(pattern, notifications_[0].pattern); |
705 EXPECT_EQ(registration_id, notifications_[0].registration_id); | 705 EXPECT_EQ(registration_id, notifications_[0].registration_id); |
706 EXPECT_EQ(STORAGE_RECOVERED, notifications_[1].type); | 706 EXPECT_EQ(STORAGE_RECOVERED, notifications_[1].type); |
707 EXPECT_EQ(REGISTRATION_STORED, notifications_[2].type); | 707 EXPECT_EQ(REGISTRATION_STORED, notifications_[2].type); |
708 EXPECT_EQ(pattern, notifications_[2].pattern); | 708 EXPECT_EQ(pattern, notifications_[2].pattern); |
709 EXPECT_EQ(registration_id, notifications_[2].registration_id); | 709 EXPECT_EQ(registration_id, notifications_[2].registration_id); |
710 } | 710 } |
711 | 711 |
712 | 712 |
713 } // namespace content | 713 } // namespace content |
OLD | NEW |