Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: third_party/WebKit/Source/web/WebEmbeddedWorkerImplTest.cpp

Issue 2683033005: URLLoaderMockFactory: clear MemoryCache in unregisterAllURLs (Closed)
Patch Set: fix Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 m_startData.scriptURL = scriptURL; 97 m_startData.scriptURL = scriptURL;
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()
109 WebCache::clear(); 108 ->getURLLoaderMockFactory()
109 ->unregisterAllURLsAndClearMemoryCache();
110 } 110 }
111 111
112 WebEmbeddedWorkerStartData m_startData; 112 WebEmbeddedWorkerStartData m_startData;
113 MockServiceWorkerContextClient* m_mockClient; 113 MockServiceWorkerContextClient* m_mockClient;
114 std::unique_ptr<WebEmbeddedWorker> m_worker; 114 std::unique_ptr<WebEmbeddedWorker> m_worker;
115 }; 115 };
116 116
117 } // namespace 117 } // namespace
118 118
119 TEST_F(WebEmbeddedWorkerImplTest, TerminateSoonAfterStart) { 119 TEST_F(WebEmbeddedWorkerImplTest, TerminateSoonAfterStart) {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 ::testing::Mock::VerifyAndClearExpectations(m_mockClient); 286 ::testing::Mock::VerifyAndClearExpectations(m_mockClient);
287 287
288 // Resume after download. 288 // Resume after download.
289 EXPECT_CALL(*m_mockClient, createServiceWorkerProvider()) 289 EXPECT_CALL(*m_mockClient, createServiceWorkerProvider())
290 .WillOnce(::testing::Return(nullptr)); 290 .WillOnce(::testing::Return(nullptr));
291 m_worker->resumeAfterDownload(); 291 m_worker->resumeAfterDownload();
292 ::testing::Mock::VerifyAndClearExpectations(m_mockClient); 292 ::testing::Mock::VerifyAndClearExpectations(m_mockClient);
293 } 293 }
294 294
295 } // namespace blink 295 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698