OLD | NEW |
1 | 1 |
2 // Copyright 2014 The Chromium Authors. All rights reserved. | 2 // Copyright 2014 The Chromium Authors. All rights reserved. |
3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
5 | 5 |
6 #include "config.h" | 6 #include "config.h" |
7 #include "modules/serviceworkers/ServiceWorkerContainer.h" | 7 #include "modules/serviceworkers/ServiceWorkerContainer.h" |
8 | 8 |
9 #include "bindings/core/v8/Dictionary.h" | 9 #include "bindings/core/v8/Dictionary.h" |
10 #include "bindings/core/v8/ScriptFunction.h" | 10 #include "bindings/core/v8/ScriptFunction.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 class ServiceWorkerContainerTest : public ::testing::Test { | 149 class ServiceWorkerContainerTest : public ::testing::Test { |
150 protected: | 150 protected: |
151 ServiceWorkerContainerTest() | 151 ServiceWorkerContainerTest() |
152 : m_page(DummyPageHolder::create()) | 152 : m_page(DummyPageHolder::create()) |
153 { | 153 { |
154 } | 154 } |
155 | 155 |
156 ~ServiceWorkerContainerTest() | 156 ~ServiceWorkerContainerTest() |
157 { | 157 { |
158 m_page.clear(); | 158 m_page.clear(); |
159 V8GCController::collectGarbage(isolate()); | 159 V8GCController::collectAllGarbage(isolate()); |
160 } | 160 } |
161 | 161 |
162 ExecutionContext* executionContext() { return &(m_page->document()); } | 162 ExecutionContext* executionContext() { return &(m_page->document()); } |
163 v8::Isolate* isolate() { return v8::Isolate::GetCurrent(); } | 163 v8::Isolate* isolate() { return v8::Isolate::GetCurrent(); } |
164 ScriptState* scriptState() { return ScriptState::forMainWorld(m_page->docume
nt().frame()); } | 164 ScriptState* scriptState() { return ScriptState::forMainWorld(m_page->docume
nt().frame()); } |
165 | 165 |
166 void provide(PassOwnPtr<WebServiceWorkerProvider> provider) | 166 void provide(PassOwnPtr<WebServiceWorkerProvider> provider) |
167 { | 167 { |
168 m_page->document().WillBeHeapSupplementable<Document>::provideSupplement
(ServiceWorkerContainerClient::supplementName(), ServiceWorkerContainerClient::c
reate(provider)); | 168 m_page->document().WillBeHeapSupplementable<Document>::provideSupplement
(ServiceWorkerContainerClient::supplementName(), ServiceWorkerContainerClient::c
reate(provider)); |
169 } | 169 } |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 container->getRegistration(scriptState(), ""); | 357 container->getRegistration(scriptState(), ""); |
358 EXPECT_EQ(1ul, stubProvider.getRegistrationCallCount()); | 358 EXPECT_EQ(1ul, stubProvider.getRegistrationCallCount()); |
359 EXPECT_EQ(WebURL(KURL(KURL(), "http://localhost/x/index.html")), stubPro
vider.getRegistrationURL()); | 359 EXPECT_EQ(WebURL(KURL(KURL(), "http://localhost/x/index.html")), stubPro
vider.getRegistrationURL()); |
360 } | 360 } |
361 | 361 |
362 container->willBeDetachedFromFrame(); | 362 container->willBeDetachedFromFrame(); |
363 } | 363 } |
364 | 364 |
365 } // namespace | 365 } // namespace |
366 } // namespace blink | 366 } // namespace blink |
OLD | NEW |