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

Unified Diff: net/base/static_cookie_policy_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/base/file_stream_unittest.cc ('k') | net/base/upload_bytes_element_reader_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/static_cookie_policy_unittest.cc
diff --git a/net/base/static_cookie_policy_unittest.cc b/net/base/static_cookie_policy_unittest.cc
index 7749411addf00669fddcaad3a7c81c4dacd0b434..f2d9abf437405d60c68bbade886da03103277c25 100644
--- a/net/base/static_cookie_policy_unittest.cc
+++ b/net/base/static_cookie_policy_unittest.cc
@@ -4,9 +4,13 @@
#include "net/base/net_errors.h"
#include "net/base/static_cookie_policy.h"
+#include "net/test/gtest_util.h"
+#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
+using net::test::IsOk;
+
namespace net {
class StaticCookiePolicyTest : public testing::Test {
@@ -35,49 +39,49 @@ class StaticCookiePolicyTest : public testing::Test {
};
TEST_F(StaticCookiePolicyTest, DefaultPolicyTest) {
- EXPECT_EQ(OK, CanGetCookies(url_google_, url_google_));
- EXPECT_EQ(OK, CanGetCookies(url_google_, url_google_secure_));
- EXPECT_EQ(OK, CanGetCookies(url_google_, url_google_mail_));
- EXPECT_EQ(OK, CanGetCookies(url_google_, url_google_analytics_));
- EXPECT_EQ(OK, CanGetCookies(url_google_, GURL()));
-
- EXPECT_EQ(OK, CanSetCookie(url_google_, url_google_));
- EXPECT_EQ(OK, CanSetCookie(url_google_, url_google_secure_));
- EXPECT_EQ(OK, CanSetCookie(url_google_, url_google_mail_));
- EXPECT_EQ(OK, CanSetCookie(url_google_, url_google_analytics_));
- EXPECT_EQ(OK, CanSetCookie(url_google_, GURL()));
+ EXPECT_THAT(CanGetCookies(url_google_, url_google_), IsOk());
+ EXPECT_THAT(CanGetCookies(url_google_, url_google_secure_), IsOk());
+ EXPECT_THAT(CanGetCookies(url_google_, url_google_mail_), IsOk());
+ EXPECT_THAT(CanGetCookies(url_google_, url_google_analytics_), IsOk());
+ EXPECT_THAT(CanGetCookies(url_google_, GURL()), IsOk());
+
+ EXPECT_THAT(CanSetCookie(url_google_, url_google_), IsOk());
+ EXPECT_THAT(CanSetCookie(url_google_, url_google_secure_), IsOk());
+ EXPECT_THAT(CanSetCookie(url_google_, url_google_mail_), IsOk());
+ EXPECT_THAT(CanSetCookie(url_google_, url_google_analytics_), IsOk());
+ EXPECT_THAT(CanSetCookie(url_google_, GURL()), IsOk());
}
TEST_F(StaticCookiePolicyTest, AllowAllCookiesTest) {
SetPolicyType(StaticCookiePolicy::ALLOW_ALL_COOKIES);
- EXPECT_EQ(OK, CanGetCookies(url_google_, url_google_));
- EXPECT_EQ(OK, CanGetCookies(url_google_, url_google_secure_));
- EXPECT_EQ(OK, CanGetCookies(url_google_, url_google_mail_));
- EXPECT_EQ(OK, CanGetCookies(url_google_, url_google_analytics_));
- EXPECT_EQ(OK, CanGetCookies(url_google_, GURL()));
-
- EXPECT_EQ(OK, CanSetCookie(url_google_, url_google_));
- EXPECT_EQ(OK, CanSetCookie(url_google_, url_google_secure_));
- EXPECT_EQ(OK, CanSetCookie(url_google_, url_google_mail_));
- EXPECT_EQ(OK, CanSetCookie(url_google_, url_google_analytics_));
- EXPECT_EQ(OK, CanSetCookie(url_google_, GURL()));
+ EXPECT_THAT(CanGetCookies(url_google_, url_google_), IsOk());
+ EXPECT_THAT(CanGetCookies(url_google_, url_google_secure_), IsOk());
+ EXPECT_THAT(CanGetCookies(url_google_, url_google_mail_), IsOk());
+ EXPECT_THAT(CanGetCookies(url_google_, url_google_analytics_), IsOk());
+ EXPECT_THAT(CanGetCookies(url_google_, GURL()), IsOk());
+
+ EXPECT_THAT(CanSetCookie(url_google_, url_google_), IsOk());
+ EXPECT_THAT(CanSetCookie(url_google_, url_google_secure_), IsOk());
+ EXPECT_THAT(CanSetCookie(url_google_, url_google_mail_), IsOk());
+ EXPECT_THAT(CanSetCookie(url_google_, url_google_analytics_), IsOk());
+ EXPECT_THAT(CanSetCookie(url_google_, GURL()), IsOk());
}
TEST_F(StaticCookiePolicyTest, BlockAllThirdPartyCookiesTest) {
SetPolicyType(StaticCookiePolicy::BLOCK_ALL_THIRD_PARTY_COOKIES);
- EXPECT_EQ(OK, CanGetCookies(url_google_, url_google_));
- EXPECT_EQ(OK, CanGetCookies(url_google_, url_google_secure_));
- EXPECT_EQ(OK, CanGetCookies(url_google_, url_google_mail_));
+ EXPECT_THAT(CanGetCookies(url_google_, url_google_), IsOk());
+ EXPECT_THAT(CanGetCookies(url_google_, url_google_secure_), IsOk());
+ EXPECT_THAT(CanGetCookies(url_google_, url_google_mail_), IsOk());
EXPECT_NE(OK, CanGetCookies(url_google_, url_google_analytics_));
- EXPECT_EQ(OK, CanGetCookies(url_google_, GURL()));
+ EXPECT_THAT(CanGetCookies(url_google_, GURL()), IsOk());
- EXPECT_EQ(OK, CanSetCookie(url_google_, url_google_));
- EXPECT_EQ(OK, CanSetCookie(url_google_, url_google_secure_));
- EXPECT_EQ(OK, CanSetCookie(url_google_, url_google_mail_));
+ EXPECT_THAT(CanSetCookie(url_google_, url_google_), IsOk());
+ EXPECT_THAT(CanSetCookie(url_google_, url_google_secure_), IsOk());
+ EXPECT_THAT(CanSetCookie(url_google_, url_google_mail_), IsOk());
EXPECT_NE(OK, CanSetCookie(url_google_, url_google_analytics_));
- EXPECT_EQ(OK, CanSetCookie(url_google_, GURL()));
+ EXPECT_THAT(CanSetCookie(url_google_, GURL()), IsOk());
}
TEST_F(StaticCookiePolicyTest, BlockAllCookiesTest) {
« no previous file with comments | « net/base/file_stream_unittest.cc ('k') | net/base/upload_bytes_element_reader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698