diff options
Diffstat (limited to 'ipc/ipc_sync_message_unittest.cc')
-rw-r--r-- | ipc/ipc_sync_message_unittest.cc | 92 |
1 files changed, 65 insertions, 27 deletions
diff --git a/ipc/ipc_sync_message_unittest.cc b/ipc/ipc_sync_message_unittest.cc index 9a72aa3..7b513f7 100644 --- a/ipc/ipc_sync_message_unittest.cc +++ b/ipc/ipc_sync_message_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -38,7 +38,7 @@ class TestMessageReceiver { } void On_1_1(int in1, bool* out1) { - DCHECK(in1 == 1); + DCHECK_EQ(1, in1); *out1 = true; } @@ -49,44 +49,53 @@ class TestMessageReceiver { } void On_1_3(int in1, std::string* out1, int* out2, bool* out3) { - DCHECK(in1 == 3); + DCHECK_EQ(3, in1); *out1 = "1_3"; *out2 = 13; *out3 = false; } void On_2_1(int in1, bool in2, bool* out1) { - DCHECK(in1 == 1 && !in2); + DCHECK_EQ(1, in1); + DCHECK(!in2); *out1 = true; } void On_2_2(bool in1, int in2, bool* out1, int* out2) { - DCHECK(!in1 && in2 == 2); + DCHECK(!in1); + DCHECK_EQ(2, in2); *out1 = true; *out2 = 22; } void On_2_3(int in1, bool in2, std::string* out1, int* out2, bool* out3) { - DCHECK(in1 == 3 && in2); + DCHECK_EQ(3, in1); + DCHECK(in2); *out1 = "2_3"; *out2 = 23; *out3 = false; } void On_3_1(int in1, bool in2, std::string in3, bool* out1) { - DCHECK(in1 == 1 && !in2 && in3 == "3_1"); + DCHECK_EQ(1, in1); + DCHECK(!in2); + DCHECK_EQ("3_1", in3); *out1 = true; } void On_3_2(std::string in1, bool in2, int in3, bool* out1, int* out2) { - DCHECK(in1 == "3_2" && !in2 && in3 == 2); + DCHECK_EQ("3_2", in1); + DCHECK(!in2); + DCHECK_EQ(2, in3); *out1 = true; *out2 = 32; } void On_3_3(int in1, std::string in2, bool in3, std::string* out1, int* out2, bool* out3) { - DCHECK(in1 == 3 && in2 == "3_3" && in3); + DCHECK_EQ(3, in1); + DCHECK_EQ("3_3", in2); + DCHECK(in3); *out1 = "3_3"; *out2 = 33; *out3 = false; @@ -94,7 +103,9 @@ class TestMessageReceiver { void On_3_4(bool in1, int in2, std::string in3, int* out1, bool* out2, std::string* out3, bool* out4) { - DCHECK(in1 && in2 == 3 && in3 == "3_4"); + DCHECK(in1); + DCHECK_EQ(3, in2); + DCHECK_EQ("3_4", in3); *out1 = 34; *out2 = true; *out3 = "3_4"; @@ -171,10 +182,13 @@ TEST(IPCSyncMessageTest, Main) { DCHECK(!bool1); Send(new Msg_C_0_2(&bool1, &int1)); - DCHECK(bool1 && int1 == 2); + DCHECK(bool1); + DCHECK_EQ(2, int1); Send(new Msg_C_0_3(&bool1, &int1, &string1)); - DCHECK(!bool1 && int1 == 3 && string1 == "0_3"); + DCHECK(!bool1); + DCHECK_EQ(3, int1); + DCHECK_EQ("0_3", string1); bool1 = false; Send(new Msg_C_1_1(1, &bool1)); @@ -182,11 +196,14 @@ TEST(IPCSyncMessageTest, Main) { bool1 = false; Send(new Msg_C_1_2(false, &bool1, &int1)); - DCHECK(bool1 && int1 == 12); + DCHECK(bool1); + DCHECK_EQ(12, int1); bool1 = true; Send(new Msg_C_1_3(3, &string1, &int1, &bool1)); - DCHECK(string1 == "1_3" && int1 == 13 && !bool1); + DCHECK_EQ("1_3", string1); + DCHECK_EQ(13, int1); + DCHECK(!bool1); bool1 = false; Send(new Msg_C_2_1(1, false, &bool1)); @@ -194,11 +211,14 @@ TEST(IPCSyncMessageTest, Main) { bool1 = false; Send(new Msg_C_2_2(false, 2, &bool1, &int1)); - DCHECK(bool1 && int1 == 22); + DCHECK(bool1); + DCHECK_EQ(22, int1); bool1 = true; Send(new Msg_C_2_3(3, true, &string1, &int1, &bool1)); - DCHECK(string1 == "2_3" && int1 == 23 && !bool1); + DCHECK_EQ("2_3", string1); + DCHECK_EQ(23, int1); + DCHECK(!bool1); bool1 = false; Send(new Msg_C_3_1(1, false, "3_1", &bool1)); @@ -206,26 +226,35 @@ TEST(IPCSyncMessageTest, Main) { bool1 = false; Send(new Msg_C_3_2("3_2", false, 2, &bool1, &int1)); - DCHECK(bool1 && int1 == 32); + DCHECK(bool1); + DCHECK_EQ(32, int1); bool1 = true; Send(new Msg_C_3_3(3, "3_3", true, &string1, &int1, &bool1)); - DCHECK(string1 == "3_3" && int1 == 33 && !bool1); + DCHECK_EQ("3_3", string1); + DCHECK_EQ(33, int1); + DCHECK(!bool1); bool1 = false; bool bool2 = true; Send(new Msg_C_3_4(true, 3, "3_4", &int1, &bool1, &string1, &bool2)); - DCHECK(int1 == 34 && bool1 && string1 == "3_4" && !bool2); + DCHECK_EQ(34, int1); + DCHECK(bool1); + DCHECK_EQ("3_4", string1); + DCHECK(!bool2); // Routed messages, just a copy of the above but with extra routing paramater Send(new Msg_R_0_1(0, &bool1)); DCHECK(!bool1); Send(new Msg_R_0_2(0, &bool1, &int1)); - DCHECK(bool1 && int1 == 2); + DCHECK(bool1); + DCHECK_EQ(2, int1); Send(new Msg_R_0_3(0, &bool1, &int1, &string1)); - DCHECK(!bool1 && int1 == 3 && string1 == "0_3"); + DCHECK(!bool1); + DCHECK_EQ(3, int1); + DCHECK_EQ("0_3", string1); bool1 = false; Send(new Msg_R_1_1(0, 1, &bool1)); @@ -233,11 +262,14 @@ TEST(IPCSyncMessageTest, Main) { bool1 = false; Send(new Msg_R_1_2(0, false, &bool1, &int1)); - DCHECK(bool1 && int1 == 12); + DCHECK(bool1); + DCHECK_EQ(12, int1); bool1 = true; Send(new Msg_R_1_3(0, 3, &string1, &int1, &bool1)); - DCHECK(string1 == "1_3" && int1 == 13 && !bool1); + DCHECK_EQ("1_3", string1); + DCHECK_EQ(13, int1); + DCHECK(!bool1); bool1 = false; Send(new Msg_R_2_1(0, 1, false, &bool1)); @@ -245,11 +277,14 @@ TEST(IPCSyncMessageTest, Main) { bool1 = false; Send(new Msg_R_2_2(0, false, 2, &bool1, &int1)); - DCHECK(bool1 && int1 == 22); + DCHECK(bool1); + DCHECK_EQ(22, int1); bool1 = true; Send(new Msg_R_2_3(0, 3, true, &string1, &int1, &bool1)); - DCHECK(string1 == "2_3" && int1 == 23 && !bool1); + DCHECK(!bool1); + DCHECK_EQ("2_3", string1); + DCHECK_EQ(23, int1); bool1 = false; Send(new Msg_R_3_1(0, 1, false, "3_1", &bool1)); @@ -257,9 +292,12 @@ TEST(IPCSyncMessageTest, Main) { bool1 = false; Send(new Msg_R_3_2(0, "3_2", false, 2, &bool1, &int1)); - DCHECK(bool1 && int1 == 32); + DCHECK(bool1); + DCHECK_EQ(32, int1); bool1 = true; Send(new Msg_R_3_3(0, 3, "3_3", true, &string1, &int1, &bool1)); - DCHECK(string1 == "3_3" && int1 == 33 && !bool1); + DCHECK_EQ("3_3", string1); + DCHECK_EQ(33, int1); + DCHECK(!bool1); } |