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

Unified Diff: cc/playback/display_item_list_unittest.cc

Issue 1982893002: [blimp] Add SkPicture caching support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments from vmpstr, including adding //cc/blimp Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/playback/display_item_list.cc ('k') | cc/playback/display_item_proto_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/playback/display_item_list_unittest.cc
diff --git a/cc/playback/display_item_list_unittest.cc b/cc/playback/display_item_list_unittest.cc
index 88ba7e8e284874a0a74de743237429d06d3ba408..1bb6d3da481a11a42862b1302af358bf0ef20e85 100644
--- a/cc/playback/display_item_list_unittest.cc
+++ b/cc/playback/display_item_list_unittest.cc
@@ -20,8 +20,11 @@
#include "cc/playback/float_clip_display_item.h"
#include "cc/playback/transform_display_item.h"
#include "cc/proto/display_item.pb.h"
+#include "cc/test/fake_client_picture_cache.h"
+#include "cc/test/fake_engine_picture_cache.h"
#include "cc/test/fake_image_serialization_processor.h"
#include "cc/test/skia_common.h"
+#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkCanvas.h"
@@ -83,15 +86,29 @@ void ValidateDisplayItemListSerialization(const gfx::Size& layer_size,
std::unique_ptr<FakeImageSerializationProcessor>
fake_image_serialization_processor =
base::WrapUnique(new FakeImageSerializationProcessor);
+ std::unique_ptr<EnginePictureCache> fake_engine_picture_cache =
+ fake_image_serialization_processor->CreateEnginePictureCache();
+ FakeEnginePictureCache* fake_engine_picture_cache_ptr =
+ static_cast<FakeEnginePictureCache*>(fake_engine_picture_cache.get());
+ std::unique_ptr<ClientPictureCache> fake_client_picture_cache =
+ fake_image_serialization_processor->CreateClientPictureCache();
+
+ fake_engine_picture_cache_ptr->MarkAllSkPicturesAsUsed(list.get());
// Serialize and deserialize the DisplayItemList.
proto::DisplayItemList proto;
- list->ToProtobuf(&proto, fake_image_serialization_processor.get());
+ list->ToProtobuf(&proto);
+
+ std::vector<uint32_t> actual_picture_ids;
scoped_refptr<DisplayItemList> new_list = DisplayItemList::CreateFromProto(
- proto, fake_image_serialization_processor.get());
+ proto, fake_client_picture_cache.get(), &actual_picture_ids);
+
+ EXPECT_THAT(actual_picture_ids,
+ testing::UnorderedElementsAreArray(
+ fake_engine_picture_cache_ptr->GetAllUsedPictureIds()));
- EXPECT_TRUE(
- AreDisplayListDrawingResultsSame(gfx::Rect(layer_size), list, new_list));
+ EXPECT_TRUE(AreDisplayListDrawingResultsSame(gfx::Rect(layer_size),
+ list.get(), new_list.get()));
}
} // namespace
« no previous file with comments | « cc/playback/display_item_list.cc ('k') | cc/playback/display_item_proto_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698