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

Unified Diff: net/http/http_auth_handler_negotiate_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_factory_unittest.cc ('k') | net/http/http_auth_sspi_win_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_negotiate_unittest.cc
diff --git a/net/http/http_auth_handler_negotiate_unittest.cc b/net/http/http_auth_handler_negotiate_unittest.cc
index 775a5b4606b06cc06538a8ef88fb6049235ed906..b2a7b43cc02788d7422b43d5cffe2d5ecdae5a2e 100644
--- a/net/http/http_auth_handler_negotiate_unittest.cc
+++ b/net/http/http_auth_handler_negotiate_unittest.cc
@@ -15,6 +15,8 @@
#include "net/http/http_request_info.h"
#include "net/http/mock_allow_http_auth_preferences.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"
#include "testing/platform_test.h"
@@ -26,6 +28,9 @@
#include "net/http/mock_gssapi_library_posix.h"
#endif
+using net::test::IsError;
+using net::test::IsOk;
+
namespace net {
#if defined(OS_ANDROID)
@@ -320,7 +325,7 @@ TEST_F(HttpAuthHandlerNegotiateTest, CnameAsync) {
std::string token;
EXPECT_EQ(ERR_IO_PENDING, auth_handler->GenerateAuthToken(
NULL, &request_info, callback.callback(), &token));
- EXPECT_EQ(OK, callback.WaitForResult());
+ EXPECT_THAT(callback.WaitForResult(), IsOk());
#if defined(OS_WIN)
EXPECT_EQ("HTTP/canonical.example.com", auth_handler->spn());
#elif defined(OS_POSIX)
@@ -343,7 +348,7 @@ TEST_F(HttpAuthHandlerNegotiateTest, ServerNotInKerberosDatabase) {
std::string token;
EXPECT_EQ(ERR_IO_PENDING, auth_handler->GenerateAuthToken(
NULL, &request_info, callback.callback(), &token));
- EXPECT_EQ(ERR_MISSING_AUTH_CREDENTIALS, callback.WaitForResult());
+ EXPECT_THAT(callback.WaitForResult(), IsError(ERR_MISSING_AUTH_CREDENTIALS));
}
// This test is only for GSSAPI, as we can't use explicit credentials with
@@ -359,7 +364,7 @@ TEST_F(HttpAuthHandlerNegotiateTest, NoKerberosCredentials) {
std::string token;
EXPECT_EQ(ERR_IO_PENDING, auth_handler->GenerateAuthToken(
NULL, &request_info, callback.callback(), &token));
- EXPECT_EQ(ERR_MISSING_AUTH_CREDENTIALS, callback.WaitForResult());
+ EXPECT_THAT(callback.WaitForResult(), IsError(ERR_MISSING_AUTH_CREDENTIALS));
}
#if defined(DLOPEN_KERBEROS)
@@ -381,7 +386,7 @@ TEST_F(HttpAuthHandlerNegotiateTest, MissingGSSAPI) {
gurl,
BoundNetLog(),
&generic_handler);
- EXPECT_EQ(ERR_UNSUPPORTED_AUTH_SCHEME, rv);
+ EXPECT_THAT(rv, IsError(ERR_UNSUPPORTED_AUTH_SCHEME));
EXPECT_TRUE(generic_handler.get() == NULL);
}
#endif // defined(DLOPEN_KERBEROS)
« no previous file with comments | « net/http/http_auth_handler_factory_unittest.cc ('k') | net/http/http_auth_sspi_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698