OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2015 Google Inc. All rights reserved. | 2 * Copyright (C) 2015 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 TEST(SegmentReaderTest, getAsSkData) | 175 TEST(SegmentReaderTest, getAsSkData) |
176 { | 176 { |
177 const unsigned dataSize = 4 * SharedBuffer::kSegmentSize; | 177 const unsigned dataSize = 4 * SharedBuffer::kSegmentSize; |
178 char referenceData[dataSize]; | 178 char referenceData[dataSize]; |
179 prepareReferenceData(referenceData, dataSize); | 179 prepareReferenceData(referenceData, dataSize); |
180 RefPtr<SharedBuffer> data = SharedBuffer::create(); | 180 RefPtr<SharedBuffer> data = SharedBuffer::create(); |
181 data->append(referenceData, dataSize); | 181 data->append(referenceData, dataSize); |
182 | 182 |
183 SegmentReaders readerStruct(data); | 183 SegmentReaders readerStruct(data); |
184 for (auto segmentReader : readerStruct.segmentReaders) { | 184 for (auto segmentReader : readerStruct.segmentReaders) { |
185 RefPtr<SkData> skdata = segmentReader->getAsSkData(); | 185 sk_sp<SkData> skdata = segmentReader->getAsSkData(); |
186 EXPECT_EQ(data->size(), skdata->size()); | 186 EXPECT_EQ(data->size(), skdata->size()); |
187 | 187 |
188 const char* segment; | 188 const char* segment; |
189 size_t position = 0; | 189 size_t position = 0; |
190 for (size_t length = segmentReader->getSomeData(segment, position); | 190 for (size_t length = segmentReader->getSomeData(segment, position); |
191 length; length = segmentReader->getSomeData(segment, position)) { | 191 length; length = segmentReader->getSomeData(segment, position)) { |
192 ASSERT_FALSE(memcmp(segment, skdata->bytes() + position, length)); | 192 ASSERT_FALSE(memcmp(segment, skdata->bytes() + position, length)); |
193 position += length; | 193 position += length; |
194 } | 194 } |
195 EXPECT_EQ(position, dataSize); | 195 EXPECT_EQ(position, dataSize); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 ASSERT_NE(length, lastLength); | 230 ASSERT_NE(length, lastLength); |
231 lastLength = length; | 231 lastLength = length; |
232 | 232 |
233 ASSERT_FALSE(memcmp(segment, referenceData + position, length)); | 233 ASSERT_FALSE(memcmp(segment, referenceData + position, length)); |
234 position += length; | 234 position += length; |
235 } | 235 } |
236 EXPECT_EQ(position, dataSize); | 236 EXPECT_EQ(position, dataSize); |
237 } | 237 } |
238 | 238 |
239 } // namespace blink | 239 } // namespace blink |
OLD | NEW |