Commit 37b6a864 authored by Jarryd's avatar Jarryd Committed by Commit Bot

Async Cookies: Fix cross-frame test cleanup.

Fixed the cleanup functions to return a Promise and use explicit domains to make sure the cookies are cleaned up afterwards.

Bug: 729800
Change-Id: Iba3ca150431e21be26536658d3b5d77648edfe83
Reviewed-on: https://chromium-review.googlesource.com/c/1226199
Commit-Queue: Jarryd Goodman <jarrydg@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Reviewed-by: default avatarVictor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609547}
parent 42c0440f
......@@ -15,7 +15,8 @@ promise_test(async t => {
const frameCookieStore = iframe.contentWindow.cookieStore;
const oldCookie = await frameCookieStore.get('cookie-name');
assert_equals(oldCookie, null);
assert_equals(oldCookie, null,
'Precondition not met: cookie store should be empty');
await cookieStore.set('cookie-name', 'cookie-value');
t.add_cleanup(() => cookieStore.delete('cookie-name'));
......@@ -29,7 +30,8 @@ promise_test(async t => {
const frameCookieStore = iframe.contentWindow.cookieStore;
const oldCookie = await frameCookieStore.get('cookie-name');
assert_equals(oldCookie, null);
assert_equals(oldCookie, null,
'Precondition not met: cookie store should be empty');
await frameCookieStore.set('cookie-name', 'cookie-value');
t.add_cleanup(() => frameCookieStore.delete('cookie-name'));
......
......@@ -24,10 +24,10 @@ promise_test(async t => {
name: 'cookie-name',
value: 'cookie-value',
}, kCorsBase);
t.add_cleanup(() => {
cookieStore.delete('cookie-name');
});
t.add_cleanup(() => cookieStore.delete({
name: 'cookie-name',
domain: '{{host}}',
}));
await waitForMessage();
const cookies = await cookieStore.getAll();
......@@ -40,7 +40,11 @@ promise_test(async t => {
const iframe = await createIframe(kCorsUrl, t);
assert_true(iframe != null);
await cookieStore.set('cookie-name', 'cookie-value');
await cookieStore.set({
name: 'cookie-name',
value: 'cookie-value',
domain: '{{host}}',
});
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.value, 'cookie-value');
......@@ -49,9 +53,10 @@ promise_test(async t => {
opname: 'get-cookie',
name: 'cookie-name',
}, kCorsBase);
t.add_cleanup(() => {
cookieStore.delete('cookie-name');
})
t.add_cleanup(() => cookieStore.delete({
name: 'cookie-name',
domain: '{{host}}',
}));
const message = await waitForMessage();
......
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