OLD | NEW |
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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 static const int N = 10000; | 384 static const int N = 10000; |
385 SkAutoTMalloc<uint8_t> src((size_t)N); | 385 SkAutoTMalloc<uint8_t> src((size_t)N); |
386 for (int j = 0; j < N; ++j) { | 386 for (int j = 0; j < N; ++j) { |
387 src[j] = random.nextU() & 0xff; | 387 src[j] = random.nextU() & 0xff; |
388 } | 388 } |
389 // SkStreamCopy had two code paths; this test both. | 389 // SkStreamCopy had two code paths; this test both. |
390 DumbStream dumbStream(src.get(), (size_t)N); | 390 DumbStream dumbStream(src.get(), (size_t)N); |
391 stream_copy_test(reporter, src, N, &dumbStream); | 391 stream_copy_test(reporter, src, N, &dumbStream); |
392 SkMemoryStream smartStream(src.get(), (size_t)N); | 392 SkMemoryStream smartStream(src.get(), (size_t)N); |
393 stream_copy_test(reporter, src, N, &smartStream); | 393 stream_copy_test(reporter, src, N, &smartStream); |
| 394 } |
394 | 395 |
| 396 DEF_TEST(StreamEmptyStreamMemoryBase, r) { |
| 397 SkDynamicMemoryWStream tmp; |
| 398 SkAutoTDelete<SkStreamAsset> asset(tmp.detachAsStream()); |
| 399 REPORTER_ASSERT(r, nullptr == asset->getMemoryBase()); |
395 } | 400 } |
| 401 |
OLD | NEW |