Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: tests/DataRefTest.cpp

Issue 1467533003: Eliminate SkFILE - it always is the same as FILE. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-11-20 (Friday) 14:01:26 EST Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/utils/SkWhitelistTypefaces.cpp ('k') | tests/PathOpsSkpClipTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "SkDataTable.h" 9 #include "SkDataTable.h"
10 #include "SkOSFile.h" 10 #include "SkOSFile.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 const char s[] = "abcdefghijklmnopqrstuvwxyz"; 184 const char s[] = "abcdefghijklmnopqrstuvwxyz";
185 { 185 {
186 SkFILEWStream writer(path.c_str()); 186 SkFILEWStream writer(path.c_str());
187 if (!writer.isValid()) { 187 if (!writer.isValid()) {
188 ERRORF(reporter, "Failed to create tmp file %s\n", path.c_str()); 188 ERRORF(reporter, "Failed to create tmp file %s\n", path.c_str());
189 return; 189 return;
190 } 190 }
191 writer.write(s, 26); 191 writer.write(s, 26);
192 } 192 }
193 193
194 SkFILE* file = sk_fopen(path.c_str(), kRead_SkFILE_Flag); 194 FILE* file = sk_fopen(path.c_str(), kRead_SkFILE_Flag);
195 SkAutoTUnref<SkData> r1(SkData::NewFromFILE(file)); 195 SkAutoTUnref<SkData> r1(SkData::NewFromFILE(file));
196 REPORTER_ASSERT(reporter, r1.get() != nullptr); 196 REPORTER_ASSERT(reporter, r1.get() != nullptr);
197 REPORTER_ASSERT(reporter, r1->size() == 26); 197 REPORTER_ASSERT(reporter, r1->size() == 26);
198 REPORTER_ASSERT(reporter, strncmp(static_cast<const char*>(r1->data()), s, 2 6) == 0); 198 REPORTER_ASSERT(reporter, strncmp(static_cast<const char*>(r1->data()), s, 2 6) == 0);
199 199
200 int fd = sk_fileno(file); 200 int fd = sk_fileno(file);
201 SkAutoTUnref<SkData> r2(SkData::NewFromFD(fd)); 201 SkAutoTUnref<SkData> r2(SkData::NewFromFD(fd));
202 REPORTER_ASSERT(reporter, r2.get() != nullptr); 202 REPORTER_ASSERT(reporter, r2.get() != nullptr);
203 REPORTER_ASSERT(reporter, r2->size() == 26); 203 REPORTER_ASSERT(reporter, r2->size() == 26);
204 REPORTER_ASSERT(reporter, strncmp(static_cast<const char*>(r2->data()), s, 2 6) == 0); 204 REPORTER_ASSERT(reporter, strncmp(static_cast<const char*>(r2->data()), s, 2 6) == 0);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 } 306 }
307 307
308 for (int i = 0; i < N; ++i) { 308 for (int i = 0; i < N; ++i) {
309 REPORTER_ASSERT(reporter, (i + 1) * 26U == readers[i]->size()); 309 REPORTER_ASSERT(reporter, (i + 1) * 26U == readers[i]->size());
310 check_alphabet_buffer(reporter, readers[i]); 310 check_alphabet_buffer(reporter, readers[i]);
311 check_alphabet_stream(reporter, streams[i]); 311 check_alphabet_stream(reporter, streams[i]);
312 readers[i]->unref(); 312 readers[i]->unref();
313 delete streams[i]; 313 delete streams[i];
314 } 314 }
315 } 315 }
OLDNEW
« no previous file with comments | « src/utils/SkWhitelistTypefaces.cpp ('k') | tests/PathOpsSkpClipTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698