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

Unified Diff: cc/ipc/struct_traits_unittest.cc

Issue 2030173002: Simplify StructTraits tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added comments Created 4 years, 7 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 | « no previous file | cc/ipc/traits_test_service.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 a4df8871471fe0aaee1322d4496e16270f5cbec0..d84ff733ef528903f63e9a6771502f05f4275b30 100644
--- a/cc/ipc/struct_traits_unittest.cc
+++ b/cc/ipc/struct_traits_unittest.cc
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "base/message_loop/message_loop.h"
-#include "base/run_loop.h"
#include "cc/ipc/traits_test_service.mojom.h"
#include "cc/quads/render_pass_id.h"
#include "mojo/public/cpp/bindings/binding_set.h"
@@ -52,6 +51,7 @@ class StructTraitsTest : public testing::Test, public mojom::TraitsTestService {
}
mojo::BindingSet<TraitsTestService> traits_test_bindings_;
+ DISALLOW_COPY_AND_ASSIGN(StructTraitsTest);
};
} // namespace
@@ -68,34 +68,25 @@ TEST_F(StructTraitsTest, BeginFrameArgs) {
input.interval = interval;
input.type = type;
input.on_critical_path = on_critical_path;
- base::RunLoop loop;
mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy();
- proxy->EchoBeginFrameArgs(
- input, [frame_time, deadline, interval, type, on_critical_path,
- &loop](const BeginFrameArgs& pass) {
- EXPECT_EQ(frame_time, pass.frame_time);
- EXPECT_EQ(deadline, pass.deadline);
- EXPECT_EQ(interval, pass.interval);
- EXPECT_EQ(type, pass.type);
- EXPECT_EQ(on_critical_path, pass.on_critical_path);
- loop.Quit();
- });
- loop.Run();
+ BeginFrameArgs output;
+ proxy->EchoBeginFrameArgs(input, &output);
+ EXPECT_EQ(frame_time, output.frame_time);
+ EXPECT_EQ(deadline, output.deadline);
+ EXPECT_EQ(interval, output.interval);
+ EXPECT_EQ(type, output.type);
+ EXPECT_EQ(on_critical_path, output.on_critical_path);
}
TEST_F(StructTraitsTest, RenderPassId) {
const int layer_id = 1337;
const uint32_t index = 0xdeadbeef;
RenderPassId input(layer_id, index);
- base::RunLoop loop;
mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy();
- proxy->EchoRenderPassId(input,
- [layer_id, index, &loop](const RenderPassId& pass) {
- EXPECT_EQ(layer_id, pass.layer_id);
- EXPECT_EQ(index, pass.index);
- loop.Quit();
- });
- loop.Run();
+ RenderPassId output;
+ proxy->EchoRenderPassId(input, &output);
+ EXPECT_EQ(layer_id, output.layer_id);
+ EXPECT_EQ(index, output.index);
}
TEST_F(StructTraitsTest, ReturnedResource) {
@@ -115,17 +106,13 @@ TEST_F(StructTraitsTest, ReturnedResource) {
input.sync_token = sync_token;
input.count = count;
input.lost = lost;
- base::RunLoop loop;
mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy();
- proxy->EchoReturnedResource(input, [id, sync_token, count, lost,
- &loop](const ReturnedResource& pass) {
- EXPECT_EQ(id, pass.id);
- EXPECT_EQ(sync_token, pass.sync_token);
- EXPECT_EQ(count, pass.count);
- EXPECT_EQ(lost, pass.lost);
- loop.Quit();
- });
- loop.Run();
+ ReturnedResource output;
+ proxy->EchoReturnedResource(input, &output);
+ EXPECT_EQ(id, output.id);
+ EXPECT_EQ(sync_token, output.sync_token);
+ EXPECT_EQ(count, output.count);
+ EXPECT_EQ(lost, output.lost);
}
TEST_F(StructTraitsTest, SurfaceId) {
@@ -133,16 +120,12 @@ TEST_F(StructTraitsTest, SurfaceId) {
const uint32_t local_id = 0xfbadbeef;
const uint64_t nonce = 0xdeadbeef;
SurfaceId input(id_namespace, local_id, nonce);
- base::RunLoop loop;
mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy();
- proxy->EchoSurfaceId(
- input, [id_namespace, local_id, nonce, &loop](const SurfaceId& pass) {
- EXPECT_EQ(id_namespace, pass.id_namespace());
- EXPECT_EQ(local_id, pass.local_id());
- EXPECT_EQ(nonce, pass.nonce());
- loop.Quit();
- });
- loop.Run();
+ SurfaceId output;
+ proxy->EchoSurfaceId(input, &output);
+ EXPECT_EQ(id_namespace, output.id_namespace());
+ EXPECT_EQ(local_id, output.local_id());
+ EXPECT_EQ(nonce, output.nonce());
}
TEST_F(StructTraitsTest, TransferableResource) {
@@ -181,27 +164,21 @@ TEST_F(StructTraitsTest, TransferableResource) {
input.is_software = is_software;
input.gpu_memory_buffer_id.id = gpu_memory_buffer_id;
input.is_overlay_candidate = is_overlay_candidate;
- base::RunLoop loop;
mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy();
- proxy->EchoTransferableResource(
- input, [id, format, filter, size, mailbox_holder,
- read_lock_fences_enabled, is_software, gpu_memory_buffer_id,
- is_overlay_candidate, &loop](const TransferableResource& pass) {
- EXPECT_EQ(id, pass.id);
- EXPECT_EQ(format, pass.format);
- EXPECT_EQ(filter, pass.filter);
- EXPECT_EQ(size, pass.size);
- EXPECT_EQ(mailbox_holder.mailbox, pass.mailbox_holder.mailbox);
- EXPECT_EQ(mailbox_holder.sync_token, pass.mailbox_holder.sync_token);
- EXPECT_EQ(mailbox_holder.texture_target,
- pass.mailbox_holder.texture_target);
- EXPECT_EQ(read_lock_fences_enabled, pass.read_lock_fences_enabled);
- EXPECT_EQ(is_software, pass.is_software);
- EXPECT_EQ(gpu_memory_buffer_id, pass.gpu_memory_buffer_id.id);
- EXPECT_EQ(is_overlay_candidate, pass.is_overlay_candidate);
- loop.Quit();
- });
- loop.Run();
+ TransferableResource output;
+ proxy->EchoTransferableResource(input, &output);
+ EXPECT_EQ(id, output.id);
+ EXPECT_EQ(format, output.format);
+ EXPECT_EQ(filter, output.filter);
+ EXPECT_EQ(size, output.size);
+ EXPECT_EQ(mailbox_holder.mailbox, output.mailbox_holder.mailbox);
+ EXPECT_EQ(mailbox_holder.sync_token, output.mailbox_holder.sync_token);
+ EXPECT_EQ(mailbox_holder.texture_target,
+ output.mailbox_holder.texture_target);
+ EXPECT_EQ(read_lock_fences_enabled, output.read_lock_fences_enabled);
+ EXPECT_EQ(is_software, output.is_software);
+ EXPECT_EQ(gpu_memory_buffer_id, output.gpu_memory_buffer_id.id);
+ EXPECT_EQ(is_overlay_candidate, output.is_overlay_candidate);
}
} // namespace cc
« no previous file with comments | « no previous file | cc/ipc/traits_test_service.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698