| 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 <memory> | 7 #include <memory> |
| 8 #include "platform/testing/URLTestHelpers.h" | 8 #include "platform/testing/URLTestHelpers.h" |
| 9 #include "platform/testing/UnitTestHelpers.h" | 9 #include "platform/testing/UnitTestHelpers.h" |
| 10 #include "public/platform/Platform.h" | 10 #include "public/platform/Platform.h" |
| 11 #include "public/platform/WebCache.h" | |
| 12 #include "public/platform/WebURLLoaderMockFactory.h" | 11 #include "public/platform/WebURLLoaderMockFactory.h" |
| 13 #include "public/platform/WebURLResponse.h" | 12 #include "public/platform/WebURLResponse.h" |
| 14 #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" | 13 #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" |
| 15 #include "public/web/WebEmbeddedWorkerStartData.h" | 14 #include "public/web/WebEmbeddedWorkerStartData.h" |
| 16 #include "public/web/WebSettings.h" | 15 #include "public/web/WebSettings.h" |
| 17 #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h" | 16 #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h" |
| 18 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 20 #include "wtf/PtrUtil.h" | 19 #include "wtf/PtrUtil.h" |
| 21 | 20 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 m_startData.userAgent = WebString("dummy user agent"); | 98 m_startData.userAgent = WebString("dummy user agent"); |
| 100 m_startData.pauseAfterDownloadMode = | 99 m_startData.pauseAfterDownloadMode = |
| 101 WebEmbeddedWorkerStartData::DontPauseAfterDownload; | 100 WebEmbeddedWorkerStartData::DontPauseAfterDownload; |
| 102 m_startData.waitForDebuggerMode = | 101 m_startData.waitForDebuggerMode = |
| 103 WebEmbeddedWorkerStartData::DontWaitForDebugger; | 102 WebEmbeddedWorkerStartData::DontWaitForDebugger; |
| 104 m_startData.v8CacheOptions = WebSettings::V8CacheOptionsDefault; | 103 m_startData.v8CacheOptions = WebSettings::V8CacheOptionsDefault; |
| 105 } | 104 } |
| 106 | 105 |
| 107 void TearDown() override { | 106 void TearDown() override { |
| 108 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs(); | 107 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs(); |
| 109 WebCache::clear(); | |
| 110 } | 108 } |
| 111 | 109 |
| 112 WebEmbeddedWorkerStartData m_startData; | 110 WebEmbeddedWorkerStartData m_startData; |
| 113 MockServiceWorkerContextClient* m_mockClient; | 111 MockServiceWorkerContextClient* m_mockClient; |
| 114 std::unique_ptr<WebEmbeddedWorker> m_worker; | 112 std::unique_ptr<WebEmbeddedWorker> m_worker; |
| 115 }; | 113 }; |
| 116 | 114 |
| 117 } // namespace | 115 } // namespace |
| 118 | 116 |
| 119 TEST_F(WebEmbeddedWorkerImplTest, TerminateSoonAfterStart) { | 117 TEST_F(WebEmbeddedWorkerImplTest, TerminateSoonAfterStart) { |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 ::testing::Mock::VerifyAndClearExpectations(m_mockClient); | 284 ::testing::Mock::VerifyAndClearExpectations(m_mockClient); |
| 287 | 285 |
| 288 // Resume after download. | 286 // Resume after download. |
| 289 EXPECT_CALL(*m_mockClient, createServiceWorkerProvider()) | 287 EXPECT_CALL(*m_mockClient, createServiceWorkerProvider()) |
| 290 .WillOnce(::testing::Return(nullptr)); | 288 .WillOnce(::testing::Return(nullptr)); |
| 291 m_worker->resumeAfterDownload(); | 289 m_worker->resumeAfterDownload(); |
| 292 ::testing::Mock::VerifyAndClearExpectations(m_mockClient); | 290 ::testing::Mock::VerifyAndClearExpectations(m_mockClient); |
| 293 } | 291 } |
| 294 | 292 |
| 295 } // namespace blink | 293 } // namespace blink |
| OLD | NEW |