summaryrefslogtreecommitdiffstats
path: root/chrome_frame/test/html_util_unittests.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome_frame/test/html_util_unittests.cc')
-rw-r--r--chrome_frame/test/html_util_unittests.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/chrome_frame/test/html_util_unittests.cc b/chrome_frame/test/html_util_unittests.cc
index 7884638..5670055 100644
--- a/chrome_frame/test/html_util_unittests.cc
+++ b/chrome_frame/test/html_util_unittests.cc
@@ -385,3 +385,23 @@ TEST(HttpCookieTest, IdentifyDuplicateCookieTest) {
"BLAH", header_cookies));
}
+TEST(HttpCookieTest, SetCookiePathToRootIfNotPresentTest) {
+ struct TestCase {
+ std::string input;
+ std::string expected;
+ } test_cases[] = {
+ { "", "" },
+ { "Cookie=value", "Cookie=value; path=/" },
+ { "Cookie=value;", "Cookie=value; path=/" },
+ { "Cookie=value; ", "Cookie=value; path=/" },
+ { " Cookie=value; ", "Cookie=value; path=/" },
+ { "Cookie=", "Cookie=; path=/" },
+ { "Cookie=foo; path=/bar", "Cookie=foo; path=/bar" },
+ };
+
+ for (int i = 0; i < arraysize(test_cases); ++i) {
+ std::string& cookie(test_cases[i].input);
+ URLRequestAutomationJob::SetCookiePathToRootIfNotPresent(&cookie);
+ EXPECT_EQ(cookie, test_cases[i].expected);
+ }
+}