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 11985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11996 child->LoadRequest(WebURLRequest(BlankURL())); | 11996 child->LoadRequest(WebURLRequest(BlankURL())); |
| 11997 | 11997 |
| 11998 // Failing the original child frame navigation and trying to render fallback | 11998 // Failing the original child frame navigation and trying to render fallback |
| 11999 // content shouldn't crash. It should return NoLoadInProgress. This is so the | 11999 // content shouldn't crash. It should return NoLoadInProgress. This is so the |
| 12000 // caller won't attempt to replace the correctly empty frame with an error | 12000 // caller won't attempt to replace the correctly empty frame with an error |
| 12001 // page. | 12001 // page. |
| 12002 EXPECT_EQ(WebLocalFrame::NoLoadInProgress, | 12002 EXPECT_EQ(WebLocalFrame::NoLoadInProgress, |
| 12003 child->MaybeRenderFallbackContent(WebURLError())); | 12003 child->MaybeRenderFallbackContent(WebURLError())); |
| 12004 } | 12004 } |
| 12005 | 12005 |
| 12006 TEST_F(WebFrameTest, AltTextOnAboutBlankPage) { | |
| 12007 FrameTestHelpers::WebViewHelper web_view_helper; | |
| 12008 web_view_helper.Initialize(); | |
| 12009 // We set the size because it impacts line wrapping, which changes the | |
| 12010 // resulting text value. | |
| 12011 web_view_helper.Resize(WebSize(640, 480)); | |
| 12012 WebViewImpl* web_view = web_view_helper.WebView(); | |
| 12013 InitializeWithHTML(*web_view->MainFrameImpl()->GetFrame(), | |
| 12014 "<!DOCTYPE html>" | |
| 12015 "<img src='foo' alt='foo' width='200' height='200'>"); | |
| 12016 | |
| 12017 web_view->UpdateAllLifecyclePhases(); | |
| 12018 RunPendingTasks(); | |
| 12019 | |
| 12020 // Make sure it fails to load image and shows alt text. | |
| 12021 std::string text = WebFrameContentDumper::DumpLayoutTreeAsText( | |
|
Nate Chapin
2017/05/02 22:58:03
String text = ToWebLocalFrameImpl(web_view->MainFr
| |
| 12022 web_view->MainFrame()->ToWebLocalFrame(), | |
| 12023 WebFrameContentDumper::kLayoutAsTextPrinting) | |
| 12024 .Utf8(); | |
| 12025 EXPECT_NE(std::string::npos, text.find("foo")); | |
| 12026 } | |
| 12027 | |
| 12006 } // namespace blink | 12028 } // namespace blink |
| OLD | NEW |