diff options
| author | kushi.p@gmail.com <kushi.p@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-28 18:20:09 +0000 | 
|---|---|---|
| committer | kushi.p@gmail.com <kushi.p@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-28 18:20:09 +0000 | 
| commit | 5e0be64ec9fa6b9255c70d8982c9469cab48e4d8 (patch) | |
| tree | 05196e9f8920cfa7203e8fead723f6eeee446788 /ipc | |
| parent | 961ac948a36146baafc52f957dfd187b19d2cd04 (diff) | |
| download | chromium_src-5e0be64ec9fa6b9255c70d8982c9469cab48e4d8.zip chromium_src-5e0be64ec9fa6b9255c70d8982c9469cab48e4d8.tar.gz chromium_src-5e0be64ec9fa6b9255c70d8982c9469cab48e4d8.tar.bz2  | |
Improving logging in /app, /base, /crypto and /ipc. Updating plain DCHECK() usages for DCHECK_EQ/LE/GE() equivalents.
BUG=58409
TEST=None
Review URL: http://codereview.chromium.org/6880166
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83362 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc')
| -rw-r--r-- | ipc/ipc_channel_win.cc | 2 | ||||
| -rw-r--r-- | ipc/ipc_sync_channel.cc | 2 | ||||
| -rw-r--r-- | ipc/ipc_sync_message_unittest.cc | 92 | 
3 files changed, 67 insertions, 29 deletions
diff --git a/ipc/ipc_channel_win.cc b/ipc/ipc_channel_win.cc index 9182200..be929b1 100644 --- a/ipc/ipc_channel_win.cc +++ b/ipc/ipc_channel_win.cc @@ -177,7 +177,7 @@ const std::wstring Channel::ChannelImpl::PipeName(  bool Channel::ChannelImpl::CreatePipe(const IPC::ChannelHandle &channel_handle,                                        Mode mode) { -  DCHECK(pipe_ == INVALID_HANDLE_VALUE); +  DCHECK_EQ(INVALID_HANDLE_VALUE, pipe_);    const std::wstring pipe_name = PipeName(channel_handle.name);    if (mode & MODE_SERVER_FLAG) {      SECURITY_ATTRIBUTES security_attributes = {0}; diff --git a/ipc/ipc_sync_channel.cc b/ipc/ipc_sync_channel.cc index 5cc4729..97e1c18 100644 --- a/ipc/ipc_sync_channel.cc +++ b/ipc/ipc_sync_channel.cc @@ -361,7 +361,7 @@ void SyncChannel::SyncContext::OnWaitableEventSignaled(WaitableEvent* event) {      CancelPendingSends();    } else {      // We got the reply, timed out or the process shutdown. -    DCHECK(event == GetSendDoneEvent()); +    DCHECK_EQ(GetSendDoneEvent(), event);      MessageLoop::current()->QuitNow();    }  } 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);  }  | 
