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

Unified Diff: net/dns/single_request_host_resolver_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/dns/mojo_host_resolver_impl_unittest.cc ('k') | net/ftp/ftp_ctrl_response_buffer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/single_request_host_resolver_unittest.cc
diff --git a/net/dns/single_request_host_resolver_unittest.cc b/net/dns/single_request_host_resolver_unittest.cc
index c5bb9f1ae6b0983988f472f30cef4ea531b7cc02..c0b3a7b82cda8a8c031580ad4adb3b85d4bbfb58 100644
--- a/net/dns/single_request_host_resolver_unittest.cc
+++ b/net/dns/single_request_host_resolver_unittest.cc
@@ -10,8 +10,13 @@
#include "net/base/test_completion_callback.h"
#include "net/dns/mock_host_resolver.h"
#include "net/log/net_log.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 {
namespace {
@@ -78,8 +83,8 @@ TEST(SingleRequestHostResolverTest, NormalResolve) {
HostResolver::RequestInfo request(HostPortPair("watsup", 90));
int rv = single_request_resolver.Resolve(
request, DEFAULT_PRIORITY, &addrlist, callback.callback(), BoundNetLog());
- EXPECT_EQ(ERR_IO_PENDING, rv);
- EXPECT_EQ(OK, callback.WaitForResult());
+ EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
+ EXPECT_THAT(callback.WaitForResult(), IsOk());
// Verify that the result is what we specified in the MockHostResolver.
ASSERT_FALSE(addrlist.empty());
@@ -102,7 +107,7 @@ TEST(SingleRequestHostResolverTest, Cancel) {
&addrlist,
callback.callback(),
BoundNetLog());
- EXPECT_EQ(ERR_IO_PENDING, rv);
+ EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
EXPECT_TRUE(resolver.has_outstanding_request());
}
« no previous file with comments | « net/dns/mojo_host_resolver_impl_unittest.cc ('k') | net/ftp/ftp_ctrl_response_buffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698