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 0cc79443ce04832706b604e4c999995648191ddb..0ab9d672b780aff66a6c1fa9488d6d545aa80287 100644 |
--- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp |
+++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp |
@@ -12153,4 +12153,33 @@ TEST_F(WebFrameTest, FallbackForNonexistentProvisionalNavigation) { |
child->MaybeRenderFallbackContent(WebURLError())); |
} |
+TEST_F(WebFrameTest, AltTextOnAboutBlankPage) { |
+ FrameTestHelpers::WebViewHelper web_view_helper; |
+ web_view_helper.InitializeAndLoad("about:blank", true); |
+ web_view_helper.Resize(WebSize(640, 480)); |
+ WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); |
+ |
+ const char kSource[] = |
+ "<img id='foo' src='foo' alt='foo alt' width='200' height='200'>"; |
+ FrameTestHelpers::LoadHTMLString(frame, kSource, ToKURL("about:blank")); |
+ web_view_helper.WebView()->UpdateAllLifecyclePhases(); |
+ RunPendingTasks(); |
+ |
+ // Check LayoutText with alt text "foo alt" |
+ LayoutObject* layout_object = frame->GetFrame() |
+ ->GetDocument() |
+ ->getElementById("foo") |
+ ->GetLayoutObject() |
+ ->SlowFirstChild(); |
+ String text = ""; |
+ for (LayoutObject* obj = layout_object; obj; obj = obj->NextInPreOrder()) { |
+ if (obj->IsText()) { |
+ LayoutText* layout_text = ToLayoutText(obj); |
+ text = layout_text->GetText(); |
+ break; |
+ } |
+ } |
+ EXPECT_EQ("foo alt", text.Utf8()); |
+} |
+ |
} // namespace blink |