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 "SkData.h" | 8 #include "SkData.h" |
9 #include "SkOSFile.h" | 9 #include "SkOSFile.h" |
10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // Test that this works after a copyToData. | 123 // Test that this works after a copyToData. |
124 SkAutoTUnref<SkStreamAsset> stream(ds.detachAsStream()); | 124 SkAutoTUnref<SkStreamAsset> stream(ds.detachAsStream()); |
125 REPORTER_ASSERT(reporter, ds.getOffset() == 0); | 125 REPORTER_ASSERT(reporter, ds.getOffset() == 0); |
126 test_loop_stream(reporter, stream.get(), s, 26, 100); | 126 test_loop_stream(reporter, stream.get(), s, 26, 100); |
127 | 127 |
128 SkAutoTUnref<SkStreamAsset> stream2(stream->duplicate()); | 128 SkAutoTUnref<SkStreamAsset> stream2(stream->duplicate()); |
129 test_loop_stream(reporter, stream2.get(), s, 26, 100); | 129 test_loop_stream(reporter, stream2.get(), s, 26, 100); |
130 } | 130 } |
131 delete[] dst; | 131 delete[] dst; |
132 | 132 |
133 SkString tmpDir = skiatest::Test::GetTmpDir(); | 133 SkString tmpDir = skiatest::GetTmpDir(); |
134 if (!tmpDir.isEmpty()) { | 134 if (!tmpDir.isEmpty()) { |
135 test_filestreams(reporter, tmpDir.c_str()); | 135 test_filestreams(reporter, tmpDir.c_str()); |
136 } | 136 } |
137 } | 137 } |
138 | 138 |
139 static void TestPackedUInt(skiatest::Reporter* reporter) { | 139 static void TestPackedUInt(skiatest::Reporter* reporter) { |
140 // we know that packeduint tries to write 1, 2 or 4 bytes for the length, | 140 // we know that packeduint tries to write 1, 2 or 4 bytes for the length, |
141 // so we test values around each of those transitions (and a few others) | 141 // so we test values around each of those transitions (and a few others) |
142 const size_t sizes[] = { | 142 const size_t sizes[] = { |
143 0, 1, 2, 0xFC, 0xFD, 0xFE, 0xFF, 0x100, 0x101, 32767, 32768, 32769, | 143 0, 1, 2, 0xFC, 0xFD, 0xFE, 0xFF, 0x100, 0x101, 32767, 32768, 32769, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 memStream.setData(nullData); | 183 memStream.setData(nullData); |
184 TestDereferencingData(&memStream); | 184 TestDereferencingData(&memStream); |
185 | 185 |
186 } | 186 } |
187 | 187 |
188 DEF_TEST(Stream, reporter) { | 188 DEF_TEST(Stream, reporter) { |
189 TestWStream(reporter); | 189 TestWStream(reporter); |
190 TestPackedUInt(reporter); | 190 TestPackedUInt(reporter); |
191 TestNullData(); | 191 TestNullData(); |
192 } | 192 } |
OLD | NEW |