Commit 0863ab95 authored by Dylan Cutler's avatar Dylan Cutler Committed by Commit Bot

Add unit test that CanonicalCookieFromSystemCookie does not crash when

the resulting cookie is not canonical.

This unit test coverage will prevent future changes from reintroducing
the crash that caused http://crbug.com/1146386.

Bug: 1146386
Change-Id: I86f2196a6aa2d73b97cee0525cff026ce6e1a1ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2536983Reviewed-by: default avatarLily Chen <chlily@chromium.org>
Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Commit-Queue: Dylan Cutler <dylancutler@google.com>
Cr-Commit-Position: refs/heads/master@{#827780}
parent a6d77364
......@@ -139,6 +139,16 @@ TEST_F(CookieUtil, CanonicalCookieFromSystemCookie) {
chrome_cookie = CanonicalCookieFromSystemCookie(system_cookie, creation_time);
EXPECT_FALSE(chrome_cookie->IsPersistent());
EXPECT_TRUE(chrome_cookie->IsSecure());
// Test a non-Canonical cookie does not cause a crash.
system_cookie = [[NSHTTPCookie alloc] initWithProperties:@{
NSHTTPCookieDomain : @"foo",
// Malformed name will make the resulting cookie non-canonical.
NSHTTPCookieName : @"A=",
NSHTTPCookiePath : @"/",
NSHTTPCookieValue : @"b",
}];
EXPECT_FALSE(CanonicalCookieFromSystemCookie(system_cookie, creation_time));
}
// Tests that histogram is reported correctly based on the input.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment