| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "public/web/WebEmbeddedWorker.h" | 5 #include "public/web/WebEmbeddedWorker.h" |
| 6 | 6 |
| 7 #include "platform/testing/URLTestHelpers.h" | 7 #include "platform/testing/URLTestHelpers.h" |
| 8 #include "platform/testing/UnitTestHelpers.h" | 8 #include "platform/testing/UnitTestHelpers.h" |
| 9 #include "public/platform/InterfaceRegistry.h" |
| 9 #include "public/platform/Platform.h" | 10 #include "public/platform/Platform.h" |
| 10 #include "public/platform/WebURLLoaderMockFactory.h" | 11 #include "public/platform/WebURLLoaderMockFactory.h" |
| 11 #include "public/platform/WebURLResponse.h" | 12 #include "public/platform/WebURLResponse.h" |
| 12 #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" | 13 #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" |
| 13 #include "public/web/WebCache.h" | 14 #include "public/web/WebCache.h" |
| 14 #include "public/web/WebEmbeddedWorkerStartData.h" | 15 #include "public/web/WebEmbeddedWorkerStartData.h" |
| 15 #include "public/web/WebSettings.h" | 16 #include "public/web/WebSettings.h" |
| 16 #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h" | 17 #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h" |
| 17 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 void navigate(const WebString& uuid, | 69 void navigate(const WebString& uuid, |
| 69 const WebURL&, | 70 const WebURL&, |
| 70 WebServiceWorkerClientCallbacks*) override { | 71 WebServiceWorkerClientCallbacks*) override { |
| 71 NOTREACHED(); | 72 NOTREACHED(); |
| 72 } | 73 } |
| 73 void registerForeignFetchScopes( | 74 void registerForeignFetchScopes( |
| 74 const WebVector<WebURL>& subScopes, | 75 const WebVector<WebURL>& subScopes, |
| 75 const WebVector<WebSecurityOrigin>& origins) override { | 76 const WebVector<WebSecurityOrigin>& origins) override { |
| 76 NOTREACHED(); | 77 NOTREACHED(); |
| 77 } | 78 } |
| 79 InterfaceRegistry* interfaceRegistry() { |
| 80 return InterfaceRegistry::getEmptyInterfaceRegistry(); |
| 81 } |
| 78 | 82 |
| 79 private: | 83 private: |
| 80 bool m_hasAssociatedRegistration; | 84 bool m_hasAssociatedRegistration; |
| 81 }; | 85 }; |
| 82 | 86 |
| 83 class WebEmbeddedWorkerImplTest : public ::testing::Test { | 87 class WebEmbeddedWorkerImplTest : public ::testing::Test { |
| 84 protected: | 88 protected: |
| 85 void SetUp() override { | 89 void SetUp() override { |
| 86 m_mockClient = new MockServiceWorkerContextClient(); | 90 m_mockClient = new MockServiceWorkerContextClient(); |
| 87 m_worker = wrapUnique(WebEmbeddedWorker::create(m_mockClient, nullptr)); | 91 m_worker = wrapUnique(WebEmbeddedWorker::create(m_mockClient, nullptr)); |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 ::testing::Mock::VerifyAndClearExpectations(m_mockClient); | 288 ::testing::Mock::VerifyAndClearExpectations(m_mockClient); |
| 285 | 289 |
| 286 // Resume after download. | 290 // Resume after download. |
| 287 EXPECT_CALL(*m_mockClient, createServiceWorkerProvider()) | 291 EXPECT_CALL(*m_mockClient, createServiceWorkerProvider()) |
| 288 .WillOnce(::testing::Return(nullptr)); | 292 .WillOnce(::testing::Return(nullptr)); |
| 289 m_worker->resumeAfterDownload(); | 293 m_worker->resumeAfterDownload(); |
| 290 ::testing::Mock::VerifyAndClearExpectations(m_mockClient); | 294 ::testing::Mock::VerifyAndClearExpectations(m_mockClient); |
| 291 } | 295 } |
| 292 | 296 |
| 293 } // namespace blink | 297 } // namespace blink |
| OLD | NEW |