diff options
author | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-29 07:10:46 +0000 |
---|---|---|
committer | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-29 07:10:46 +0000 |
commit | e9002a949c6ab690c4e178d45f1ecb876c535aa4 (patch) | |
tree | 3e9872db48aa6be97987ef2fa7d100aae24e85c3 /net/socket/socks5_client_socket_unittest.cc | |
parent | 86c72c63d6d70e040bc6a10f09a1b8a190f6d3c6 (diff) | |
download | chromium_src-e9002a949c6ab690c4e178d45f1ecb876c535aa4.zip chromium_src-e9002a949c6ab690c4e178d45f1ecb876c535aa4.tar.gz chromium_src-e9002a949c6ab690c4e178d45f1ecb876c535aa4.tar.bz2 |
Cleanup the unittest helpers in load_log_unittest.h.
Consolidates all the callers to using the testing::AssertionResult() flavor, and renames them to have "Event" in the name. This rename is in anticipation of adding testers for other entry types.
BUG=NONE
TEST=existing
Review URL: http://codereview.chromium.org/551135
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37501 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/socks5_client_socket_unittest.cc')
-rw-r--r-- | net/socket/socks5_client_socket_unittest.cc | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/net/socket/socks5_client_socket_unittest.cc b/net/socket/socks5_client_socket_unittest.cc index ac7ff5a..b4eb2cf 100644 --- a/net/socket/socks5_client_socket_unittest.cc +++ b/net/socket/socks5_client_socket_unittest.cc @@ -125,15 +125,13 @@ TEST_F(SOCKS5ClientSocketTest, CompleteHandshake) { int rv = user_sock_->Connect(&callback_, log); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_FALSE(user_sock_->IsConnected()); - EXPECT_TRUE( - LogContains(*log, 0, LoadLog::TYPE_SOCKS5_CONNECT, LoadLog::PHASE_BEGIN)); + EXPECT_TRUE(LogContainsBeginEvent(*log, 0, LoadLog::TYPE_SOCKS5_CONNECT)); rv = callback_.WaitForResult(); EXPECT_EQ(OK, rv); EXPECT_TRUE(user_sock_->IsConnected()); - EXPECT_TRUE(LogContains( - *log, -1, LoadLog::TYPE_SOCKS5_CONNECT, LoadLog::PHASE_END)); + EXPECT_TRUE(LogContainsEndEvent(*log, -1, LoadLog::TYPE_SOCKS5_CONNECT)); scoped_refptr<IOBuffer> buffer = new IOBuffer(payload_write.size()); memcpy(buffer->data(), payload_write.data(), payload_write.size()); @@ -238,13 +236,11 @@ TEST_F(SOCKS5ClientSocketTest, PartialReadWrites) { scoped_refptr<LoadLog> log(new LoadLog(LoadLog::kUnbounded)); int rv = user_sock_->Connect(&callback_, log); EXPECT_EQ(ERR_IO_PENDING, rv); - EXPECT_TRUE(LogContains( - *log, 0, LoadLog::TYPE_SOCKS5_CONNECT, LoadLog::PHASE_BEGIN)); + EXPECT_TRUE(LogContainsBeginEvent(*log, 0, LoadLog::TYPE_SOCKS5_CONNECT)); rv = callback_.WaitForResult(); EXPECT_EQ(OK, rv); EXPECT_TRUE(user_sock_->IsConnected()); - EXPECT_TRUE(LogContains( - *log, -1, LoadLog::TYPE_SOCKS5_CONNECT, LoadLog::PHASE_END)); + EXPECT_TRUE(LogContainsEndEvent(*log, -1, LoadLog::TYPE_SOCKS5_CONNECT)); } // Test for partial greet response read @@ -262,13 +258,11 @@ TEST_F(SOCKS5ClientSocketTest, PartialReadWrites) { scoped_refptr<LoadLog> log(new LoadLog(LoadLog::kUnbounded)); int rv = user_sock_->Connect(&callback_, log); EXPECT_EQ(ERR_IO_PENDING, rv); - EXPECT_TRUE(LogContains( - *log, 0, LoadLog::TYPE_SOCKS5_CONNECT, LoadLog::PHASE_BEGIN)); + EXPECT_TRUE(LogContainsBeginEvent(*log, 0, LoadLog::TYPE_SOCKS5_CONNECT)); rv = callback_.WaitForResult(); EXPECT_EQ(OK, rv); EXPECT_TRUE(user_sock_->IsConnected()); - EXPECT_TRUE(LogContains( - *log, -1, LoadLog::TYPE_SOCKS5_CONNECT, LoadLog::PHASE_END)); + EXPECT_TRUE(LogContainsEndEvent(*log, -1, LoadLog::TYPE_SOCKS5_CONNECT)); } // Test for partial handshake request write. @@ -287,13 +281,11 @@ TEST_F(SOCKS5ClientSocketTest, PartialReadWrites) { scoped_refptr<LoadLog> log(new LoadLog(LoadLog::kUnbounded)); int rv = user_sock_->Connect(&callback_, log); EXPECT_EQ(ERR_IO_PENDING, rv); - EXPECT_TRUE(LogContains( - *log, 0, LoadLog::TYPE_SOCKS5_CONNECT, LoadLog::PHASE_BEGIN)); + EXPECT_TRUE(LogContainsBeginEvent(*log, 0, LoadLog::TYPE_SOCKS5_CONNECT)); rv = callback_.WaitForResult(); EXPECT_EQ(OK, rv); EXPECT_TRUE(user_sock_->IsConnected()); - EXPECT_TRUE(LogContains( - *log, -1, LoadLog::TYPE_SOCKS5_CONNECT, LoadLog::PHASE_END)); + EXPECT_TRUE(LogContainsEndEvent(*log, -1, LoadLog::TYPE_SOCKS5_CONNECT)); } // Test for partial handshake response read @@ -306,20 +298,19 @@ TEST_F(SOCKS5ClientSocketTest, PartialReadWrites) { MockRead data_reads[] = { MockRead(true, kSOCKS5GreetResponse, arraysize(kSOCKS5GreetResponse)), MockRead(true, kSOCKS5OkResponse, kSplitPoint), - MockRead(true, kSOCKS5OkResponse + kSplitPoint, arraysize(kSOCKS5OkResponse) - kSplitPoint) + MockRead(true, kSOCKS5OkResponse + kSplitPoint, + arraysize(kSOCKS5OkResponse) - kSplitPoint) }; user_sock_.reset(BuildMockSocket(data_reads, data_writes, hostname, 80)); scoped_refptr<LoadLog> log(new LoadLog(LoadLog::kUnbounded)); int rv = user_sock_->Connect(&callback_, log); EXPECT_EQ(ERR_IO_PENDING, rv); - EXPECT_TRUE(LogContains( - *log, 0, LoadLog::TYPE_SOCKS5_CONNECT, LoadLog::PHASE_BEGIN)); + EXPECT_TRUE(LogContainsBeginEvent(*log, 0, LoadLog::TYPE_SOCKS5_CONNECT)); rv = callback_.WaitForResult(); EXPECT_EQ(OK, rv); EXPECT_TRUE(user_sock_->IsConnected()); - EXPECT_TRUE(LogContains( - *log, -1, LoadLog::TYPE_SOCKS5_CONNECT, LoadLog::PHASE_END)); + EXPECT_TRUE(LogContainsEndEvent(*log, -1, LoadLog::TYPE_SOCKS5_CONNECT)); } } |