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

Unified Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 1380163006: setLoadFinishTime on ImageResource for ImageDocument. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 | « third_party/WebKit/Source/core/html/ImageDocument.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/tests/WebFrameTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
index de33e961a03548295218c2f21abfe695490b1a45..91bbd7ff313ee9aff5da807d2345e68fa07c58f1 100644
--- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
@@ -61,6 +61,7 @@
#include "core/html/HTMLDocument.h"
#include "core/html/HTMLFormElement.h"
#include "core/html/HTMLMediaElement.h"
+#include "core/html/ImageDocument.h"
#include "core/input/EventHandler.h"
#include "core/layout/HitTestResult.h"
#include "core/layout/LayoutFullScreen.h"
@@ -207,6 +208,11 @@ protected:
URLTestHelpers::registerMockedURLLoadWithCustomResponse(toKURL(fullString.c_str()), WebString::fromUTF8(fileName.c_str()), WebString::fromUTF8(""), response);
}
+ void registerMockedHttpURLLoadWithMimeType(const std::string& fileName, const std::string& mimeType)
+ {
+ URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8(fileName.c_str()), WebString::fromUTF8(mimeType));
+ }
+
void applyViewportStyleOverride(FrameTestHelpers::WebViewHelper* webViewHelper)
{
RefPtrWillBeRawPtr<StyleSheetContents> styleSheet = StyleSheetContents::create(CSSParserContext(UASheetMode, 0));
@@ -8222,4 +8228,32 @@ TEST_F(WebFrameTest, MaxFramesDetach)
webViewImpl->mainFrameImpl()->collectGarbage();
}
+TEST_F(WebFrameTest, ImageDocumentLoadFinishTime)
+{
+ // Loading an image resource directly generates an ImageDocument with
+ // the document loader feeding image data into the resource of a generated
+ // img tag. We expect the load finish time to be the same for the document
+ // and the image resource.
+
+ registerMockedHttpURLLoadWithMimeType("white-1x1.png", "image/png");
+ FrameTestHelpers::WebViewHelper webViewHelper;
+ webViewHelper.initializeAndLoad(m_baseURL + "white-1x1.png");
+ WebView* webView = webViewHelper.webView();
+ Document* document = toWebLocalFrameImpl(webView->mainFrame())->frame()->document();
+
+ EXPECT_TRUE(document);
+ EXPECT_TRUE(document->isImageDocument());
+
+ ImageDocument* imgDocument = toImageDocument(document);
+ ImageResource* resource = imgDocument->cachedImage();
+
+ EXPECT_TRUE(resource);
+ EXPECT_NE(0, resource->loadFinishTime());
+
+ DocumentLoader* loader = document->loader();
+
+ EXPECT_TRUE(loader);
+ EXPECT_EQ(loader->timing().responseEnd(), resource->loadFinishTime());
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/html/ImageDocument.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698