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

Side by Side Diff: Source/core/fetch/ImageResourceTest.cpp

Issue 123003002: Make calls to AtomicString(const String&) explicit in loader/ and fetch/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 11 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
« no previous file with comments | « Source/core/fetch/CrossOriginAccessControl.cpp ('k') | Source/core/fetch/ScriptResource.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 TEST(ImageResourceTest, MultipartImage) 52 TEST(ImageResourceTest, MultipartImage)
53 { 53 {
54 ResourcePtr<ImageResource> cachedImage = new ImageResource(ResourceRequest() ); 54 ResourcePtr<ImageResource> cachedImage = new ImageResource(ResourceRequest() );
55 cachedImage->setLoading(true); 55 cachedImage->setLoading(true);
56 56
57 MockImageResourceClient client; 57 MockImageResourceClient client;
58 cachedImage->addClient(&client); 58 cachedImage->addClient(&client);
59 59
60 // Send the multipart response. No image or data buffer is created. 60 // Send the multipart response. No image or data buffer is created.
61 cachedImage->responseReceived(ResourceResponse(KURL(), "multipart/x-mixed-re place", 0, String(), String())); 61 cachedImage->responseReceived(ResourceResponse(KURL(), "multipart/x-mixed-re place", 0, nullAtom, String()));
62 ASSERT_FALSE(cachedImage->resourceBuffer()); 62 ASSERT_FALSE(cachedImage->resourceBuffer());
63 ASSERT_FALSE(cachedImage->hasImage()); 63 ASSERT_FALSE(cachedImage->hasImage());
64 ASSERT_EQ(client.imageChangedCount(), 0); 64 ASSERT_EQ(client.imageChangedCount(), 0);
65 ASSERT_FALSE(client.notifyFinishedCalled()); 65 ASSERT_FALSE(client.notifyFinishedCalled());
66 66
67 // Send the response for the first real part. No image or data buffer is cre ated. 67 // Send the response for the first real part. No image or data buffer is cre ated.
68 const char* svgData = "<svg xmlns='http://www.w3.org/2000/svg' width='1' hei ght='1'><rect width='1' height='1' fill='green'/></svg>"; 68 const char* svgData = "<svg xmlns='http://www.w3.org/2000/svg' width='1' hei ght='1'><rect width='1' height='1' fill='green'/></svg>";
69 unsigned svgDataLength = strlen(svgData); 69 unsigned svgDataLength = strlen(svgData);
70 cachedImage->responseReceived(ResourceResponse(KURL(), "image/svg+xml", svgD ataLength, String(), String())); 70 cachedImage->responseReceived(ResourceResponse(KURL(), "image/svg+xml", svgD ataLength, nullAtom, String()));
71 ASSERT_FALSE(cachedImage->resourceBuffer()); 71 ASSERT_FALSE(cachedImage->resourceBuffer());
72 ASSERT_FALSE(cachedImage->hasImage()); 72 ASSERT_FALSE(cachedImage->hasImage());
73 ASSERT_EQ(client.imageChangedCount(), 0); 73 ASSERT_EQ(client.imageChangedCount(), 0);
74 ASSERT_FALSE(client.notifyFinishedCalled()); 74 ASSERT_FALSE(client.notifyFinishedCalled());
75 75
76 // The first bytes arrive. The data buffer is created, but no image is creat ed. 76 // The first bytes arrive. The data buffer is created, but no image is creat ed.
77 cachedImage->appendData(svgData, svgDataLength); 77 cachedImage->appendData(svgData, svgDataLength);
78 ASSERT_TRUE(cachedImage->resourceBuffer()); 78 ASSERT_TRUE(cachedImage->resourceBuffer());
79 ASSERT_EQ(cachedImage->resourceBuffer()->size(), svgDataLength); 79 ASSERT_EQ(cachedImage->resourceBuffer()->size(), svgDataLength);
80 ASSERT_FALSE(cachedImage->hasImage()); 80 ASSERT_FALSE(cachedImage->hasImage());
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 125
126 // Trigger the cancel timer, ensure the load was cancelled and the resource was evicted from the cache. 126 // Trigger the cancel timer, ensure the load was cancelled and the resource was evicted from the cache.
127 WebCore::testing::runPendingTasks(); 127 WebCore::testing::runPendingTasks();
128 EXPECT_EQ(Resource::LoadError, cachedImage->status()); 128 EXPECT_EQ(Resource::LoadError, cachedImage->status());
129 EXPECT_EQ(reinterpret_cast<Resource*>(0), memoryCache()->resourceForURL(test URL)); 129 EXPECT_EQ(reinterpret_cast<Resource*>(0), memoryCache()->resourceForURL(test URL));
130 130
131 blink::Platform::current()->unitTestSupport()->unregisterMockedURL(testURL); 131 blink::Platform::current()->unitTestSupport()->unregisterMockedURL(testURL);
132 } 132 }
133 133
134 } // namespace 134 } // namespace
OLDNEW
« no previous file with comments | « Source/core/fetch/CrossOriginAccessControl.cpp ('k') | Source/core/fetch/ScriptResource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698