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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 virtual 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 virtual void OnActivateEvent(int embedded_worker_id, |
96 int request_id) OVERRIDE { | 96 int request_id) override { |
97 SimulateSend( | 97 SimulateSend( |
98 new ServiceWorkerHostMsg_ActivateEventFinished( | 98 new ServiceWorkerHostMsg_ActivateEventFinished( |
99 embedded_worker_id, request_id, | 99 embedded_worker_id, request_id, |
100 blink::WebServiceWorkerEventResultRejected)); | 100 blink::WebServiceWorkerEventResultRejected)); |
101 } | 101 } |
102 }; | 102 }; |
103 | 103 |
104 } // namespace | 104 } // namespace |
105 | 105 |
106 class ServiceWorkerContextTest : public testing::Test { | 106 class ServiceWorkerContextTest : public testing::Test { |
107 public: | 107 public: |
108 ServiceWorkerContextTest() | 108 ServiceWorkerContextTest() |
109 : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP), | 109 : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP), |
110 render_process_id_(99) {} | 110 render_process_id_(99) {} |
111 | 111 |
112 virtual void SetUp() OVERRIDE { | 112 virtual void SetUp() override { |
113 helper_.reset(new EmbeddedWorkerTestHelper(render_process_id_)); | 113 helper_.reset(new EmbeddedWorkerTestHelper(render_process_id_)); |
114 } | 114 } |
115 | 115 |
116 virtual void TearDown() OVERRIDE { | 116 virtual void TearDown() override { |
117 helper_.reset(); | 117 helper_.reset(); |
118 } | 118 } |
119 | 119 |
120 ServiceWorkerContextCore* context() { return helper_->context(); } | 120 ServiceWorkerContextCore* context() { return helper_->context(); } |
121 | 121 |
122 protected: | 122 protected: |
123 TestBrowserThreadBundle browser_thread_bundle_; | 123 TestBrowserThreadBundle browser_thread_bundle_; |
124 scoped_ptr<EmbeddedWorkerTestHelper> helper_; | 124 scoped_ptr<EmbeddedWorkerTestHelper> helper_; |
125 const int render_process_id_; | 125 const int render_process_id_; |
126 }; | 126 }; |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 registration_id, | 408 registration_id, |
409 GURL("http://www.example.com"), | 409 GURL("http://www.example.com"), |
410 base::Bind(&ExpectRegisteredWorkers, | 410 base::Bind(&ExpectRegisteredWorkers, |
411 SERVICE_WORKER_OK, | 411 SERVICE_WORKER_OK, |
412 false /* expect_waiting */, | 412 false /* expect_waiting */, |
413 true /* expect_active */)); | 413 true /* expect_active */)); |
414 base::RunLoop().RunUntilIdle(); | 414 base::RunLoop().RunUntilIdle(); |
415 } | 415 } |
416 | 416 |
417 } // namespace content | 417 } // namespace content |
OLD | NEW |