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

Side by Side Diff: third_party/WebKit/Source/web/WebAssociatedURLLoaderImplTest.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 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 16 matching lines...) Expand all
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "public/web/WebAssociatedURLLoader.h" 31 #include "public/web/WebAssociatedURLLoader.h"
32 32
33 #include <memory> 33 #include <memory>
34 #include "platform/testing/URLTestHelpers.h" 34 #include "platform/testing/URLTestHelpers.h"
35 #include "platform/testing/UnitTestHelpers.h" 35 #include "platform/testing/UnitTestHelpers.h"
36 #include "public/platform/Platform.h" 36 #include "public/platform/Platform.h"
37 #include "public/platform/WebCache.h"
38 #include "public/platform/WebString.h" 37 #include "public/platform/WebString.h"
39 #include "public/platform/WebThread.h" 38 #include "public/platform/WebThread.h"
40 #include "public/platform/WebURL.h" 39 #include "public/platform/WebURL.h"
41 #include "public/platform/WebURLLoaderMockFactory.h" 40 #include "public/platform/WebURLLoaderMockFactory.h"
42 #include "public/platform/WebURLRequest.h" 41 #include "public/platform/WebURLRequest.h"
43 #include "public/platform/WebURLResponse.h" 42 #include "public/platform/WebURLResponse.h"
44 #include "public/web/WebAssociatedURLLoaderClient.h" 43 #include "public/web/WebAssociatedURLLoaderClient.h"
45 #include "public/web/WebAssociatedURLLoaderOptions.h" 44 #include "public/web/WebAssociatedURLLoaderOptions.h"
46 #include "public/web/WebFrame.h" 45 #include "public/web/WebFrame.h"
47 #include "public/web/WebView.h" 46 #include "public/web/WebView.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 for (size_t i = 0; i < WTF_ARRAY_LENGTH(iframeSupportFiles); ++i) { 92 for (size_t i = 0; i < WTF_ARRAY_LENGTH(iframeSupportFiles); ++i) {
94 RegisterMockedUrl(urlRoot, iframeSupportFiles[i]); 93 RegisterMockedUrl(urlRoot, iframeSupportFiles[i]);
95 } 94 }
96 95
97 FrameTestHelpers::loadFrame(mainFrame(), url.getString().utf8().data()); 96 FrameTestHelpers::loadFrame(mainFrame(), url.getString().utf8().data());
98 97
99 Platform::current()->getURLLoaderMockFactory()->unregisterURL(url); 98 Platform::current()->getURLLoaderMockFactory()->unregisterURL(url);
100 } 99 }
101 100
102 void TearDown() override { 101 void TearDown() override {
103 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs(); 102 Platform::current()
104 WebCache::clear(); 103 ->getURLLoaderMockFactory()
104 ->unregisterAllURLsAndClearMemoryCache();
105 } 105 }
106 106
107 void serveRequests() { 107 void serveRequests() {
108 Platform::current()->getURLLoaderMockFactory()->serveAsynchronousRequests(); 108 Platform::current()->getURLLoaderMockFactory()->serveAsynchronousRequests();
109 } 109 }
110 110
111 std::unique_ptr<WebAssociatedURLLoader> createAssociatedURLLoader( 111 std::unique_ptr<WebAssociatedURLLoader> createAssociatedURLLoader(
112 const WebAssociatedURLLoaderOptions options = 112 const WebAssociatedURLLoaderOptions options =
113 WebAssociatedURLLoaderOptions()) { 113 WebAssociatedURLLoaderOptions()) {
114 return WTF::wrapUnique(mainFrame()->createAssociatedURLLoader(options)); 114 return WTF::wrapUnique(mainFrame()->createAssociatedURLLoader(options));
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 m_expectedLoader->loadAsynchronously(request, this); 671 m_expectedLoader->loadAsynchronously(request, this);
672 serveRequests(); 672 serveRequests();
673 EXPECT_TRUE(m_didReceiveResponse); 673 EXPECT_TRUE(m_didReceiveResponse);
674 EXPECT_TRUE(m_didReceiveData); 674 EXPECT_TRUE(m_didReceiveData);
675 EXPECT_TRUE(m_didFinishLoading); 675 EXPECT_TRUE(m_didFinishLoading);
676 676
677 EXPECT_FALSE(m_actualResponse.httpHeaderField(headerNameString).isEmpty()); 677 EXPECT_FALSE(m_actualResponse.httpHeaderField(headerNameString).isEmpty());
678 } 678 }
679 679
680 } // namespace blink 680 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/LinkHighlightImplTest.cpp ('k') | third_party/WebKit/Source/web/WebEmbeddedWorkerImplTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698