| 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 "modules/serviceworkers/ServiceWorkerContainer.h" | 6 #include "modules/serviceworkers/ServiceWorkerContainer.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/Dictionary.h" | 8 #include "bindings/core/v8/Dictionary.h" |
| 9 #include "bindings/core/v8/ScriptFunction.h" | 9 #include "bindings/core/v8/ScriptFunction.h" |
| 10 #include "bindings/core/v8/ScriptPromise.h" | 10 #include "bindings/core/v8/ScriptPromise.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 | 147 |
| 148 class ServiceWorkerContainerTest : public ::testing::Test { | 148 class ServiceWorkerContainerTest : public ::testing::Test { |
| 149 protected: | 149 protected: |
| 150 ServiceWorkerContainerTest() | 150 ServiceWorkerContainerTest() |
| 151 : m_page(DummyPageHolder::create()) | 151 : m_page(DummyPageHolder::create()) |
| 152 { | 152 { |
| 153 } | 153 } |
| 154 | 154 |
| 155 ~ServiceWorkerContainerTest() | 155 ~ServiceWorkerContainerTest() |
| 156 { | 156 { |
| 157 m_page.clear(); | 157 m_page.reset(); |
| 158 V8GCController::collectAllGarbageForTesting(isolate()); | 158 V8GCController::collectAllGarbageForTesting(isolate()); |
| 159 } | 159 } |
| 160 | 160 |
| 161 ExecutionContext* getExecutionContext() { return &(m_page->document()); } | 161 ExecutionContext* getExecutionContext() { return &(m_page->document()); } |
| 162 v8::Isolate* isolate() { return v8::Isolate::GetCurrent(); } | 162 v8::Isolate* isolate() { return v8::Isolate::GetCurrent(); } |
| 163 ScriptState* getScriptState() { return ScriptState::forMainWorld(m_page->doc
ument().frame()); } | 163 ScriptState* getScriptState() { return ScriptState::forMainWorld(m_page->doc
ument().frame()); } |
| 164 | 164 |
| 165 void provide(PassOwnPtr<WebServiceWorkerProvider> provider) | 165 void provide(PassOwnPtr<WebServiceWorkerProvider> provider) |
| 166 { | 166 { |
| 167 Supplement<Document>::provideTo(m_page->document(), ServiceWorkerContain
erClient::supplementName(), ServiceWorkerContainerClient::create(std::move(provi
der))); | 167 Supplement<Document>::provideTo(m_page->document(), ServiceWorkerContain
erClient::supplementName(), ServiceWorkerContainerClient::create(std::move(provi
der))); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 container->getRegistration(getScriptState(), ""); | 356 container->getRegistration(getScriptState(), ""); |
| 357 EXPECT_EQ(1ul, stubProvider.getRegistrationCallCount()); | 357 EXPECT_EQ(1ul, stubProvider.getRegistrationCallCount()); |
| 358 EXPECT_EQ(WebURL(KURL(KURL(), "http://localhost/x/index.html")), stubPro
vider.getRegistrationURL()); | 358 EXPECT_EQ(WebURL(KURL(KURL(), "http://localhost/x/index.html")), stubPro
vider.getRegistrationURL()); |
| 359 } | 359 } |
| 360 | 360 |
| 361 container->willBeDetachedFromFrame(); | 361 container->willBeDetachedFromFrame(); |
| 362 } | 362 } |
| 363 | 363 |
| 364 } // namespace | 364 } // namespace |
| 365 } // namespace blink | 365 } // namespace blink |
| OLD | NEW |