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

Unified Diff: cc/ipc/struct_traits_unittest.cc

Issue 2651793007: Implemented StructTraits for cc::TextureMailbox (Closed)
Patch Set: c Created 3 years, 11 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/ipc/BUILD.gn ('k') | cc/ipc/texture_mailbox.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/ipc/struct_traits_unittest.cc
diff --git a/cc/ipc/struct_traits_unittest.cc b/cc/ipc/struct_traits_unittest.cc
index fb9b3c669d02a6769d11e5ff50f2591306e28815..e17bbf549a2da90cfaa3bf360aa796fc61f31a6f 100644
--- a/cc/ipc/struct_traits_unittest.cc
+++ b/cc/ipc/struct_traits_unittest.cc
@@ -101,6 +101,11 @@ class StructTraitsTest : public testing::Test, public mojom::TraitsTestService {
callback.Run(s);
}
+ void EchoTextureMailbox(const TextureMailbox& t,
+ const EchoTextureMailboxCallback& callback) override {
+ callback.Run(t);
+ }
+
void EchoTransferableResource(
const TransferableResource& t,
const EchoTransferableResourceCallback& callback) override {
@@ -813,6 +818,57 @@ TEST_F(StructTraitsTest, SharedQuadState) {
EXPECT_EQ(sorting_context_id, output_sqs.sorting_context_id);
}
+TEST_F(StructTraitsTest, TextureMailbox) {
+ const int8_t mailbox_name[GL_MAILBOX_SIZE_CHROMIUM] = {
+ 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2};
+ const gpu::CommandBufferNamespace command_buffer_namespace = gpu::IN_PROCESS;
+ const int32_t extra_data_field = 0xbeefbeef;
+ const gpu::CommandBufferId command_buffer_id(
+ gpu::CommandBufferId::FromUnsafeValue(0xdeadbeef));
+ const uint64_t release_count = 0xdeadbeefdeadL;
+ const gpu::SyncToken sync_token(command_buffer_namespace, extra_data_field,
+ command_buffer_id, release_count);
+ const uint32_t texture_target = 1337;
+ const gfx::Size size_in_pixels(93, 24);
+ const bool is_overlay_candidate = true;
+ const bool secure_output_only = true;
+ const bool nearest_neighbor = true;
+ const gfx::ColorSpace color_space(4, 5, 9, gfx::ColorSpace::RangeID::LIMITED);
+#if defined(OS_ANDROID)
+ const bool is_backed_by_surface_texture = true;
+ const bool wants_promotion_hint = true;
+#endif
+
+ gpu::Mailbox mailbox;
+ mailbox.SetName(mailbox_name);
+ TextureMailbox input(mailbox, sync_token, texture_target, size_in_pixels,
+ is_overlay_candidate, secure_output_only);
+ input.set_nearest_neighbor(nearest_neighbor);
+ input.set_color_space(color_space);
+#if defined(OS_ANDROID)
+ input.set_is_backed_by_surface_texture(is_backed_by_surface_texture);
+ input.set_wants_promotion_hint(wants_promotion_hint);
+#endif
+
+ mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy();
+ TextureMailbox output;
+ proxy->EchoTextureMailbox(input, &output);
+
+ EXPECT_EQ(mailbox, output.mailbox());
+ EXPECT_EQ(sync_token, output.sync_token());
+ EXPECT_EQ(texture_target, output.target());
+ EXPECT_EQ(size_in_pixels, output.size_in_pixels());
+ EXPECT_EQ(is_overlay_candidate, output.is_overlay_candidate());
+ EXPECT_EQ(secure_output_only, output.secure_output_only());
+ EXPECT_EQ(nearest_neighbor, output.nearest_neighbor());
+ EXPECT_EQ(color_space, output.color_space());
+#if defined(OS_ANDROID)
+ EXPECT_EQ(is_backed_by_surface_texture,
+ output.is_backed_by_surface_texture());
+ EXPECT_EQ(wants_promotion_hint, output.wants_promotion_hint());
+#endif
+}
+
TEST_F(StructTraitsTest, TransferableResource) {
const uint32_t id = 1337;
const ResourceFormat format = ALPHA_8;
« no previous file with comments | « cc/ipc/BUILD.gn ('k') | cc/ipc/texture_mailbox.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698