 Chromium Code Reviews
 Chromium Code Reviews Issue 2839633003:
  Consider empty url case when loading image  (Closed)
    
  
    Issue 2839633003:
  Consider empty url case when loading image  (Closed) 
  | 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 2e19c34b6343c37505f54a993549a44954507241..71eaec310107c0000e53c81f789b9e7239f4c87a 100644 | 
| --- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp | 
| +++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp | 
| @@ -12049,4 +12049,28 @@ TEST_F(WebFrameTest, FallbackForNonexistentProvisionalNavigation) { | 
| child->MaybeRenderFallbackContent(WebURLError())); | 
| } | 
| +TEST_F(WebFrameTest, AltTextOnAboutBlankPage) { | 
| + FrameTestHelpers::WebViewHelper web_view_helper; | 
| + web_view_helper.InitializeAndLoad("about:blank", true); | 
| + // We set the size because it impacts line wrapping, which changes the | 
| + // resulting text value. | 
| + web_view_helper.Resize(WebSize(640, 480)); | 
| + | 
| + // Generate a simple test case. | 
| + const char kSource[] = | 
| + "<img src='foo' alt='foo alt' width='200' height='200'>"; | 
| + FrameTestHelpers::LoadHTMLString(web_view_helper.WebView()->MainFrameImpl(), | 
| + kSource, ToKURL("about:blank")); | 
| + | 
| + web_view_helper.WebView()->UpdateAllLifecyclePhases(); | 
| + RunPendingTasks(); | 
| + | 
| + // Make sure it comes out OK. | 
| + std::string text = WebFrameContentDumper::DumpLayoutTreeAsText( | 
| 
dmazzoni
2017/05/16 21:08:06
I think this is not a good fit for a unit test tha
 
dmazzoni
2017/05/16 21:10:43
Maybe I'm wrong - if accessing a LayoutObject is
f
 | 
| + web_view_helper.WebView()->MainFrameImpl(), | 
| + WebFrameContentDumper::kLayoutAsTextPrinting) | 
| + .Utf8(); | 
| + EXPECT_NE(std::string::npos, text.find("foo alt")); | 
| +} | 
| + | 
| } // namespace blink |