Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 12135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12146 child->LoadRequest(WebURLRequest(BlankURL())); | 12146 child->LoadRequest(WebURLRequest(BlankURL())); |
| 12147 | 12147 |
| 12148 // Failing the original child frame navigation and trying to render fallback | 12148 // Failing the original child frame navigation and trying to render fallback |
| 12149 // content shouldn't crash. It should return NoLoadInProgress. This is so the | 12149 // content shouldn't crash. It should return NoLoadInProgress. This is so the |
| 12150 // caller won't attempt to replace the correctly empty frame with an error | 12150 // caller won't attempt to replace the correctly empty frame with an error |
| 12151 // page. | 12151 // page. |
| 12152 EXPECT_EQ(WebLocalFrame::NoLoadInProgress, | 12152 EXPECT_EQ(WebLocalFrame::NoLoadInProgress, |
| 12153 child->MaybeRenderFallbackContent(WebURLError())); | 12153 child->MaybeRenderFallbackContent(WebURLError())); |
| 12154 } | 12154 } |
| 12155 | 12155 |
| 12156 TEST_F(WebFrameTest, AltTextOnAboutBlankPage) { | |
| 12157 FrameTestHelpers::WebViewHelper web_view_helper; | |
| 12158 web_view_helper.InitializeAndLoad("about:blank", true); | |
| 12159 web_view_helper.Resize(WebSize(640, 480)); | |
| 12160 WebLocalFrameImpl* frame = web_view_helper.WebView()->MainFrameImpl(); | |
| 12161 | |
| 12162 const char kSource[] = | |
| 12163 "<img src='foo' alt='foo alt' width='200' height='200'>"; | |
|
Nate Chapin
2017/05/17 17:53:50
Add id='i' to this...
| |
| 12164 FrameTestHelpers::LoadHTMLString(frame, kSource, ToKURL("about:blank")); | |
| 12165 web_view_helper.WebView()->UpdateAllLifecyclePhases(); | |
| 12166 RunPendingTasks(); | |
| 12167 | |
| 12168 // Check LayoutText with alt text "foo alt" | |
| 12169 LayoutObject* root = frame->GetFrame()->ContentLayoutObject(); | |
| 12170 String text = ""; | |
| 12171 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
| |
| 12172 if (obj->IsText()) { | |
| 12173 LayoutText* layout_text = ToLayoutText(obj); | |
| 12174 text = layout_text->GetText(); | |
| 12175 break; | |
| 12176 } | |
| 12177 } | |
| 12178 EXPECT_EQ("foo alt", text.Utf8()); | |
| 12179 } | |
| 12180 | |
| 12156 } // namespace blink | 12181 } // namespace blink |
| OLD | NEW |