Chromium Code Reviews| Index: net/cookies/cookie_util_unittest.cc |
| diff --git a/net/cookies/cookie_util_unittest.cc b/net/cookies/cookie_util_unittest.cc |
| index fc2763146c9f7287261562ef3e17ffb642764ac1..2bf0b3d1b142b8a0040604516b4b7d0f6ed7a0eb 100644 |
| --- a/net/cookies/cookie_util_unittest.cc |
| +++ b/net/cookies/cookie_util_unittest.cc |
| @@ -7,6 +7,8 @@ |
| #include <vector> |
| #include "base/basictypes.h" |
| +#include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| +#include "net/base/registry_controlled_domains/test_util.h" |
| #include "net/cookies/cookie_util.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| @@ -43,8 +45,6 @@ void CheckSerialize( |
| EXPECT_EQ(str_expected, net::cookie_util::SerializeRequestCookieLine(prc)); |
| } |
| -} // namespace |
| - |
| TEST(CookieUtilTest, TestDomainIsHostOnly) { |
| const struct { |
| const char* str; |
| @@ -194,3 +194,25 @@ TEST(CookieUtilTest, TestRequestCookieParsing) { |
| CheckSerialize(tests[i].parsed, tests[i].str); |
| } |
| } |
| + |
| +class CookieUtilDomainTest : public testing::Test { |
| + protected: |
| + void TearDown() override { |
| + net::registry_controlled_domains::SetFindDomainGraph(); |
| + } |
| +}; |
| + |
| +TEST_F(CookieUtilDomainTest, TestGetEffectiveDomain) { |
| + net::test::registry_controlled_domains::SetFindDomainTestGraph(); |
|
Adam Rice
2015/01/19 05:18:56
This should go in CookieUtilDomainTest::SetUp() fo
yhirano
2015/01/19 05:56:21
Done.
|
| + // Note: registry_controlled_domains::GetDomainAndRegistry is tested in its |
| + // unittests. |
| + |
| + EXPECT_EQ("", net::cookie_util::GetEffectiveDomain("http", "ac.jp")); |
| + EXPECT_EQ("", net::cookie_util::GetEffectiveDomain("http", "ac.jp")); |
| + EXPECT_EQ("", net::cookie_util::GetEffectiveDomain("https", "ac.jp")); |
| + EXPECT_EQ("", net::cookie_util::GetEffectiveDomain("ws", "ac.jp")); |
| + EXPECT_EQ("", net::cookie_util::GetEffectiveDomain("wss", "ac.jp")); |
| + EXPECT_EQ("ac.jp", net::cookie_util::GetEffectiveDomain("foo", "ac.jp")); |
|
Adam Rice
2015/01/19 05:18:56
Suggestion: use "ftp" instead of "foo" here. I thi
yhirano
2015/01/19 05:56:21
Done.
|
| +} |
| + |
| +} // namespace |