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 "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "content/browser/browser_thread_impl.h" | 10 #include "content/browser/browser_thread_impl.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 } else { | 70 } else { |
71 EXPECT_FALSE(registration->active_version()); | 71 EXPECT_FALSE(registration->active_version()); |
72 } | 72 } |
73 } | 73 } |
74 | 74 |
75 class RejectInstallTestHelper : public EmbeddedWorkerTestHelper { | 75 class RejectInstallTestHelper : public EmbeddedWorkerTestHelper { |
76 public: | 76 public: |
77 explicit RejectInstallTestHelper(int mock_render_process_id) | 77 explicit RejectInstallTestHelper(int mock_render_process_id) |
78 : EmbeddedWorkerTestHelper(mock_render_process_id) {} | 78 : EmbeddedWorkerTestHelper(mock_render_process_id) {} |
79 | 79 |
80 virtual void OnInstallEvent(int embedded_worker_id, | 80 void OnInstallEvent(int embedded_worker_id, |
81 int request_id, | 81 int request_id, |
82 int active_version_id) override { | 82 int active_version_id) override { |
83 SimulateSend( | 83 SimulateSend( |
84 new ServiceWorkerHostMsg_InstallEventFinished( | 84 new ServiceWorkerHostMsg_InstallEventFinished( |
85 embedded_worker_id, request_id, | 85 embedded_worker_id, request_id, |
86 blink::WebServiceWorkerEventResultRejected)); | 86 blink::WebServiceWorkerEventResultRejected)); |
87 } | 87 } |
88 }; | 88 }; |
89 | 89 |
90 class RejectActivateTestHelper : public EmbeddedWorkerTestHelper { | 90 class RejectActivateTestHelper : public EmbeddedWorkerTestHelper { |
91 public: | 91 public: |
92 explicit RejectActivateTestHelper(int mock_render_process_id) | 92 explicit RejectActivateTestHelper(int mock_render_process_id) |
93 : EmbeddedWorkerTestHelper(mock_render_process_id) {} | 93 : EmbeddedWorkerTestHelper(mock_render_process_id) {} |
94 | 94 |
95 virtual void OnActivateEvent(int embedded_worker_id, | 95 void OnActivateEvent(int embedded_worker_id, int request_id) override { |
96 int request_id) override { | |
97 SimulateSend( | 96 SimulateSend( |
98 new ServiceWorkerHostMsg_ActivateEventFinished( | 97 new ServiceWorkerHostMsg_ActivateEventFinished( |
99 embedded_worker_id, request_id, | 98 embedded_worker_id, request_id, |
100 blink::WebServiceWorkerEventResultRejected)); | 99 blink::WebServiceWorkerEventResultRejected)); |
101 } | 100 } |
102 }; | 101 }; |
103 | 102 |
104 } // namespace | 103 } // namespace |
105 | 104 |
106 class ServiceWorkerContextTest : public testing::Test { | 105 class ServiceWorkerContextTest : public testing::Test { |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 false /* expect_waiting */, | 491 false /* expect_waiting */, |
493 true /* expect_active */)); | 492 true /* expect_active */)); |
494 base::RunLoop().RunUntilIdle(); | 493 base::RunLoop().RunUntilIdle(); |
495 | 494 |
496 // The new context should take over next handle ids. | 495 // The new context should take over next handle ids. |
497 EXPECT_EQ(1, context()->GetNewServiceWorkerHandleId()); | 496 EXPECT_EQ(1, context()->GetNewServiceWorkerHandleId()); |
498 EXPECT_EQ(1, context()->GetNewRegistrationHandleId()); | 497 EXPECT_EQ(1, context()->GetNewRegistrationHandleId()); |
499 } | 498 } |
500 | 499 |
501 } // namespace content | 500 } // namespace content |
OLD | NEW |