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

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

Issue 2261403004: ImageDocumentParser should stop sending data to ImageResource once decoding fails. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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
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 8905 matching lines...) Expand 10 before | Expand all | Expand 10 after
8916 client.addExpectedRequest(toKURL("http://internal.test/priorities/document-w rite.js"), WebURLRequest::PriorityHigh); 8916 client.addExpectedRequest(toKURL("http://internal.test/priorities/document-w rite.js"), WebURLRequest::PriorityHigh);
8917 client.addExpectedRequest(toKURL("http://internal.test/priorities/injected.j s"), WebURLRequest::PriorityLow); 8917 client.addExpectedRequest(toKURL("http://internal.test/priorities/injected.j s"), WebURLRequest::PriorityLow);
8918 client.addExpectedRequest(toKURL("http://internal.test/priorities/injected-a sync.js"), WebURLRequest::PriorityLow); 8918 client.addExpectedRequest(toKURL("http://internal.test/priorities/injected-a sync.js"), WebURLRequest::PriorityLow);
8919 client.addExpectedRequest(toKURL("http://internal.test/priorities/body.js"), WebURLRequest::PriorityHigh); 8919 client.addExpectedRequest(toKURL("http://internal.test/priorities/body.js"), WebURLRequest::PriorityHigh);
8920 8920
8921 FrameTestHelpers::WebViewHelper helper; 8921 FrameTestHelpers::WebViewHelper helper;
8922 helper.initializeAndLoad(m_baseURL + "script_priority.html", true, &client); 8922 helper.initializeAndLoad(m_baseURL + "script_priority.html", true, &client);
8923 client.verifyAllRequests(); 8923 client.verifyAllRequests();
8924 } 8924 }
8925 8925
8926 class MultipleDataChunkDelegate : public WebURLLoaderTestDelegate {
8927 public:
8928 void didReceiveData(WebURLLoaderClient* originalClient, WebURLLoader* loader , const char* data, int dataLength, int encodedDataLength) override
8929 {
8930 EXPECT_GT(dataLength, 16);
8931 originalClient->didReceiveData(loader, data, 16, 16, 16);
8932 // This didReceiveData call shouldn't crash due to a failed assertion.
8933 originalClient->didReceiveData(loader, data + 16, dataLength - 16, encod edDataLength - 16, dataLength - 16);
8934 }
8935 };
8936
8937 TEST_F(WebFrameTest, ImageDocumentDecodeError)
8938 {
8939 std::string url = m_baseURL + "not_an_image.ico";
8940 URLTestHelpers::registerMockedURLLoad(toKURL(url), "not_an_image.ico", "imag e/x-icon");
8941 MultipleDataChunkDelegate delegate;
8942 Platform::current()->getURLLoaderMockFactory()->setLoaderDelegate(&delegate) ;
8943 FrameTestHelpers::WebViewHelper helper;
8944 helper.initializeAndLoad(url, true);
8945 Platform::current()->getURLLoaderMockFactory()->setLoaderDelegate(nullptr);
8946
8947 Document* document = toLocalFrame(helper.webView()->page()->mainFrame())->do cument();
8948 EXPECT_TRUE(document->isImageDocument());
8949 EXPECT_EQ(Resource::DecodeError, toImageDocument(document)->cachedImage()->g etStatus());
8950 }
8951
8926 } // namespace blink 8952 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/ImageDocument.cpp ('k') | third_party/WebKit/Source/web/tests/data/not_an_image.ico » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698