OLD | NEW |
| (Empty) |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef BLIMP_TEST_SUPPORT_COMPOSITOR_PICTURE_CACHE_TEST_SUPPORT_H_ | |
6 #define BLIMP_TEST_SUPPORT_COMPOSITOR_PICTURE_CACHE_TEST_SUPPORT_H_ | |
7 | |
8 #include "blimp/common/blob_cache/blob_cache.h" | |
9 #include "cc/blimp/picture_data.h" | |
10 #include "testing/gmock/include/gmock/gmock.h" | |
11 #include "third_party/skia/include/core/SkColor.h" | |
12 #include "third_party/skia/include/core/SkPicture.h" | |
13 #include "third_party/skia/include/core/SkRefCnt.h" | |
14 | |
15 namespace blimp { | |
16 | |
17 // Creates an SkPicture filled with with the given |color|. | |
18 sk_sp<const SkPicture> CreateSkPicture(SkColor color); | |
19 | |
20 // Serializes the given picture into an SkData object. | |
21 sk_sp<SkData> SerializePicture(sk_sp<const SkPicture> picture); | |
22 | |
23 // Serializes an SkPicture and returns the BlobId for the serialized form of | |
24 // the picture. | |
25 BlobId GetBlobId(sk_sp<const SkPicture> picture); | |
26 | |
27 // Deserializes the SkPicture represented by |data. | |
28 sk_sp<const SkPicture> DeserializePicture(sk_sp<SkData> data); | |
29 | |
30 // Compares an SkPicture and SkPicture represented by the SkData in the | |
31 // cc::PictureData. | |
32 bool PicturesEqual(sk_sp<const SkPicture> picture, | |
33 const cc::PictureData& picture_data); | |
34 | |
35 // Utility function to create a valid cc::PictureData from an SkPicture. | |
36 cc::PictureData CreatePictureData(sk_sp<const SkPicture> picture); | |
37 | |
38 MATCHER_P(PictureMatches, picture, "") { | |
39 return PicturesEqual(picture, arg); | |
40 } | |
41 | |
42 } // namespace blimp | |
43 | |
44 #endif // BLIMP_TEST_SUPPORT_COMPOSITOR_PICTURE_CACHE_TEST_SUPPORT_H_ | |
OLD | NEW |