OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 #include "cc/playback/image_hijack_canvas.h" | 4 #include "cc/playback/image_hijack_canvas.h" |
5 | 5 |
6 #include "cc/tiles/image_decode_cache.h" | 6 #include "cc/tiles/image_decode_cache.h" |
7 #include "testing/gmock/include/gmock/gmock.h" | 7 #include "testing/gmock/include/gmock/gmock.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "third_party/skia/include/core/SkBitmap.h" | 9 #include "third_party/skia/include/core/SkBitmap.h" |
10 #include "third_party/skia/include/core/SkImage.h" | 10 #include "third_party/skia/include/core/SkImage.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 scoped_refptr<TileTask>* task)); | 21 scoped_refptr<TileTask>* task)); |
22 MOCK_METHOD1(UnrefImage, void(const DrawImage& image)); | 22 MOCK_METHOD1(UnrefImage, void(const DrawImage& image)); |
23 MOCK_METHOD1(GetDecodedImageForDraw, | 23 MOCK_METHOD1(GetDecodedImageForDraw, |
24 DecodedDrawImage(const DrawImage& image)); | 24 DecodedDrawImage(const DrawImage& image)); |
25 MOCK_METHOD2(DrawWithImageFinished, | 25 MOCK_METHOD2(DrawWithImageFinished, |
26 void(const DrawImage& image, | 26 void(const DrawImage& image, |
27 const DecodedDrawImage& decoded_image)); | 27 const DecodedDrawImage& decoded_image)); |
28 MOCK_METHOD0(ReduceCacheUsage, void()); | 28 MOCK_METHOD0(ReduceCacheUsage, void()); |
29 MOCK_METHOD1(SetShouldAggressivelyFreeResources, | 29 MOCK_METHOD1(SetShouldAggressivelyFreeResources, |
30 void(bool aggressively_free_resources)); | 30 void(bool aggressively_free_resources)); |
| 31 MOCK_METHOD2(GetOutOfRasterDecodeTaskForImageAndRef, |
| 32 bool(const DrawImage& image, scoped_refptr<TileTask>* task)); |
31 }; | 33 }; |
32 | 34 |
33 TEST(ImageHijackCanvasTest, NonLazyImagesSkipped) { | 35 TEST(ImageHijackCanvasTest, NonLazyImagesSkipped) { |
34 // Use a strict mock so that if *any* ImageDecodeCache methods are called, we | 36 // Use a strict mock so that if *any* ImageDecodeCache methods are called, we |
35 // will hit an error. | 37 // will hit an error. |
36 testing::StrictMock<MockImageDecodeCache> image_decode_cache; | 38 testing::StrictMock<MockImageDecodeCache> image_decode_cache; |
37 ImageHijackCanvas canvas(100, 100, &image_decode_cache); | 39 ImageHijackCanvas canvas(100, 100, &image_decode_cache); |
38 | 40 |
39 // Use an SkBitmap backed image to ensure that the image is not | 41 // Use an SkBitmap backed image to ensure that the image is not |
40 // lazy-generated. | 42 // lazy-generated. |
(...skipping 15 matching lines...) Expand all Loading... |
56 path.addRect(paint_rect, SkPath::kCW_Direction); | 58 path.addRect(paint_rect, SkPath::kCW_Direction); |
57 canvas.drawPath(path, image_paint); | 59 canvas.drawPath(path, image_paint); |
58 canvas.drawOval(paint_rect, image_paint); | 60 canvas.drawOval(paint_rect, image_paint); |
59 canvas.drawArc(paint_rect, 0, 40, true, image_paint); | 61 canvas.drawArc(paint_rect, 0, 40, true, image_paint); |
60 canvas.drawRRect(SkRRect::MakeRect(paint_rect), image_paint); | 62 canvas.drawRRect(SkRRect::MakeRect(paint_rect), image_paint); |
61 } | 63 } |
62 | 64 |
63 } // namespace | 65 } // namespace |
64 | 66 |
65 } // namespace cc | 67 } // namespace cc |
OLD | NEW |