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

Unified Diff: third_party/WebKit/Source/core/fetch/ResourceTest.cpp

Issue 2253853002: Remove SharedBuffer::unlock() and keep Resource's SharedBuffer always locked (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use hasClientsOrObservers() for live_size Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/fetch/ResourceTest.cpp
diff --git a/third_party/WebKit/Source/core/fetch/ResourceTest.cpp b/third_party/WebKit/Source/core/fetch/ResourceTest.cpp
index a351cb68f74970075314ee88cd699c7e602340ad..84c306310ef9ad6b76a5830e81ea5a51b16b206d 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceTest.cpp
+++ b/third_party/WebKit/Source/core/fetch/ResourceTest.cpp
@@ -18,22 +18,6 @@ namespace blink {
namespace {
-class UnlockableResource : public Resource {
-public:
- static UnlockableResource* create(const KURL& url)
- {
- return new UnlockableResource(ResourceRequest(url), Resource::Raw);
- }
-
-private:
- UnlockableResource(const ResourceRequest& request, Type type)
- : Resource(request, type, ResourceLoaderOptions())
- {
- }
-
- bool isSafeToUnlock() const override { return true; }
-};
-
class MockPlatform final : public TestingPlatformSupport {
public:
MockPlatform() { }
@@ -90,28 +74,6 @@ TEST(ResourceTest, SetCachedMetadata_DoesNotSendMetadataToPlatformWhenFetchedVia
EXPECT_EQ(0u, mock.cachedURLs().size());
}
-TEST(ResourceTest, LockFailureNoCrash)
-{
- ResourceResponse response(createTestResourceResponse());
- UnlockableResource* resource = UnlockableResource::create(response.url());
- memoryCache()->add(resource);
- resource->setResponse(response);
-
- // A Resource won't be put in DiscardableMemory unless it is at least 16KiB.
- Vector<char> dataVector(4*4096);
- for (int i = 0; i < 4096; i++)
- dataVector.append("test", 4);
- resource->setResourceBuffer(SharedBuffer::adoptVector(dataVector));
-
- resource->finish(currentTime());
- resource->prune();
- ASSERT_TRUE(resource->isPurgeable());
- bool didLock = resource->lock();
- ASSERT_FALSE(didLock);
- EXPECT_EQ(nullptr, resource->resourceBuffer());
- EXPECT_EQ(size_t(0), resource->encodedSize());
-}
-
TEST(ResourceTest, RevalidateWithFragment)
{
KURL url(ParsedURLString, "http://127.0.0.1:8000/foo.html");
« no previous file with comments | « third_party/WebKit/Source/core/fetch/Resource.cpp ('k') | third_party/WebKit/Source/core/fetch/ScriptResource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698