| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 #include "Test.h" | 8 #include "Test.h" |
| 9 #include "SkData.h" | 9 #include "SkData.h" |
| 10 #include "SkDataSet.h" | 10 #include "SkDataSet.h" |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 } | 266 } |
| 267 | 267 |
| 268 SkString path = SkOSPath::SkPathJoin(tmpDir.c_str(), "data_test"); | 268 SkString path = SkOSPath::SkPathJoin(tmpDir.c_str(), "data_test"); |
| 269 | 269 |
| 270 const char s[] = "abcdefghijklmnopqrstuvwxyz"; | 270 const char s[] = "abcdefghijklmnopqrstuvwxyz"; |
| 271 { | 271 { |
| 272 SkFILEWStream writer(path.c_str()); | 272 SkFILEWStream writer(path.c_str()); |
| 273 if (!writer.isValid()) { | 273 if (!writer.isValid()) { |
| 274 SkString msg; | 274 SkString msg; |
| 275 msg.printf("Failed to create tmp file %s\n", path.c_str()); | 275 msg.printf("Failed to create tmp file %s\n", path.c_str()); |
| 276 reporter->reportFailed(msg.c_str()); | 276 reporter->reportFailed(msg); |
| 277 return; | 277 return; |
| 278 } | 278 } |
| 279 writer.write(s, 26); | 279 writer.write(s, 26); |
| 280 } | 280 } |
| 281 | 281 |
| 282 SkFILE* file = sk_fopen(path.c_str(), kRead_SkFILE_Flag); | 282 SkFILE* file = sk_fopen(path.c_str(), kRead_SkFILE_Flag); |
| 283 SkAutoTUnref<SkData> r1(SkData::NewFromFILE(file)); | 283 SkAutoTUnref<SkData> r1(SkData::NewFromFILE(file)); |
| 284 REPORTER_ASSERT(reporter, r1.get() != NULL); | 284 REPORTER_ASSERT(reporter, r1.get() != NULL); |
| 285 REPORTER_ASSERT(reporter, r1->size() == 26); | 285 REPORTER_ASSERT(reporter, r1->size() == 26); |
| 286 REPORTER_ASSERT(reporter, strncmp(static_cast<const char*>(r1->data()), s, 2
6) == 0); | 286 REPORTER_ASSERT(reporter, strncmp(static_cast<const char*>(r1->data()), s, 2
6) == 0); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 tmp->unref(); | 318 tmp->unref(); |
| 319 | 319 |
| 320 test_cstring(reporter); | 320 test_cstring(reporter); |
| 321 test_dataset(reporter); | 321 test_dataset(reporter); |
| 322 test_files(reporter); | 322 test_files(reporter); |
| 323 } | 323 } |
| 324 | 324 |
| 325 #include "TestClassDef.h" | 325 #include "TestClassDef.h" |
| 326 DEFINE_TESTCLASS("Data", DataTestClass, TestData) | 326 DEFINE_TESTCLASS("Data", DataTestClass, TestData) |
| 327 DEFINE_TESTCLASS("DataTable", DataTableTestClass, TestDataTable) | 327 DEFINE_TESTCLASS("DataTable", DataTableTestClass, TestDataTable) |
| OLD | NEW |