OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "net/base/cookie_util.h" | 6 #include "net/cookies/cookie_util.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 TEST(CookieUtilTest, TestDomainIsHostOnly) { | 9 TEST(CookieUtilTest, TestDomainIsHostOnly) { |
10 const struct { | 10 const struct { |
11 const char* str; | 11 const char* str; |
12 const bool is_host_only; | 12 const bool is_host_only; |
13 } tests[] = { | 13 } tests[] = { |
14 { "", true }, | 14 { "", true }, |
15 { "www.google.com", true }, | 15 { "www.google.com", true }, |
16 { ".google.com", false } | 16 { ".google.com", false } |
17 }; | 17 }; |
18 | 18 |
19 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { | 19 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { |
20 EXPECT_EQ(tests[i].is_host_only, | 20 EXPECT_EQ(tests[i].is_host_only, |
21 net::cookie_util::DomainIsHostOnly(tests[i].str)); | 21 net::cookie_util::DomainIsHostOnly(tests[i].str)); |
22 } | 22 } |
23 } | 23 } |
OLD | NEW |