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

Side by Side Diff: third_party/WebKit/Source/modules/notifications/NotificationResourcesLoaderTest.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 "modules/notifications/NotificationResourcesLoader.h" 5 #include "modules/notifications/NotificationResourcesLoader.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include "core/testing/DummyPageHolder.h" 8 #include "core/testing/DummyPageHolder.h"
9 #include "platform/heap/Heap.h" 9 #include "platform/heap/Heap.h"
10 #include "platform/loader/fetch/MemoryCache.h" 10 #include "platform/loader/fetch/MemoryCache.h"
(...skipping 27 matching lines...) Expand all
38 class NotificationResourcesLoaderTest : public ::testing::Test { 38 class NotificationResourcesLoaderTest : public ::testing::Test {
39 public: 39 public:
40 NotificationResourcesLoaderTest() 40 NotificationResourcesLoaderTest()
41 : m_page(DummyPageHolder::create()), 41 : m_page(DummyPageHolder::create()),
42 m_loader(new NotificationResourcesLoader( 42 m_loader(new NotificationResourcesLoader(
43 bind(&NotificationResourcesLoaderTest::didFetchResources, 43 bind(&NotificationResourcesLoaderTest::didFetchResources,
44 WTF::unretained(this)))) {} 44 WTF::unretained(this)))) {}
45 45
46 ~NotificationResourcesLoaderTest() override { 46 ~NotificationResourcesLoaderTest() override {
47 m_loader->stop(); 47 m_loader->stop();
48 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs(); 48 Platform::current()
49 memoryCache()->evictResources(); 49 ->getURLLoaderMockFactory()
50 ->unregisterAllURLsAndClearMemoryCache();
50 } 51 }
51 52
52 protected: 53 protected:
53 ExecutionContext* executionContext() const { return &m_page->document(); } 54 ExecutionContext* executionContext() const { return &m_page->document(); }
54 55
55 NotificationResourcesLoader* loader() const { return m_loader.get(); } 56 NotificationResourcesLoader* loader() const { return m_loader.get(); }
56 57
57 WebNotificationResources* resources() const { return m_resources.get(); } 58 WebNotificationResources* resources() const { return m_resources.get(); }
58 59
59 void didFetchResources(NotificationResourcesLoader* loader) { 60 void didFetchResources(NotificationResourcesLoader* loader) {
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 Platform::current()->getURLLoaderMockFactory()->serveAsynchronousRequests(); 266 Platform::current()->getURLLoaderMockFactory()->serveAsynchronousRequests();
266 267
267 // Loading should have been cancelled when |stop| was called so no resources 268 // Loading should have been cancelled when |stop| was called so no resources
268 // should have been received by the test even though 269 // should have been received by the test even though
269 // |serveAsynchronousRequests| was called. 270 // |serveAsynchronousRequests| was called.
270 ASSERT_FALSE(resources()); 271 ASSERT_FALSE(resources());
271 } 272 }
272 273
273 } // namespace 274 } // namespace
274 } // namespace blink 275 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698