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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 EXPECT_TRUE(registration->active_version()); | 78 EXPECT_TRUE(registration->active_version()); |
79 EXPECT_EQ(expect_version_id, | 79 EXPECT_EQ(expect_version_id, |
80 registration->active_version()->version_id()); | 80 registration->active_version()->version_id()); |
81 } else { | 81 } else { |
82 EXPECT_FALSE(registration->active_version()); | 82 EXPECT_FALSE(registration->active_version()); |
83 } | 83 } |
84 } | 84 } |
85 | 85 |
86 class RejectInstallTestHelper : public EmbeddedWorkerTestHelper { | 86 class RejectInstallTestHelper : public EmbeddedWorkerTestHelper { |
87 public: | 87 public: |
88 RejectInstallTestHelper(int mock_render_process_id) | 88 explicit RejectInstallTestHelper(int mock_render_process_id) |
89 : EmbeddedWorkerTestHelper(mock_render_process_id) {} | 89 : EmbeddedWorkerTestHelper(mock_render_process_id) {} |
90 | 90 |
91 virtual void OnInstallEvent(int embedded_worker_id, | 91 virtual void OnInstallEvent(int embedded_worker_id, |
92 int request_id, | 92 int request_id, |
93 int active_version_id) OVERRIDE { | 93 int active_version_id) OVERRIDE { |
94 SimulateSend( | 94 SimulateSend( |
95 new ServiceWorkerHostMsg_InstallEventFinished( | 95 new ServiceWorkerHostMsg_InstallEventFinished( |
96 embedded_worker_id, request_id, | 96 embedded_worker_id, request_id, |
97 blink::WebServiceWorkerEventResultRejected)); | 97 blink::WebServiceWorkerEventResultRejected)); |
98 } | 98 } |
99 }; | 99 }; |
100 | 100 |
101 class RejectActivateTestHelper : public EmbeddedWorkerTestHelper { | 101 class RejectActivateTestHelper : public EmbeddedWorkerTestHelper { |
102 public: | 102 public: |
103 RejectActivateTestHelper(int mock_render_process_id) | 103 explicit RejectActivateTestHelper(int mock_render_process_id) |
104 : EmbeddedWorkerTestHelper(mock_render_process_id) {} | 104 : EmbeddedWorkerTestHelper(mock_render_process_id) {} |
105 | 105 |
106 virtual void OnActivateEvent(int embedded_worker_id, | 106 virtual void OnActivateEvent(int embedded_worker_id, |
107 int request_id) OVERRIDE { | 107 int request_id) OVERRIDE { |
108 SimulateSend( | 108 SimulateSend( |
109 new ServiceWorkerHostMsg_ActivateEventFinished( | 109 new ServiceWorkerHostMsg_ActivateEventFinished( |
110 embedded_worker_id, request_id, | 110 embedded_worker_id, request_id, |
111 blink::WebServiceWorkerEventResultRejected)); | 111 blink::WebServiceWorkerEventResultRejected)); |
112 } | 112 } |
113 }; | 113 }; |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 GURL("http://www.example.com"), | 451 GURL("http://www.example.com"), |
452 base::Bind(&ExpectRegisteredWorkers, | 452 base::Bind(&ExpectRegisteredWorkers, |
453 SERVICE_WORKER_OK, | 453 SERVICE_WORKER_OK, |
454 version_id, | 454 version_id, |
455 false /* expect_waiting */, | 455 false /* expect_waiting */, |
456 true /* expect_active */)); | 456 true /* expect_active */)); |
457 base::RunLoop().RunUntilIdle(); | 457 base::RunLoop().RunUntilIdle(); |
458 } | 458 } |
459 | 459 |
460 } // namespace content | 460 } // namespace content |
OLD | NEW |