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

Side by Side Diff: tests/StreamTest.cpp

Issue 1054073003: Minimal Changes to run tests on iOS (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 5 years, 8 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 | « src/core/SkImageFilter.cpp ('k') | tools/ProcStats.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 2011 Google Inc. 2 * Copyright 2011 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 "Resources.h" 8 #include "Resources.h"
9 #include "SkData.h" 9 #include "SkData.h"
10 #include "SkFrontBufferedStream.h" 10 #include "SkFrontBufferedStream.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 static void test_peeking_front_buffered_stream(skiatest::Reporter* r, 239 static void test_peeking_front_buffered_stream(skiatest::Reporter* r,
240 const SkStream& original, 240 const SkStream& original,
241 size_t bufferSize) { 241 size_t bufferSize) {
242 SkStream* dupe = original.duplicate(); 242 SkStream* dupe = original.duplicate();
243 REPORTER_ASSERT(r, dupe != NULL); 243 REPORTER_ASSERT(r, dupe != NULL);
244 SkAutoTDelete<SkStream> bufferedStream(SkFrontBufferedStream::Create(dupe, b ufferSize)); 244 SkAutoTDelete<SkStream> bufferedStream(SkFrontBufferedStream::Create(dupe, b ufferSize));
245 REPORTER_ASSERT(r, bufferedStream != NULL); 245 REPORTER_ASSERT(r, bufferedStream != NULL);
246 test_peeking_stream(r, bufferedStream, bufferSize); 246 test_peeking_stream(r, bufferedStream, bufferSize);
247 } 247 }
248 248
249 // This test uses file system operations that don't work out of the
250 // box on iOS. It's likely that we don't need them on iOS. Ignoring for now.
251 // TODO(stephana): Re-evaluate if we need this in the future.
252 #ifndef SK_BUILD_FOR_IOS
249 DEF_TEST(StreamPeek, reporter) { 253 DEF_TEST(StreamPeek, reporter) {
250 // Test a memory stream. 254 // Test a memory stream.
251 const char gAbcs[] = "abcdefghijklmnopqrstuvwxyz"; 255 const char gAbcs[] = "abcdefghijklmnopqrstuvwxyz";
252 SkMemoryStream memStream(gAbcs, strlen(gAbcs), false); 256 SkMemoryStream memStream(gAbcs, strlen(gAbcs), false);
253 test_peeking_stream(reporter, &memStream, memStream.getLength()); 257 test_peeking_stream(reporter, &memStream, memStream.getLength());
254 258
255 // Test an arbitrary file stream. file streams do not support peeking. 259 // Test an arbitrary file stream. file streams do not support peeking.
256 SkFILEStream fileStream(GetResourcePath("baby_tux.webp").c_str()); 260 SkFILEStream fileStream(GetResourcePath("baby_tux.webp").c_str());
257 REPORTER_ASSERT(reporter, fileStream.isValid()); 261 REPORTER_ASSERT(reporter, fileStream.isValid());
258 SkAutoMalloc storage(fileStream.getLength()); 262 SkAutoMalloc storage(fileStream.getLength());
259 for (size_t i = 1; i < fileStream.getLength(); i++) { 263 for (size_t i = 1; i < fileStream.getLength(); i++) {
260 REPORTER_ASSERT(reporter, !fileStream.peek(storage.get(), i)); 264 REPORTER_ASSERT(reporter, !fileStream.peek(storage.get(), i));
261 } 265 }
262 266
263 // Now test some FrontBufferedStreams 267 // Now test some FrontBufferedStreams
264 for (size_t i = 1; i < memStream.getLength(); i++) { 268 for (size_t i = 1; i < memStream.getLength(); i++) {
265 test_peeking_front_buffered_stream(reporter, memStream, i); 269 test_peeking_front_buffered_stream(reporter, memStream, i);
266 } 270 }
267 } 271 }
272 #endif
OLDNEW
« no previous file with comments | « src/core/SkImageFilter.cpp ('k') | tools/ProcStats.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698