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..1e3fc13355f9be065faf02dd528793039f7d6ef3 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,27 @@ TEST(CookieUtilTest, TestRequestCookieParsing) { |
| CheckSerialize(tests[i].parsed, tests[i].str); |
| } |
| } |
| + |
| +class CookieUtilDomainTest : public testing::Test { |
| + protected: |
| + void SetUp() override { |
| + net::test::registry_controlled_domains::SetFindDomainTestGraph(); |
| + } |
| + |
| + void TearDown() override { |
| + net::registry_controlled_domains::SetFindDomainGraph(); |
| + } |
| +}; |
| + |
| +TEST_F(CookieUtilDomainTest, TestGetEffectiveDomain) { |
| + // Note: registry_controlled_domains::GetDomainAndRegistry is tested in its |
| + // unittests. |
|
Adam Rice
2015/01/19 06:05:57
Nit: It would be clearer to add the word "own", ie
yhirano
2015/01/19 06:11:53
Done.
|
| + 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("ftp", "ac.jp")); |
| +} |
| + |
| +} // namespace |