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 id='foo' src='foo' alt='foo alt' width='200' height='200'>"; |
| 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* layout_object = frame->GetFrame() |
| 12170 ->GetDocument() |
| 12171 ->getElementById("foo") |
| 12172 ->GetLayoutObject() |
| 12173 ->SlowFirstChild(); |
| 12174 String text = ""; |
| 12175 for (LayoutObject* obj = layout_object; obj; obj = obj->NextInPreOrder()) { |
| 12176 if (obj->IsText()) { |
| 12177 LayoutText* layout_text = ToLayoutText(obj); |
| 12178 text = layout_text->GetText(); |
| 12179 break; |
| 12180 } |
| 12181 } |
| 12182 EXPECT_EQ("foo alt", text.Utf8()); |
| 12183 } |
| 12184 |
12156 } // namespace blink | 12185 } // namespace blink |
OLD | NEW |