| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 132 |
| 133 class NotReachedWebServiceWorkerProvider : public WebServiceWorkerProvider { | 133 class NotReachedWebServiceWorkerProvider : public WebServiceWorkerProvider { |
| 134 public: | 134 public: |
| 135 ~NotReachedWebServiceWorkerProvider() override { } | 135 ~NotReachedWebServiceWorkerProvider() override { } |
| 136 | 136 |
| 137 void registerServiceWorker(const WebURL& pattern, const WebURL& scriptURL, W
ebServiceWorkerRegistrationCallbacks* callbacks) override | 137 void registerServiceWorker(const WebURL& pattern, const WebURL& scriptURL, W
ebServiceWorkerRegistrationCallbacks* callbacks) override |
| 138 { | 138 { |
| 139 ADD_FAILURE() << "the provider should not be called to register a Servic
e Worker"; | 139 ADD_FAILURE() << "the provider should not be called to register a Servic
e Worker"; |
| 140 delete callbacks; | 140 delete callbacks; |
| 141 } | 141 } |
| 142 |
| 143 bool validateScopeAndScriptURL(const WebURL& scope, const WebURL& scriptURL,
WebString* errorMessage) |
| 144 { |
| 145 return true; |
| 146 } |
| 142 }; | 147 }; |
| 143 | 148 |
| 144 class ServiceWorkerContainerTest : public ::testing::Test { | 149 class ServiceWorkerContainerTest : public ::testing::Test { |
| 145 protected: | 150 protected: |
| 146 ServiceWorkerContainerTest() | 151 ServiceWorkerContainerTest() |
| 147 : m_page(DummyPageHolder::create()) | 152 : m_page(DummyPageHolder::create()) |
| 148 { | 153 { |
| 149 } | 154 } |
| 150 | 155 |
| 151 ~ServiceWorkerContainerTest() | 156 ~ServiceWorkerContainerTest() |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 m_registrationCallbacksToDelete.append(adoptPtr(callbacks)); | 293 m_registrationCallbacksToDelete.append(adoptPtr(callbacks)); |
| 289 } | 294 } |
| 290 | 295 |
| 291 void getRegistration(const WebURL& documentURL, WebServiceWorkerGetRegis
trationCallbacks* callbacks) override | 296 void getRegistration(const WebURL& documentURL, WebServiceWorkerGetRegis
trationCallbacks* callbacks) override |
| 292 { | 297 { |
| 293 m_owner.m_getRegistrationCallCount++; | 298 m_owner.m_getRegistrationCallCount++; |
| 294 m_owner.m_getRegistrationURL = documentURL; | 299 m_owner.m_getRegistrationURL = documentURL; |
| 295 m_getRegistrationCallbacksToDelete.append(adoptPtr(callbacks)); | 300 m_getRegistrationCallbacksToDelete.append(adoptPtr(callbacks)); |
| 296 } | 301 } |
| 297 | 302 |
| 303 bool validateScopeAndScriptURL(const WebURL& scope, const WebURL& script
URL, WebString* errorMessage) |
| 304 { |
| 305 return true; |
| 306 } |
| 307 |
| 298 private: | 308 private: |
| 299 StubWebServiceWorkerProvider& m_owner; | 309 StubWebServiceWorkerProvider& m_owner; |
| 300 Vector<OwnPtr<WebServiceWorkerRegistrationCallbacks>> m_registrationCall
backsToDelete; | 310 Vector<OwnPtr<WebServiceWorkerRegistrationCallbacks>> m_registrationCall
backsToDelete; |
| 301 Vector<OwnPtr<WebServiceWorkerGetRegistrationCallbacks>> m_getRegistrati
onCallbacksToDelete; | 311 Vector<OwnPtr<WebServiceWorkerGetRegistrationCallbacks>> m_getRegistrati
onCallbacksToDelete; |
| 302 }; | 312 }; |
| 303 | 313 |
| 304 private: | 314 private: |
| 305 size_t m_registerCallCount; | 315 size_t m_registerCallCount; |
| 306 WebURL m_registerScope; | 316 WebURL m_registerScope; |
| 307 WebURL m_registerScriptURL; | 317 WebURL m_registerScriptURL; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 container->getRegistration(scriptState(), ""); | 357 container->getRegistration(scriptState(), ""); |
| 348 EXPECT_EQ(1ul, stubProvider.getRegistrationCallCount()); | 358 EXPECT_EQ(1ul, stubProvider.getRegistrationCallCount()); |
| 349 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()); |
| 350 } | 360 } |
| 351 | 361 |
| 352 container->willBeDetachedFromFrame(); | 362 container->willBeDetachedFromFrame(); |
| 353 } | 363 } |
| 354 | 364 |
| 355 } // namespace | 365 } // namespace |
| 356 } // namespace blink | 366 } // namespace blink |
| OLD | NEW |