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

Unified Diff: net/spdy/spdy_session_pool_unittest.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/spdy/spdy_proxy_client_socket_unittest.cc ('k') | net/spdy/spdy_session_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_session_pool_unittest.cc
diff --git a/net/spdy/spdy_session_pool_unittest.cc b/net/spdy/spdy_session_pool_unittest.cc
index 978c288e769e7ea5b8a89a37b2cdacc6d8158f32..ee728acfa5e9afebffbe293f66876149d410e275 100644
--- a/net/spdy/spdy_session_pool_unittest.cc
+++ b/net/spdy/spdy_session_pool_unittest.cc
@@ -18,8 +18,13 @@
#include "net/spdy/spdy_session.h"
#include "net/spdy/spdy_stream_test_util.h"
#include "net/spdy/spdy_test_util_common.h"
+#include "net/test/gtest_util.h"
+#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+using net::test::IsError;
+using net::test::IsOk;
+
namespace net {
class SpdySessionPoolTest : public ::testing::Test,
@@ -613,13 +618,13 @@ TEST_P(SpdySessionPoolTest, IPAddressChanged) {
EXPECT_FALSE(delegateA.StreamIsClosed());
EXPECT_TRUE(delegateB.StreamIsClosed()); // Created stream was closed.
- EXPECT_EQ(ERR_NETWORK_CHANGED, delegateB.WaitForClose());
+ EXPECT_THAT(delegateB.WaitForClose(), IsError(ERR_NETWORK_CHANGED));
sessionA->CloseSessionOnError(ERR_ABORTED, "Closing");
sessionB->CloseSessionOnError(ERR_ABORTED, "Closing");
EXPECT_TRUE(delegateA.StreamIsClosed());
- EXPECT_EQ(ERR_ABORTED, delegateA.WaitForClose());
+ EXPECT_THAT(delegateA.WaitForClose(), IsError(ERR_ABORTED));
#else
EXPECT_TRUE(sessionA->IsDraining());
EXPECT_TRUE(sessionB->IsDraining());
@@ -627,9 +632,9 @@ TEST_P(SpdySessionPoolTest, IPAddressChanged) {
// Both streams were closed with an error.
EXPECT_TRUE(delegateA.StreamIsClosed());
- EXPECT_EQ(ERR_NETWORK_CHANGED, delegateA.WaitForClose());
+ EXPECT_THAT(delegateA.WaitForClose(), IsError(ERR_NETWORK_CHANGED));
EXPECT_TRUE(delegateB.StreamIsClosed());
- EXPECT_EQ(ERR_NETWORK_CHANGED, delegateB.WaitForClose());
+ EXPECT_THAT(delegateB.WaitForClose(), IsError(ERR_NETWORK_CHANGED));
#endif // defined(OS_ANDROID) || defined(OS_WIN) || defined(OS_IOS)
}
« no previous file with comments | « net/spdy/spdy_proxy_client_socket_unittest.cc ('k') | net/spdy/spdy_session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698