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

Side by Side Diff: third_party/WebKit/Source/core/loader/resource/FontResourceTest.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "core/loader/resource/FontResource.h" 5 #include "core/loader/resource/FontResource.h"
6 6
7 #include "core/loader/resource/MockFontResourceClient.h" 7 #include "core/loader/resource/MockFontResourceClient.h"
8 #include "platform/exported/WrappedResourceResponse.h" 8 #include "platform/exported/WrappedResourceResponse.h"
9 #include "platform/loader/fetch/FetchInitiatorInfo.h" 9 #include "platform/loader/fetch/FetchInitiatorInfo.h"
10 #include "platform/loader/fetch/FetchRequest.h" 10 #include "platform/loader/fetch/FetchRequest.h"
11 #include "platform/loader/fetch/MemoryCache.h" 11 #include "platform/loader/fetch/MemoryCache.h"
12 #include "platform/loader/fetch/MockFetchContext.h" 12 #include "platform/loader/fetch/MockFetchContext.h"
13 #include "platform/loader/fetch/MockResourceClient.h" 13 #include "platform/loader/fetch/MockResourceClient.h"
14 #include "platform/loader/fetch/ResourceFetcher.h" 14 #include "platform/loader/fetch/ResourceFetcher.h"
15 #include "platform/loader/fetch/ResourceLoader.h" 15 #include "platform/loader/fetch/ResourceLoader.h"
16 #include "platform/network/ResourceError.h" 16 #include "platform/network/ResourceError.h"
17 #include "platform/network/ResourceRequest.h" 17 #include "platform/network/ResourceRequest.h"
18 #include "platform/network/ResourceResponse.h" 18 #include "platform/network/ResourceResponse.h"
19 #include "platform/weborigin/KURL.h" 19 #include "platform/weborigin/KURL.h"
20 #include "public/platform/Platform.h" 20 #include "public/platform/Platform.h"
21 #include "public/platform/WebURLLoaderMockFactory.h" 21 #include "public/platform/WebURLLoaderMockFactory.h"
22 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
23 23
24 namespace blink { 24 namespace blink {
25 25
26 class FontResourceTest : public ::testing::Test { 26 class FontResourceTest : public ::testing::Test {
27 void TearDown() override { 27 void TearDown() override {
28 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs(); 28 Platform::current()
29 ->getURLLoaderMockFactory()
30 ->unregisterAllURLsAndClearMemoryCache();
29 } 31 }
30 }; 32 };
31 33
32 // Tests if ResourceFetcher works fine with FontResource that requires defered 34 // Tests if ResourceFetcher works fine with FontResource that requires defered
33 // loading supports. 35 // loading supports.
34 TEST_F(FontResourceTest, 36 TEST_F(FontResourceTest,
35 ResourceFetcherRevalidateDeferedResourceFromTwoInitiators) { 37 ResourceFetcherRevalidateDeferedResourceFromTwoInitiators) {
36 KURL url(ParsedURLString, "http://127.0.0.1:8000/font.woff"); 38 KURL url(ParsedURLString, "http://127.0.0.1:8000/font.woff");
37 ResourceResponse response; 39 ResourceResponse response;
38 response.setURL(url); 40 response.setURL(url);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 Persistent<MockFontResourceClient> client3 = 141 Persistent<MockFontResourceClient> client3 =
140 new MockFontResourceClient(resource); 142 new MockFontResourceClient(resource);
141 EXPECT_TRUE(client3->fontLoadShortLimitExceededCalled()); 143 EXPECT_TRUE(client3->fontLoadShortLimitExceededCalled());
142 EXPECT_TRUE(client3->fontLoadLongLimitExceededCalled()); 144 EXPECT_TRUE(client3->fontLoadLongLimitExceededCalled());
143 145
144 Platform::current()->getURLLoaderMockFactory()->serveAsynchronousRequests(); 146 Platform::current()->getURLLoaderMockFactory()->serveAsynchronousRequests();
145 memoryCache()->remove(resource); 147 memoryCache()->remove(resource);
146 } 148 }
147 149
148 } // namespace blink 150 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698