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

Side by Side Diff: third_party/WebKit/Source/web/tests/MHTMLTest.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) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 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 22 matching lines...) Expand all
33 #include "core/frame/Location.h" 33 #include "core/frame/Location.h"
34 #include "core/page/Page.h" 34 #include "core/page/Page.h"
35 #include "platform/SerializedResource.h" 35 #include "platform/SerializedResource.h"
36 #include "platform/SharedBuffer.h" 36 #include "platform/SharedBuffer.h"
37 #include "platform/mhtml/MHTMLArchive.h" 37 #include "platform/mhtml/MHTMLArchive.h"
38 #include "platform/testing/URLTestHelpers.h" 38 #include "platform/testing/URLTestHelpers.h"
39 #include "platform/testing/UnitTestHelpers.h" 39 #include "platform/testing/UnitTestHelpers.h"
40 #include "platform/weborigin/KURL.h" 40 #include "platform/weborigin/KURL.h"
41 #include "platform/weborigin/SchemeRegistry.h" 41 #include "platform/weborigin/SchemeRegistry.h"
42 #include "public/platform/Platform.h" 42 #include "public/platform/Platform.h"
43 #include "public/platform/WebCache.h"
44 #include "public/platform/WebString.h" 43 #include "public/platform/WebString.h"
45 #include "public/platform/WebURL.h" 44 #include "public/platform/WebURL.h"
46 #include "public/platform/WebURLLoaderMockFactory.h" 45 #include "public/platform/WebURLLoaderMockFactory.h"
47 #include "public/platform/WebURLRequest.h" 46 #include "public/platform/WebURLRequest.h"
48 #include "public/platform/WebURLResponse.h" 47 #include "public/platform/WebURLResponse.h"
49 #include "public/web/WebDocument.h" 48 #include "public/web/WebDocument.h"
50 #include "public/web/WebFrame.h" 49 #include "public/web/WebFrame.h"
51 #include "public/web/WebView.h" 50 #include "public/web/WebView.h"
52 #include "testing/gtest/include/gtest/gtest.h" 51 #include "testing/gtest/include/gtest/gtest.h"
53 #include "web/tests/FrameTestHelpers.h" 52 #include "web/tests/FrameTestHelpers.h"
(...skipping 28 matching lines...) Expand all
82 }; 81 };
83 82
84 class MHTMLTest : public ::testing::Test { 83 class MHTMLTest : public ::testing::Test {
85 public: 84 public:
86 MHTMLTest() { m_filePath = testing::webTestDataPath("mhtml/"); } 85 MHTMLTest() { m_filePath = testing::webTestDataPath("mhtml/"); }
87 86
88 protected: 87 protected:
89 void SetUp() override { m_helper.initialize(); } 88 void SetUp() override { m_helper.initialize(); }
90 89
91 void TearDown() override { 90 void TearDown() override {
92 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs(); 91 Platform::current()
93 WebCache::clear(); 92 ->getURLLoaderMockFactory()
93 ->unregisterAllURLsAndClearMemoryCache();
94 } 94 }
95 95
96 void registerMockedURLLoad(const std::string& url, 96 void registerMockedURLLoad(const std::string& url,
97 const std::string& fileName) { 97 const std::string& fileName) {
98 URLTestHelpers::registerMockedURLLoad( 98 URLTestHelpers::registerMockedURLLoad(
99 toKURL(url), 99 toKURL(url),
100 testing::webTestDataPath(WebString::fromUTF8("mhtml/" + fileName)), 100 testing::webTestDataPath(WebString::fromUTF8("mhtml/" + fileName)),
101 WebString::fromUTF8("multipart/related")); 101 WebString::fromUTF8("multipart/related"));
102 } 102 }
103 103
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 // Full sandboxing should be turned on. 278 // Full sandboxing should be turned on.
279 EXPECT_TRUE(document->isSandboxed(SandboxAll)); 279 EXPECT_TRUE(document->isSandboxed(SandboxAll));
280 280
281 // MHTML document should be loaded into unique origin. 281 // MHTML document should be loaded into unique origin.
282 EXPECT_TRUE(document->getSecurityOrigin()->isUnique()); 282 EXPECT_TRUE(document->getSecurityOrigin()->isUnique());
283 // Script execution should be disabled. 283 // Script execution should be disabled.
284 EXPECT_FALSE(document->canExecuteScripts(NotAboutToExecuteScript)); 284 EXPECT_FALSE(document->canExecuteScripts(NotAboutToExecuteScript));
285 } 285 }
286 286
287 } // namespace blink 287 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/ListenerLeakTest.cpp ('k') | third_party/WebKit/Source/web/tests/PrerenderingTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698