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

Side by Side Diff: tests/PDFDeflateWStreamTest.cpp

Issue 1278403006: SkPDF: clean up overuse of SK_SUPPORT_PDF (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-11 (Tuesday) 16:25:36 EDT Created 5 years, 4 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 | « tests/FlateTest.cpp ('k') | tests/PDFDocumentTest.cpp » ('j') | 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 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkFlate.h" 8 #include "SkFlate.h"
9 #include "SkRandom.h" 9 #include "SkRandom.h"
10 #include "Test.h" 10 #include "Test.h"
11 11
12 #if SK_SUPPORT_PDF
13
14 DEF_TEST(SkDeflateWStream, r) { 12 DEF_TEST(SkDeflateWStream, r) {
15 SkRandom random(123456); 13 SkRandom random(123456);
16 for (int i = 0; i < 50; ++i) { 14 for (int i = 0; i < 50; ++i) {
17 uint32_t size = random.nextULessThan(10000); 15 uint32_t size = random.nextULessThan(10000);
18 SkAutoTMalloc<uint8_t> buffer(size); 16 SkAutoTMalloc<uint8_t> buffer(size);
19 for (uint32_t j = 0; j < size; ++j) { 17 for (uint32_t j = 0; j < size; ++j) {
20 buffer[j] = random.nextU() & 0xff; 18 buffer[j] = random.nextU() & 0xff;
21 } 19 }
22 20
23 SkDynamicMemoryWStream dynamicMemoryWStream; 21 SkDynamicMemoryWStream dynamicMemoryWStream;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 uint8_t c; 63 uint8_t c;
66 SkDEBUGCODE(size_t rb =)decompressed->read(&c, sizeof(uint8_t)); 64 SkDEBUGCODE(size_t rb =)decompressed->read(&c, sizeof(uint8_t));
67 SkASSERT(sizeof(uint8_t) == rb); 65 SkASSERT(sizeof(uint8_t) == rb);
68 if (buffer[i] != c) { 66 if (buffer[i] != c) {
69 ERRORF(r, "Decompression failed at byte %u.", (unsigned)i); 67 ERRORF(r, "Decompression failed at byte %u.", (unsigned)i);
70 break; 68 break;
71 } 69 }
72 } 70 }
73 } 71 }
74 } 72 }
75 #endif // SK_SUPPORT_PDF
OLDNEW
« no previous file with comments | « tests/FlateTest.cpp ('k') | tests/PDFDocumentTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698