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

Side by Side Diff: cc/ipc/struct_traits_unittest.cc

Issue 2047573005: Implement cc::FilterOperations StructTraits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Plumb cc::FilterOperations to mus 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 unified diff | Download patch
« no previous file with comments | « cc/ipc/filter_operations_struct_traits.h ('k') | cc/ipc/traits_test_service.mojom » ('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 4
5 #include "base/message_loop/message_loop.h" 5 #include "base/message_loop/message_loop.h"
6 #include "cc/input/selection.h" 6 #include "cc/input/selection.h"
7 #include "cc/ipc/traits_test_service.mojom.h" 7 #include "cc/ipc/traits_test_service.mojom.h"
8 #include "cc/quads/render_pass_id.h" 8 #include "cc/quads/render_pass_id.h"
9 #include "mojo/public/cpp/bindings/binding_set.h" 9 #include "mojo/public/cpp/bindings/binding_set.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 25 matching lines...) Expand all
36 const EchoCompositorFrameMetadataCallback& callback) override { 36 const EchoCompositorFrameMetadataCallback& callback) override {
37 callback.Run(c); 37 callback.Run(c);
38 } 38 }
39 39
40 void EchoFilterOperation( 40 void EchoFilterOperation(
41 const FilterOperation& f, 41 const FilterOperation& f,
42 const EchoFilterOperationCallback& callback) override { 42 const EchoFilterOperationCallback& callback) override {
43 callback.Run(f); 43 callback.Run(f);
44 } 44 }
45 45
46 void EchoFilterOperations(
47 const FilterOperations& f,
48 const EchoFilterOperationsCallback& callback) override {
49 callback.Run(f);
50 }
51
46 void EchoRenderPassId(const RenderPassId& r, 52 void EchoRenderPassId(const RenderPassId& r,
47 const EchoRenderPassIdCallback& callback) override { 53 const EchoRenderPassIdCallback& callback) override {
48 callback.Run(r); 54 callback.Run(r);
49 } 55 }
50 56
51 void EchoReturnedResource( 57 void EchoReturnedResource(
52 const ReturnedResource& r, 58 const ReturnedResource& r,
53 const EchoReturnedResourceCallback& callback) override { 59 const EchoReturnedResourceCallback& callback) override {
54 callback.Run(r); 60 callback.Run(r);
55 } 61 }
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 EXPECT_EQ(input_str, output_str); 240 EXPECT_EQ(input_str, output_str);
235 break; 241 break;
236 } 242 }
237 case FilterOperation::ALPHA_THRESHOLD: 243 case FilterOperation::ALPHA_THRESHOLD:
238 NOTREACHED(); 244 NOTREACHED();
239 break; 245 break;
240 } 246 }
241 } 247 }
242 } 248 }
243 249
250 TEST_F(StructTraitsTest, FilterOperations) {
251 FilterOperations input;
252 input.Append(FilterOperation::CreateBlurFilter(0.f));
253 input.Append(FilterOperation::CreateSaturateFilter(4.f));
254 input.Append(FilterOperation::CreateZoomFilter(2.0f, 1));
255 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy();
256 FilterOperations output;
257 proxy->EchoFilterOperations(input, &output);
258 EXPECT_EQ(input.size(), output.size());
259 for (size_t i = 0; i < input.size(); ++i) {
260 EXPECT_EQ(input.at(i), output.at(i));
261 }
262 }
263
244 TEST_F(StructTraitsTest, RenderPassId) { 264 TEST_F(StructTraitsTest, RenderPassId) {
245 const int layer_id = 1337; 265 const int layer_id = 1337;
246 const uint32_t index = 0xdeadbeef; 266 const uint32_t index = 0xdeadbeef;
247 RenderPassId input(layer_id, index); 267 RenderPassId input(layer_id, index);
248 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); 268 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy();
249 RenderPassId output; 269 RenderPassId output;
250 proxy->EchoRenderPassId(input, &output); 270 proxy->EchoRenderPassId(input, &output);
251 EXPECT_EQ(layer_id, output.layer_id); 271 EXPECT_EQ(layer_id, output.layer_id);
252 EXPECT_EQ(index, output.index); 272 EXPECT_EQ(index, output.index);
253 } 273 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 EXPECT_EQ(mailbox_holder.sync_token, output.mailbox_holder.sync_token); 411 EXPECT_EQ(mailbox_holder.sync_token, output.mailbox_holder.sync_token);
392 EXPECT_EQ(mailbox_holder.texture_target, 412 EXPECT_EQ(mailbox_holder.texture_target,
393 output.mailbox_holder.texture_target); 413 output.mailbox_holder.texture_target);
394 EXPECT_EQ(read_lock_fences_enabled, output.read_lock_fences_enabled); 414 EXPECT_EQ(read_lock_fences_enabled, output.read_lock_fences_enabled);
395 EXPECT_EQ(is_software, output.is_software); 415 EXPECT_EQ(is_software, output.is_software);
396 EXPECT_EQ(gpu_memory_buffer_id, output.gpu_memory_buffer_id.id); 416 EXPECT_EQ(gpu_memory_buffer_id, output.gpu_memory_buffer_id.id);
397 EXPECT_EQ(is_overlay_candidate, output.is_overlay_candidate); 417 EXPECT_EQ(is_overlay_candidate, output.is_overlay_candidate);
398 } 418 }
399 419
400 } // namespace cc 420 } // namespace cc
OLDNEW
« no previous file with comments | « cc/ipc/filter_operations_struct_traits.h ('k') | cc/ipc/traits_test_service.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698