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

Side by Side Diff: tests/BadIcoTest.cpp

Issue 712123002: Add tests (and fix!) for known bad ICO files. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month 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 | « src/images/SkImageDecoder_libico.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
(Empty)
1 /*
2 * Copyright 2014 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "Resources.h"
9 #include "Test.h"
10 #include "SkBitmap.h"
11 #include "SkImageDecoder.h"
12 #include "SkOSFile.h"
13
14 DEF_TEST(BadIco, reporter) {
15 const char* const badIcos [] = {
16 "sigabort_favicon.ico",
17 "sigsegv_favicon.ico",
18 "sigsegv_favicon_2.ico",
19 };
20
21 const char* badIcoFolder = "invalid_images";
22
23 SkString resourcePath = GetResourcePath(badIcoFolder);
24
25 SkBitmap bm;
26 for (size_t i = 0; i < SK_ARRAY_COUNT(badIcos); ++i) {
27 SkString fullPath = SkOSPath::Join(resourcePath.c_str(), badIcos[i]);
28 bool success = SkImageDecoder::DecodeFile(fullPath.c_str(), &bm);
29 // These files are invalid, and should not decode. More importantly,
30 // though, we reached here without crashing.
31 REPORTER_ASSERT(reporter, !success);
32 }
33 }
OLDNEW
« no previous file with comments | « src/images/SkImageDecoder_libico.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698