Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/fetch/FetchInitiatorInfo.h" | 7 #include "core/fetch/FetchInitiatorInfo.h" |
| 8 #include "core/fetch/FetchRequest.h" | 8 #include "core/fetch/FetchRequest.h" |
| 9 #include "core/fetch/MemoryCache.h" | 9 #include "core/fetch/MemoryCache.h" |
| 10 #include "core/fetch/MockFetchContext.h" | 10 #include "core/fetch/MockFetchContext.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 76 // startLoad() can be called from any initiator. Here, call it from the | 76 // startLoad() can be called from any initiator. Here, call it from the |
| 77 // latter. | 77 // latter. |
| 78 fetcher->startLoad(resource3); | 78 fetcher->startLoad(resource3); |
| 79 Platform::current()->getURLLoaderMockFactory()->serveAsynchronousRequests(); | 79 Platform::current()->getURLLoaderMockFactory()->serveAsynchronousRequests(); |
| 80 EXPECT_TRUE(resource3->isLoaded()); | 80 EXPECT_TRUE(resource3->isLoaded()); |
| 81 EXPECT_FALSE(resource3->errorOccurred()); | 81 EXPECT_FALSE(resource3->errorOccurred()); |
| 82 EXPECT_TRUE(resource2->isLoaded()); | 82 EXPECT_TRUE(resource2->isLoaded()); |
| 83 EXPECT_FALSE(resource2->errorOccurred()); | 83 EXPECT_FALSE(resource2->errorOccurred()); |
| 84 | 84 |
| 85 memoryCache()->remove(resource1); | 85 memoryCache()->remove(resource1); |
| 86 | |
| 87 Platform::current()->getURLLoaderMockFactory()->unregisterURL(url); | |
|
kinuko
2016/12/22 06:37:43
Do we rather want to have unregisterAllURLs() in F
Takashi Toyoshima
2016/12/22 07:02:59
Done.
| |
| 86 } | 88 } |
| 87 | 89 |
| 88 // Tests if cache-aware font loading works correctly. | 90 // Tests if cache-aware font loading works correctly. |
| 89 TEST_F(FontResourceTest, CacheAwareFontLoading) { | 91 TEST_F(FontResourceTest, CacheAwareFontLoading) { |
| 90 KURL url(ParsedURLString, "http://127.0.0.1:8000/font.woff"); | 92 KURL url(ParsedURLString, "http://127.0.0.1:8000/font.woff"); |
| 91 ResourceResponse response; | 93 ResourceResponse response; |
| 92 response.setURL(url); | 94 response.setURL(url); |
| 93 response.setHTTPStatusCode(200); | 95 response.setHTTPStatusCode(200); |
| 94 Platform::current()->getURLLoaderMockFactory()->registerURL( | 96 Platform::current()->getURLLoaderMockFactory()->registerURL( |
| 95 url, WrappedResourceResponse(response), ""); | 97 url, WrappedResourceResponse(response), ""); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 136 new MockFontResourceClient(resource); | 138 new MockFontResourceClient(resource); |
| 137 EXPECT_TRUE(client3->fontLoadShortLimitExceededCalled()); | 139 EXPECT_TRUE(client3->fontLoadShortLimitExceededCalled()); |
| 138 EXPECT_TRUE(client3->fontLoadLongLimitExceededCalled()); | 140 EXPECT_TRUE(client3->fontLoadLongLimitExceededCalled()); |
| 139 | 141 |
| 140 Platform::current()->getURLLoaderMockFactory()->serveAsynchronousRequests(); | 142 Platform::current()->getURLLoaderMockFactory()->serveAsynchronousRequests(); |
| 141 Platform::current()->getURLLoaderMockFactory()->unregisterURL(url); | 143 Platform::current()->getURLLoaderMockFactory()->unregisterURL(url); |
| 142 memoryCache()->remove(resource); | 144 memoryCache()->remove(resource); |
| 143 } | 145 } |
| 144 | 146 |
| 145 } // namespace blink | 147 } // namespace blink |
| OLD | NEW |