Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 2839633003: Consider empty url case when loading image (Closed)
Patch Set: rebased Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/loader/ImageLoader.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 12031 matching lines...) Expand 10 before | Expand all | Expand 10 after
12042 child->LoadRequest(WebURLRequest(BlankURL())); 12042 child->LoadRequest(WebURLRequest(BlankURL()));
12043 12043
12044 // Failing the original child frame navigation and trying to render fallback 12044 // Failing the original child frame navigation and trying to render fallback
12045 // content shouldn't crash. It should return NoLoadInProgress. This is so the 12045 // content shouldn't crash. It should return NoLoadInProgress. This is so the
12046 // caller won't attempt to replace the correctly empty frame with an error 12046 // caller won't attempt to replace the correctly empty frame with an error
12047 // page. 12047 // page.
12048 EXPECT_EQ(WebLocalFrame::NoLoadInProgress, 12048 EXPECT_EQ(WebLocalFrame::NoLoadInProgress,
12049 child->MaybeRenderFallbackContent(WebURLError())); 12049 child->MaybeRenderFallbackContent(WebURLError()));
12050 } 12050 }
12051 12051
12052 TEST_F(WebFrameTest, AltTextOnAboutBlankPage) {
12053 FrameTestHelpers::WebViewHelper web_view_helper;
12054 web_view_helper.InitializeAndLoad("about:blank", true);
12055 // We set the size because it impacts line wrapping, which changes the
12056 // resulting text value.
12057 web_view_helper.Resize(WebSize(640, 480));
12058
12059 // Generate a simple test case.
12060 const char kSource[] =
12061 "<img src='foo' alt='foo alt' width='200' height='200'>";
12062 FrameTestHelpers::LoadHTMLString(web_view_helper.WebView()->MainFrameImpl(),
12063 kSource, ToKURL("about:blank"));
12064
12065 web_view_helper.WebView()->UpdateAllLifecyclePhases();
12066 RunPendingTasks();
12067
12068 // Make sure it comes out OK.
12069 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
12070 web_view_helper.WebView()->MainFrameImpl(),
12071 WebFrameContentDumper::kLayoutAsTextPrinting)
12072 .Utf8();
12073 EXPECT_NE(std::string::npos, text.find("foo alt"));
12074 }
12075
12052 } // namespace blink 12076 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/ImageLoader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698