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

Unified Diff: net/http/http_auth_handler_factory_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_auth_handler_digest_unittest.cc ('k') | net/http/http_auth_handler_negotiate_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_auth_handler_factory_unittest.cc
diff --git a/net/http/http_auth_handler_factory_unittest.cc b/net/http/http_auth_handler_factory_unittest.cc
index 6ed7c2fc9c94dcd4292d16212b2adf37b402be06..3c52b2d0c95f4e33fd0958f556b775bdf97f0458 100644
--- a/net/http/http_auth_handler_factory_unittest.cc
+++ b/net/http/http_auth_handler_factory_unittest.cc
@@ -13,8 +13,13 @@
#include "net/http/mock_allow_http_auth_preferences.h"
#include "net/http/url_security_manager.h"
#include "net/ssl/ssl_info.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 {
@@ -118,7 +123,7 @@ TEST(HttpAuthHandlerFactoryTest, DefaultFactory) {
int rv = http_auth_handler_factory->CreateAuthHandlerFromString(
"Basic realm=\"FooBar\"", HttpAuth::AUTH_SERVER, null_ssl_info,
server_origin, BoundNetLog(), &handler);
- EXPECT_EQ(OK, rv);
+ EXPECT_THAT(rv, IsOk());
ASSERT_FALSE(handler.get() == NULL);
EXPECT_EQ(HttpAuth::AUTH_SCHEME_BASIC, handler->auth_scheme());
EXPECT_STREQ("FooBar", handler->realm().c_str());
@@ -131,7 +136,7 @@ TEST(HttpAuthHandlerFactoryTest, DefaultFactory) {
int rv = http_auth_handler_factory->CreateAuthHandlerFromString(
"UNSUPPORTED realm=\"FooBar\"", HttpAuth::AUTH_SERVER, null_ssl_info,
server_origin, BoundNetLog(), &handler);
- EXPECT_EQ(ERR_UNSUPPORTED_AUTH_SCHEME, rv);
+ EXPECT_THAT(rv, IsError(ERR_UNSUPPORTED_AUTH_SCHEME));
EXPECT_TRUE(handler.get() == NULL);
}
{
@@ -139,7 +144,7 @@ TEST(HttpAuthHandlerFactoryTest, DefaultFactory) {
int rv = http_auth_handler_factory->CreateAuthHandlerFromString(
"Digest realm=\"FooBar\", nonce=\"xyz\"", HttpAuth::AUTH_PROXY,
null_ssl_info, proxy_origin, BoundNetLog(), &handler);
- EXPECT_EQ(OK, rv);
+ EXPECT_THAT(rv, IsOk());
ASSERT_FALSE(handler.get() == NULL);
EXPECT_EQ(HttpAuth::AUTH_SCHEME_DIGEST, handler->auth_scheme());
EXPECT_STREQ("FooBar", handler->realm().c_str());
@@ -152,7 +157,7 @@ TEST(HttpAuthHandlerFactoryTest, DefaultFactory) {
int rv = http_auth_handler_factory->CreateAuthHandlerFromString(
"NTLM", HttpAuth::AUTH_SERVER, null_ssl_info, server_origin,
BoundNetLog(), &handler);
- EXPECT_EQ(OK, rv);
+ EXPECT_THAT(rv, IsOk());
ASSERT_FALSE(handler.get() == NULL);
EXPECT_EQ(HttpAuth::AUTH_SCHEME_NTLM, handler->auth_scheme());
EXPECT_STREQ("", handler->realm().c_str());
@@ -167,7 +172,7 @@ TEST(HttpAuthHandlerFactoryTest, DefaultFactory) {
BoundNetLog(), &handler);
// Note the default factory doesn't support Kerberos on Android
#if defined(USE_KERBEROS) && !defined(OS_ANDROID)
- EXPECT_EQ(OK, rv);
+ EXPECT_THAT(rv, IsOk());
ASSERT_FALSE(handler.get() == NULL);
EXPECT_EQ(HttpAuth::AUTH_SCHEME_NEGOTIATE, handler->auth_scheme());
EXPECT_STREQ("", handler->realm().c_str());
@@ -175,7 +180,7 @@ TEST(HttpAuthHandlerFactoryTest, DefaultFactory) {
EXPECT_TRUE(handler->encrypts_identity());
EXPECT_TRUE(handler->is_connection_based());
#else
- EXPECT_EQ(ERR_UNSUPPORTED_AUTH_SCHEME, rv);
+ EXPECT_THAT(rv, IsError(ERR_UNSUPPORTED_AUTH_SCHEME));
EXPECT_TRUE(handler.get() == NULL);
#endif // defined(USE_KERBEROS) && !defined(OS_ANDROID)
}
« no previous file with comments | « net/http/http_auth_handler_digest_unittest.cc ('k') | net/http/http_auth_handler_negotiate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698