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

Unified Diff: net/quic/quic_chromium_client_session_test.cc

Issue 2109503009: Refactor net tests to use GMock matchers for checking net::Error results (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert changes to contents.txt files 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/p2p/quic_p2p_session_test.cc ('k') | net/quic/quic_chromium_client_stream_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_chromium_client_session_test.cc
diff --git a/net/quic/quic_chromium_client_session_test.cc b/net/quic/quic_chromium_client_session_test.cc
index 9a189b2c35f0bf47a92245310e1789ea2ac44f09..b7bc0dd9a32354f5eff44d3170e0dd4312c97b80 100644
--- a/net/quic/quic_chromium_client_session_test.cc
+++ b/net/quic/quic_chromium_client_session_test.cc
@@ -37,8 +37,10 @@
#include "net/socket/socket_test_util.h"
#include "net/spdy/spdy_test_utils.h"
#include "net/test/cert_test_util.h"
+#include "net/test/gtest_util.h"
#include "net/test/test_data_directory.h"
#include "net/udp/datagram_client_socket.h"
+#include "testing/gmock/include/gmock/gmock.h"
using testing::_;
@@ -115,7 +117,7 @@ class QuicChromiumClientSessionTest
}
void CompleteCryptoHandshake() {
- ASSERT_EQ(OK, session_->CryptoConnect(false, callback_.callback()));
+ ASSERT_THAT(session_->CryptoConnect(false, callback_.callback()), IsOk());
}
QuicPacketWriter* CreateQuicPacketWriter(DatagramClientSocket* socket,
@@ -225,7 +227,7 @@ TEST_P(QuicChromiumClientSessionTest, MaxNumStreamsViaRequest) {
QuicRstStreamFrame rst1(stream_id, QUIC_STREAM_NO_ERROR, 0);
session_->OnRstStream(rst1);
ASSERT_TRUE(callback.have_result());
- EXPECT_EQ(OK, callback.WaitForResult());
+ EXPECT_THAT(callback.WaitForResult(), IsOk());
EXPECT_TRUE(stream != nullptr);
}
@@ -364,7 +366,7 @@ TEST_P(QuicChromiumClientSessionTest, MigrateToSocket) {
socket_factory_.CreateDatagramClientSocket(DatagramSocket::DEFAULT_BIND,
base::Bind(&base::RandInt),
&net_log_, NetLog::Source());
- EXPECT_EQ(OK, new_socket->Connect(kIpEndPoint));
+ EXPECT_THAT(new_socket->Connect(kIpEndPoint), IsOk());
// Create reader and writer.
std::unique_ptr<QuicChromiumPacketReader> new_reader(
@@ -412,7 +414,7 @@ TEST_P(QuicChromiumClientSessionTest, MigrateToSocketMaxReaders) {
socket_factory_.CreateDatagramClientSocket(DatagramSocket::DEFAULT_BIND,
base::Bind(&base::RandInt),
&net_log_, NetLog::Source());
- EXPECT_EQ(OK, new_socket->Connect(kIpEndPoint));
+ EXPECT_THAT(new_socket->Connect(kIpEndPoint), IsOk());
// Create reader and writer.
std::unique_ptr<QuicChromiumPacketReader> new_reader(
@@ -472,7 +474,7 @@ TEST_P(QuicChromiumClientSessionTest, MigrateToSocketReadError) {
socket_factory_.CreateDatagramClientSocket(DatagramSocket::DEFAULT_BIND,
base::Bind(&base::RandInt),
&net_log_, NetLog::Source());
- EXPECT_EQ(OK, new_socket->Connect(kIpEndPoint));
+ EXPECT_THAT(new_socket->Connect(kIpEndPoint), IsOk());
// Create reader and writer.
std::unique_ptr<QuicChromiumPacketReader> new_reader(
@@ -525,7 +527,7 @@ TEST_P(QuicChromiumClientSessionTest, MigrateToSocketWriteError) {
socket_factory_.CreateDatagramClientSocket(DatagramSocket::DEFAULT_BIND,
base::Bind(&base::RandInt),
&net_log_, NetLog::Source());
- EXPECT_EQ(OK, new_socket->Connect(kIpEndPoint));
+ EXPECT_THAT(new_socket->Connect(kIpEndPoint), IsOk());
// Create reader and writer.
std::unique_ptr<QuicChromiumPacketReader> new_reader(
« no previous file with comments | « net/quic/p2p/quic_p2p_session_test.cc ('k') | net/quic/quic_chromium_client_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698