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 "Test.h" | 8 #include "Test.h" |
9 #include "TestClassDef.h" | 9 #include "TestClassDef.h" |
10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 } | 38 } |
39 | 39 |
40 static void test_filestreams(skiatest::Reporter* reporter, const char* tmpDir) { | 40 static void test_filestreams(skiatest::Reporter* reporter, const char* tmpDir) { |
41 SkString path = SkOSPath::SkPathJoin(tmpDir, "wstream_test"); | 41 SkString path = SkOSPath::SkPathJoin(tmpDir, "wstream_test"); |
42 | 42 |
43 const char s[] = "abcdefghijklmnopqrstuvwxyz"; | 43 const char s[] = "abcdefghijklmnopqrstuvwxyz"; |
44 | 44 |
45 { | 45 { |
46 SkFILEWStream writer(path.c_str()); | 46 SkFILEWStream writer(path.c_str()); |
47 if (!writer.isValid()) { | 47 if (!writer.isValid()) { |
48 SkString msg; | 48 ERRORF(reporter, "Failed to create tmp file %s\n", path.c_str()); |
49 msg.printf("Failed to create tmp file %s\n", path.c_str()); | |
50 reporter->reportFailed(msg); | |
51 return; | 49 return; |
52 } | 50 } |
53 | 51 |
54 for (int i = 0; i < 100; ++i) { | 52 for (int i = 0; i < 100; ++i) { |
55 writer.write(s, 26); | 53 writer.write(s, 26); |
56 } | 54 } |
57 } | 55 } |
58 | 56 |
59 { | 57 { |
60 SkFILEStream stream(path.c_str()); | 58 SkFILEStream stream(path.c_str()); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 memStream.setData(nullData); | 184 memStream.setData(nullData); |
187 TestDereferencingData(&memStream); | 185 TestDereferencingData(&memStream); |
188 | 186 |
189 } | 187 } |
190 | 188 |
191 DEF_TEST(Stream, reporter) { | 189 DEF_TEST(Stream, reporter) { |
192 TestWStream(reporter); | 190 TestWStream(reporter); |
193 TestPackedUInt(reporter); | 191 TestPackedUInt(reporter); |
194 TestNullData(); | 192 TestNullData(); |
195 } | 193 } |
OLD | NEW |