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

Unified Diff: net/http/http_stream_factory_impl_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/http/http_proxy_client_socket_pool_unittest.cc ('k') | net/http/http_stream_parser_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_stream_factory_impl_unittest.cc
diff --git a/net/http/http_stream_factory_impl_unittest.cc b/net/http/http_stream_factory_impl_unittest.cc
index c33c9747b90badf396abdb93ba4d52e81bf09551..1067fdff11a8bf1abdd770296f466fb23a729f59 100644
--- a/net/http/http_stream_factory_impl_unittest.cc
+++ b/net/http/http_stream_factory_impl_unittest.cc
@@ -50,14 +50,20 @@
#include "net/ssl/ssl_config_service.h"
#include "net/ssl/ssl_config_service_defaults.h"
#include "net/test/cert_test_util.h"
+#include "net/test/gtest_util.h"
#include "net/test/test_data_directory.h"
// This file can be included from net/http even though
// it is in net/websockets because it doesn't
// introduce any link dependency to net/websockets.
#include "net/websockets/websocket_handshake_stream_base.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 BidirectionalStreamImpl;
@@ -1707,7 +1713,7 @@ TEST_P(HttpStreamFactoryBidirectionalQuicTest,
delegate.WaitUntilDone();
scoped_refptr<IOBuffer> buffer = new net::IOBuffer(1);
- EXPECT_EQ(OK, stream_impl->ReadData(buffer.get(), 1));
+ EXPECT_THAT(stream_impl->ReadData(buffer.get(), 1), IsOk());
EXPECT_EQ(kProtoQUIC1SPDY3, stream_impl->GetProtocol());
EXPECT_EQ("200", delegate.response_headers().find(":status")->second);
EXPECT_EQ(0, GetSocketPoolGroupCount(session()->GetTransportSocketPool(
@@ -1759,7 +1765,7 @@ TEST_P(HttpStreamFactoryBidirectionalQuicTest,
ASSERT_FALSE(waiter.bidirectional_stream_impl());
// Since the alternative service job is not started, we will get the error
// from the http job.
- ASSERT_EQ(ERR_CONNECTION_REFUSED, waiter.error_status());
+ ASSERT_THAT(waiter.error_status(), IsError(ERR_CONNECTION_REFUSED));
}
// Tests that if Http job fails, but Quic job succeeds, we return
@@ -1831,7 +1837,7 @@ TEST_P(HttpStreamFactoryBidirectionalQuicTest,
// Make sure the BidirectionalStream negotiated goes through QUIC.
scoped_refptr<IOBuffer> buffer = new net::IOBuffer(1);
- EXPECT_EQ(OK, stream_impl->ReadData(buffer.get(), 1));
+ EXPECT_THAT(stream_impl->ReadData(buffer.get(), 1), IsOk());
EXPECT_EQ(kProtoQUIC1SPDY3, stream_impl->GetProtocol());
EXPECT_EQ("200", delegate.response_headers().find(":status")->second);
// There is no Http2 socket pool.
@@ -1879,7 +1885,7 @@ TEST_P(HttpStreamFactoryTest, RequestBidirectionalStreamImplFailure) {
BoundNetLog()));
waiter.WaitForStream();
EXPECT_TRUE(waiter.stream_done());
- ASSERT_EQ(ERR_FAILED, waiter.error_status());
+ ASSERT_THAT(waiter.error_status(), IsError(ERR_FAILED));
EXPECT_FALSE(waiter.websocket_stream());
ASSERT_FALSE(waiter.stream());
ASSERT_FALSE(waiter.bidirectional_stream_impl());
« no previous file with comments | « net/http/http_proxy_client_socket_pool_unittest.cc ('k') | net/http/http_stream_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698