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

Side by Side Diff: cc/raster/image_hijack_canvas_unittest.cc

Issue 2945813002: cc: Interface to evict images from cc image decode cache. (Closed)
Patch Set: rebase Created 3 years, 6 months 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 | « no previous file | cc/tiles/gpu_image_decode_cache.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/raster/image_hijack_canvas.h" 4 #include "cc/raster/image_hijack_canvas.h"
5 5
6 #include "cc/test/skia_common.h" 6 #include "cc/test/skia_common.h"
7 #include "cc/tiles/image_decode_cache.h" 7 #include "cc/tiles/image_decode_cache.h"
8 #include "testing/gmock/include/gmock/gmock.h" 8 #include "testing/gmock/include/gmock/gmock.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "third_party/skia/include/core/SkBitmap.h" 10 #include "third_party/skia/include/core/SkBitmap.h"
(...skipping 15 matching lines...) Expand all
26 MOCK_METHOD2(DrawWithImageFinished, 26 MOCK_METHOD2(DrawWithImageFinished,
27 void(const DrawImage& image, 27 void(const DrawImage& image,
28 const DecodedDrawImage& decoded_image)); 28 const DecodedDrawImage& decoded_image));
29 MOCK_METHOD0(ReduceCacheUsage, void()); 29 MOCK_METHOD0(ReduceCacheUsage, void());
30 MOCK_METHOD1(SetShouldAggressivelyFreeResources, 30 MOCK_METHOD1(SetShouldAggressivelyFreeResources,
31 void(bool aggressively_free_resources)); 31 void(bool aggressively_free_resources));
32 MOCK_METHOD0(ClearCache, void()); 32 MOCK_METHOD0(ClearCache, void());
33 MOCK_METHOD2(GetOutOfRasterDecodeTaskForImageAndRef, 33 MOCK_METHOD2(GetOutOfRasterDecodeTaskForImageAndRef,
34 bool(const DrawImage& image, scoped_refptr<TileTask>* task)); 34 bool(const DrawImage& image, scoped_refptr<TileTask>* task));
35 MOCK_CONST_METHOD0(GetMaximumMemoryLimitBytes, size_t()); 35 MOCK_CONST_METHOD0(GetMaximumMemoryLimitBytes, size_t());
36 MOCK_METHOD1(NotifyImageUnused, void(uint32_t skimage_id));
36 }; 37 };
37 38
38 TEST(ImageHijackCanvasTest, NonLazyImagesSkipped) { 39 TEST(ImageHijackCanvasTest, NonLazyImagesSkipped) {
39 // Use a strict mock so that if *any* ImageDecodeCache methods are called, we 40 // Use a strict mock so that if *any* ImageDecodeCache methods are called, we
40 // will hit an error. 41 // will hit an error.
41 testing::StrictMock<MockImageDecodeCache> image_decode_cache; 42 testing::StrictMock<MockImageDecodeCache> image_decode_cache;
42 SkImageIdFlatSet images_to_skip; 43 SkImageIdFlatSet images_to_skip;
43 gfx::ColorSpace target_color_space = gfx::ColorSpace::CreateSRGB(); 44 gfx::ColorSpace target_color_space = gfx::ColorSpace::CreateSRGB();
44 ImageHijackCanvas canvas(100, 100, &image_decode_cache, &images_to_skip, 45 ImageHijackCanvas canvas(100, 100, &image_decode_cache, &images_to_skip,
45 target_color_space); 46 target_color_space);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 path.addRect(draw_rect, SkPath::kCW_Direction); 108 path.addRect(draw_rect, SkPath::kCW_Direction);
108 canvas.drawPath(path, paint); 109 canvas.drawPath(path, paint);
109 canvas.drawOval(draw_rect, paint); 110 canvas.drawOval(draw_rect, paint);
110 canvas.drawArc(draw_rect, 0, 40, true, paint); 111 canvas.drawArc(draw_rect, 0, 40, true, paint);
111 canvas.drawRRect(SkRRect::MakeRect(draw_rect), paint); 112 canvas.drawRRect(SkRRect::MakeRect(draw_rect), paint);
112 } 113 }
113 114
114 } // namespace 115 } // namespace
115 116
116 } // namespace cc 117 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/tiles/gpu_image_decode_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698