Chromium Code Reviews| 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..35b4b542f726932598fa54726878053a3049939a 100644 |
| --- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp |
| +++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp |
| @@ -12153,4 +12153,29 @@ 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 src='foo' alt='foo alt' width='200' height='200'>"; |
|
Nate Chapin
2017/05/17 17:53:50
Add id='i' to this...
|
| + FrameTestHelpers::LoadHTMLString(frame, kSource, ToKURL("about:blank")); |
| + web_view_helper.WebView()->UpdateAllLifecyclePhases(); |
| + RunPendingTasks(); |
| + |
| + // Check LayoutText with alt text "foo alt" |
| + LayoutObject* root = frame->GetFrame()->ContentLayoutObject(); |
| + String text = ""; |
| + for (LayoutObject* obj = root; obj; obj = obj->NextInPreOrder()) { |
|
Nate Chapin
2017/05/17 17:53:50
If I understood dmazzoni's comment correctly, if y
|
| + if (obj->IsText()) { |
| + LayoutText* layout_text = ToLayoutText(obj); |
| + text = layout_text->GetText(); |
| + break; |
| + } |
| + } |
| + EXPECT_EQ("foo alt", text.Utf8()); |
| +} |
| + |
| } // namespace blink |