| 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 <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "bindings/core/v8/Dictionary.h" | 11 #include "bindings/core/v8/Dictionary.h" |
| 12 #include "bindings/core/v8/ScriptFunction.h" | 12 #include "bindings/core/v8/ScriptFunction.h" |
| 13 #include "bindings/core/v8/ScriptPromise.h" | 13 #include "bindings/core/v8/ScriptPromise.h" |
| 14 #include "bindings/core/v8/ScriptState.h" | 14 #include "bindings/core/v8/ScriptState.h" |
| 15 #include "bindings/core/v8/V8Binding.h" |
| 15 #include "bindings/core/v8/V8DOMException.h" | 16 #include "bindings/core/v8/V8DOMException.h" |
| 16 #include "bindings/core/v8/V8GCController.h" | 17 #include "bindings/core/v8/V8GCController.h" |
| 17 #include "core/dom/DOMException.h" | 18 #include "core/dom/DOMException.h" |
| 18 #include "core/dom/Document.h" | 19 #include "core/dom/Document.h" |
| 19 #include "core/dom/ExecutionContext.h" | 20 #include "core/dom/ExecutionContext.h" |
| 20 #include "core/page/FocusController.h" | 21 #include "core/page/FocusController.h" |
| 21 #include "core/testing/DummyPageHolder.h" | 22 #include "core/testing/DummyPageHolder.h" |
| 22 #include "modules/serviceworkers/NavigatorServiceWorker.h" | 23 #include "modules/serviceworkers/NavigatorServiceWorker.h" |
| 23 #include "modules/serviceworkers/ServiceWorkerContainerClient.h" | 24 #include "modules/serviceworkers/ServiceWorkerContainerClient.h" |
| 24 #include "platform/weborigin/KURL.h" | 25 #include "platform/weborigin/KURL.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 m_page.reset(); | 151 m_page.reset(); |
| 151 V8GCController::collectAllGarbageForTesting(isolate()); | 152 V8GCController::collectAllGarbageForTesting(isolate()); |
| 152 } | 153 } |
| 153 | 154 |
| 154 ExecutionContext* getExecutionContext() { return &(m_page->document()); } | 155 ExecutionContext* getExecutionContext() { return &(m_page->document()); } |
| 155 NavigatorServiceWorker* getNavigatorServiceWorker() { | 156 NavigatorServiceWorker* getNavigatorServiceWorker() { |
| 156 return NavigatorServiceWorker::from(m_page->document()); | 157 return NavigatorServiceWorker::from(m_page->document()); |
| 157 } | 158 } |
| 158 v8::Isolate* isolate() { return v8::Isolate::GetCurrent(); } | 159 v8::Isolate* isolate() { return v8::Isolate::GetCurrent(); } |
| 159 ScriptState* getScriptState() { | 160 ScriptState* getScriptState() { |
| 160 return ScriptState::forMainWorld(m_page->document().frame()); | 161 return toScriptStateForMainWorld(m_page->document().frame()); |
| 161 } | 162 } |
| 162 | 163 |
| 163 void provide(std::unique_ptr<WebServiceWorkerProvider> provider) { | 164 void provide(std::unique_ptr<WebServiceWorkerProvider> provider) { |
| 164 Supplement<Document>::provideTo( | 165 Supplement<Document>::provideTo( |
| 165 m_page->document(), ServiceWorkerContainerClient::supplementName(), | 166 m_page->document(), ServiceWorkerContainerClient::supplementName(), |
| 166 new ServiceWorkerContainerClient(m_page->document(), | 167 new ServiceWorkerContainerClient(m_page->document(), |
| 167 std::move(provider))); | 168 std::move(provider))); |
| 168 } | 169 } |
| 169 | 170 |
| 170 void setPageURL(const String& url) { | 171 void setPageURL(const String& url) { |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 ScriptState::Scope scriptScope(getScriptState()); | 371 ScriptState::Scope scriptScope(getScriptState()); |
| 371 container->getRegistration(getScriptState(), ""); | 372 container->getRegistration(getScriptState(), ""); |
| 372 EXPECT_EQ(1ul, stubProvider.getRegistrationCallCount()); | 373 EXPECT_EQ(1ul, stubProvider.getRegistrationCallCount()); |
| 373 EXPECT_EQ(WebURL(KURL(KURL(), "http://localhost/x/index.html")), | 374 EXPECT_EQ(WebURL(KURL(KURL(), "http://localhost/x/index.html")), |
| 374 stubProvider.getRegistrationURL()); | 375 stubProvider.getRegistrationURL()); |
| 375 } | 376 } |
| 376 } | 377 } |
| 377 | 378 |
| 378 } // namespace | 379 } // namespace |
| 379 } // namespace blink | 380 } // namespace blink |
| OLD | NEW |