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

Unified Diff: cc/playback/recording_source_unittest.cc

Issue 1982893002: [blimp] Add SkPicture caching support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge origin/master 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
Index: cc/playback/recording_source_unittest.cc
diff --git a/cc/playback/recording_source_unittest.cc b/cc/playback/recording_source_unittest.cc
index 878242db4d39fe3f8914b606a6ba61906a8add1a..a80dba04b6e3bc966106d3bfd025c4ec4b207bb7 100644
--- a/cc/playback/recording_source_unittest.cc
+++ b/cc/playback/recording_source_unittest.cc
@@ -8,10 +8,13 @@
#include "cc/base/region.h"
#include "cc/playback/raster_source.h"
#include "cc/proto/recording_source.pb.h"
+#include "cc/test/fake_client_picture_cache.h"
#include "cc/test/fake_content_layer_client.h"
+#include "cc/test/fake_engine_picture_cache.h"
#include "cc/test/fake_image_serialization_processor.h"
#include "cc/test/fake_recording_source.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/SkRefCnt.h"
@@ -37,12 +40,28 @@ void ValidateRecordingSourceSerialization(FakeRecordingSource* source) {
std::unique_ptr<FakeImageSerializationProcessor>
fake_image_serialization_processor =
base::WrapUnique(new FakeImageSerializationProcessor);
+ std::unique_ptr<EnginePictureCache> fake_engine_picture_cache_uniq =
+ fake_image_serialization_processor->CreateEnginePictureCache();
+ FakeEnginePictureCache* fake_engine_picture_cache =
+ static_cast<FakeEnginePictureCache*>(
+ fake_engine_picture_cache_uniq.get());
+ std::unique_ptr<ClientPictureCache> fake_client_picture_cache =
+ fake_image_serialization_processor->CreateClientPictureCache();
+
+ fake_engine_picture_cache->MarkAllSkPicturesAsUsed(
+ source->GetDisplayItemList().get());
proto::RecordingSource proto;
- source->ToProtobuf(&proto, fake_image_serialization_processor.get());
+ source->ToProtobuf(&proto);
+ std::vector<uint32_t> actual_picture_ids;
FakeRecordingSource new_source;
- new_source.FromProtobuf(proto, fake_image_serialization_processor.get());
+ new_source.FromProtobuf(proto, fake_client_picture_cache.get(),
+ &actual_picture_ids);
+
+ EXPECT_THAT(actual_picture_ids,
+ testing::UnorderedElementsAreArray(
+ fake_engine_picture_cache->GetAllUsedPictureIds()));
EXPECT_TRUE(source->EqualsTo(new_source));
}

Powered by Google App Engine
This is Rietveld 408576698