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

Unified Diff: Source/core/fetch/MemoryCacheTest.cpp

Issue 346263003: Don't use the empty string as an url in MemoryCacheTest. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@kurlcrash_20140603
Patch Set: Created 6 years, 6 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
« no previous file with comments | « Source/core/fetch/MemoryCache.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/fetch/MemoryCacheTest.cpp
diff --git a/Source/core/fetch/MemoryCacheTest.cpp b/Source/core/fetch/MemoryCacheTest.cpp
index 387ec73871dc71228f1699b5c8c9b443b2d46fac..82eda60f2d11e674fff3cdac4db061547fe645ca 100644
--- a/Source/core/fetch/MemoryCacheTest.cpp
+++ b/Source/core/fetch/MemoryCacheTest.cpp
@@ -123,7 +123,7 @@ TEST_F(MemoryCacheTest, VeryLargeResourceAccounting)
const size_t resourceSize2 = sizeMax / 20;
memoryCache()->setCapacities(minDeadCapacity, maxDeadCapacity, totalCapacity);
ResourcePtr<FakeResource> cachedResource =
- new FakeResource(ResourceRequest(""), Resource::Raw);
+ new FakeResource(ResourceRequest("http://test/resource"), Resource::Raw);
cachedResource->fakeEncodedSize(resourceSize1);
ASSERT_EQ(0u, memoryCache()->deadSize());
@@ -154,7 +154,7 @@ TEST_F(MemoryCacheTest, DeadResourceEviction)
memoryCache()->setCapacities(minDeadCapacity, maxDeadCapacity, totalCapacity);
Resource* cachedResource =
- new Resource(ResourceRequest(""), Resource::Raw);
+ new Resource(ResourceRequest("http://test/resource"), Resource::Raw);
const char data[5] = "abcd";
cachedResource->appendData(data, 3);
// The resource size has to be nonzero for this test to be meaningful, but
@@ -187,7 +187,7 @@ TEST_F(MemoryCacheTest, LiveResourceEvictionAtEndOfTask)
new Resource(ResourceRequest("hhtp://foo"), Resource::Raw);
cachedDeadResource->appendData(data, 3);
ResourcePtr<Resource> cachedLiveResource =
- new FakeDecodedResource(ResourceRequest(""), Resource::Raw);
+ new FakeDecodedResource(ResourceRequest("http://test/resource"), Resource::Raw);
MockImageResourceClient client;
cachedLiveResource->addClient(&client);
cachedLiveResource->appendData(data, 4);
@@ -262,7 +262,7 @@ TEST_F(MemoryCacheTest, ClientRemoval)
resource1->addClient(&client1);
resource1->appendData(data, 4);
ResourcePtr<Resource> resource2 =
- new FakeDecodedResource(ResourceRequest(""), Resource::Raw);
+ new FakeDecodedResource(ResourceRequest("http://test/resource"), Resource::Raw);
MockImageResourceClient client2;
resource2->addClient(&client2);
resource2->appendData(data, 4);
@@ -311,7 +311,7 @@ TEST_F(MemoryCacheTest, DecodeCacheOrder)
ResourcePtr<FakeDecodedResource> cachedImageLowPriority =
new FakeDecodedResource(ResourceRequest("http://foo.com"), Resource::Raw);
ResourcePtr<FakeDecodedResource> cachedImageHighPriority =
- new FakeDecodedResource(ResourceRequest(""), Resource::Raw);
+ new FakeDecodedResource(ResourceRequest("http://test/resource"), Resource::Raw);
MockImageResourceClient clientLowPriority;
MockImageResourceClient clientHighPriority;
@@ -370,15 +370,15 @@ TEST_F(MemoryCacheTest, DecodeCacheOrder)
TEST_F(MemoryCacheTest, MultipleReplace)
{
- ResourcePtr<FakeResource> resource1 = new FakeResource(ResourceRequest(""), Resource::Raw);
+ ResourcePtr<FakeResource> resource1 = new FakeResource(ResourceRequest("http://test/resource"), Resource::Raw);
memoryCache()->add(resource1.get());
- ResourcePtr<FakeResource> resource2 = new FakeResource(ResourceRequest(""), Resource::Raw);
+ ResourcePtr<FakeResource> resource2 = new FakeResource(ResourceRequest("http://test/resource"), Resource::Raw);
memoryCache()->replace(resource2.get(), resource1.get());
EXPECT_TRUE(memoryCache()->contains(resource2.get()));
EXPECT_FALSE(memoryCache()->contains(resource1.get()));
- ResourcePtr<FakeResource> resource3 = new FakeResource(ResourceRequest(""), Resource::Raw);
+ ResourcePtr<FakeResource> resource3 = new FakeResource(ResourceRequest("http://test/resource"), Resource::Raw);
memoryCache()->replace(resource3.get(), resource2.get());
EXPECT_TRUE(memoryCache()->contains(resource3.get()));
EXPECT_FALSE(memoryCache()->contains(resource2.get()));
@@ -386,16 +386,16 @@ TEST_F(MemoryCacheTest, MultipleReplace)
TEST_F(MemoryCacheTest, RemoveDuringRevalidation)
{
- ResourcePtr<FakeResource> resource1 = new FakeResource(ResourceRequest(""), Resource::Raw);
+ ResourcePtr<FakeResource> resource1 = new FakeResource(ResourceRequest("http://test/resource"), Resource::Raw);
memoryCache()->add(resource1.get());
- ResourcePtr<FakeResource> resource2 = new FakeResource(ResourceRequest(""), Resource::Raw);
+ ResourcePtr<FakeResource> resource2 = new FakeResource(ResourceRequest("http://test/resource"), Resource::Raw);
memoryCache()->remove(resource1.get());
memoryCache()->add(resource2.get());
EXPECT_TRUE(memoryCache()->contains(resource2.get()));
EXPECT_FALSE(memoryCache()->contains(resource1.get()));
- ResourcePtr<FakeResource> resource3 = new FakeResource(ResourceRequest(""), Resource::Raw);
+ ResourcePtr<FakeResource> resource3 = new FakeResource(ResourceRequest("http://test/resource"), Resource::Raw);
memoryCache()->remove(resource2.get());
memoryCache()->add(resource3.get());
EXPECT_TRUE(memoryCache()->contains(resource3.get()));
« no previous file with comments | « Source/core/fetch/MemoryCache.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698