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 19 matching lines...) Expand all Loading... |
30 } | 30 } |
31 | 31 |
32 // expect EOF | 32 // expect EOF |
33 size_t bytes = stream->read(tmp, 1); | 33 size_t bytes = stream->read(tmp, 1); |
34 REPORTER_ASSERT(reporter, 0 == bytes); | 34 REPORTER_ASSERT(reporter, 0 == bytes); |
35 // isAtEnd might not return true until after the first failing read. | 35 // isAtEnd might not return true until after the first failing read. |
36 REPORTER_ASSERT(reporter, stream->isAtEnd()); | 36 REPORTER_ASSERT(reporter, stream->isAtEnd()); |
37 } | 37 } |
38 | 38 |
39 static void test_filestreams(skiatest::Reporter* reporter, const char* tmpDir) { | 39 static void test_filestreams(skiatest::Reporter* reporter, const char* tmpDir) { |
40 SkString path = SkOSPath::SkPathJoin(tmpDir, "wstream_test"); | 40 SkString path = SkOSPath::Join(tmpDir, "wstream_test"); |
41 | 41 |
42 const char s[] = "abcdefghijklmnopqrstuvwxyz"; | 42 const char s[] = "abcdefghijklmnopqrstuvwxyz"; |
43 | 43 |
44 { | 44 { |
45 SkFILEWStream writer(path.c_str()); | 45 SkFILEWStream writer(path.c_str()); |
46 if (!writer.isValid()) { | 46 if (!writer.isValid()) { |
47 ERRORF(reporter, "Failed to create tmp file %s\n", path.c_str()); | 47 ERRORF(reporter, "Failed to create tmp file %s\n", path.c_str()); |
48 return; | 48 return; |
49 } | 49 } |
50 | 50 |
(...skipping 132 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 |