Index: blimp/test/support/compositor/picture_cache_test_support.h |
diff --git a/blimp/test/support/compositor/picture_cache_test_support.h b/blimp/test/support/compositor/picture_cache_test_support.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c8e4200a265044bc038992c71890d2e24a0c103e |
--- /dev/null |
+++ b/blimp/test/support/compositor/picture_cache_test_support.h |
@@ -0,0 +1,44 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef BLIMP_TEST_SUPPORT_COMPOSITOR_PICTURE_CACHE_TEST_SUPPORT_H_ |
+#define BLIMP_TEST_SUPPORT_COMPOSITOR_PICTURE_CACHE_TEST_SUPPORT_H_ |
+ |
+#include "blimp/common/blob_cache/blob_cache.h" |
+#include "cc/proto/picture_cache.h" |
+#include "testing/gmock/include/gmock/gmock.h" |
+#include "third_party/skia/include/core/SkColor.h" |
Kevin M
2016/06/21 21:35:04
switch these to forward declares where possible?
nyquist
2016/06/24 11:11:15
Sadly, I need this for all of them :-/ SkColor is
|
+#include "third_party/skia/include/core/SkPicture.h" |
+#include "third_party/skia/include/core/SkRefCnt.h" |
+ |
+namespace blimp { |
+ |
+// Creates an SkPicture filled with with the given |color|. |
+sk_sp<const SkPicture> CreateSkPicture(SkColor color); |
+ |
+// Serializes the given picture into an SkData object. |
+sk_sp<SkData> SerializePicture(sk_sp<const SkPicture> picture); |
+ |
+// Serializes an SkPicture and returns the BlobId for the serialized form of |
+// the picture. |
+BlobId GetBlobId(sk_sp<const SkPicture> picture); |
+ |
+// Deserializes the SkPicture represented by |data. |
+sk_sp<const SkPicture> DeserializePicture(sk_sp<SkData> data); |
+ |
+// Compares an SkPicture and SkPicture represented by the SkData in the |
+// cc::PictureData. |
+bool SamePicture(sk_sp<const SkPicture> picture, |
Kevin M
2016/06/21 21:35:04
nittiest of nits: PicturesEqual() ?
nyquist
2016/06/24 11:11:15
Done.
|
+ const cc::PictureData& picture_data); |
+ |
+// Utility function to create a valid cc::PictureData from an SkPicture. |
+cc::PictureData CreatePictureData(sk_sp<const SkPicture> picture); |
+ |
+MATCHER_P(PictureMatches, picture, "") { |
+ return SamePicture(picture, arg); |
+} |
+ |
+} // namespace blimp |
+ |
+#endif // BLIMP_TEST_SUPPORT_COMPOSITOR_PICTURE_CACHE_TEST_SUPPORT_H_ |