Bug 1457625 [wpt PR 10698] - Cookie Store: Rework tests, remove duplicates, a=testonly
authorJoshua Bell <jsbell@chromium.org>
Tue, 01 May 2018 17:27:26 +0000
changeset 472727 832fbf6ff694ccd633bbb2cad28ae9229f21d735
parent 472726 5e07e3179c7bc640523f3a4e7201721e5c224cde
child 472728 6c92f101e575c51a03057f22a86c60716a6acb79
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1457625, 10698, 729800, 1033715, 554904
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1457625 [wpt PR 10698] - Cookie Store: Rework tests, remove duplicates, a=testonly Automatic update from web-platform-testsCookie Store: Rework tests, remove duplicates * Pull HTTPONLY- cookie tests into a separate file. * Consolidate CookieStore/HTTP interop tests into one file. * Make CookieStore/HTTP interop tests verify overwrites too. * Delete unused test helper functions. * Remove redundant deletion test with no asserts. * Add basic deletion test that verifies method return type. Bug: 729800 Change-Id: Ia0e97ffdb2d2adf7c6fb46c9cd06f285dfa8eb79 Reviewed-on: https://chromium-review.googlesource.com/1033715 Reviewed-by: Victor Costan <pwnall@chromium.org> Commit-Queue: Joshua Bell <jsbell@chromium.org> Cr-Commit-Position: refs/heads/master@{#554904} -- wpt-commits: 3e66e833ea150c2c39892d122173695b867bc772 wpt-pr: 10698
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/cookie-store/cookieStore_delete_basic.tentative.window.js
testing/web-platform/tests/cookie-store/delete_cookies.tentative.html
testing/web-platform/tests/cookie-store/delete_cookies.tentative.https.html
testing/web-platform/tests/cookie-store/get_set_get_all.tentative.html
testing/web-platform/tests/cookie-store/get_set_get_all.tentative.https.html
testing/web-platform/tests/cookie-store/httponly_cookies.window.js
testing/web-platform/tests/cookie-store/resources/cookie-test-helpers.js
testing/web-platform/tests/cookie-store/resources/delete_cookies.js
testing/web-platform/tests/cookie-store/resources/get_set_get_all.js
testing/web-platform/tests/cookie-store/resources/http_cookie_and_set_cookie_headers.js
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -215615,31 +215615,21 @@
      {}
     ]
    ],
    "cookie-store/resources/cookie_helper.py": [
     [
      {}
     ]
    ],
-   "cookie-store/resources/delete_cookies.js": [
-    [
-     {}
-    ]
-   ],
    "cookie-store/resources/document_cookie.js": [
     [
      {}
     ]
    ],
-   "cookie-store/resources/get_set_get_all.js": [
-    [
-     {}
-    ]
-   ],
    "cookie-store/resources/http_cookie_and_set_cookie_headers.js": [
     [
      {}
     ]
    ],
    "cookie-store/resources/no_name_and_no_value.js": [
     [
      {}
@@ -313839,16 +313829,22 @@
     ]
    ],
    "cookie-store/cookieStore_delete_arguments.tentative.window.js": [
     [
      "/cookie-store/cookieStore_delete_arguments.tentative.window.html",
      {}
     ]
    ],
+   "cookie-store/cookieStore_delete_basic.tentative.window.js": [
+    [
+     "/cookie-store/cookieStore_delete_basic.tentative.window.html",
+     {}
+    ]
+   ],
    "cookie-store/cookieStore_event_arguments.tenative.window.js": [
     [
      "/cookie-store/cookieStore_event_arguments.tenative.window.html",
      {}
     ]
    ],
    "cookie-store/cookieStore_event_basic.tentative.window.js": [
     [
@@ -313935,28 +313931,16 @@
     ]
    ],
    "cookie-store/cookieStore_special_names.tentative.https.html": [
     [
      "/cookie-store/cookieStore_special_names.tentative.https.html",
      {}
     ]
    ],
-   "cookie-store/delete_cookies.tentative.html": [
-    [
-     "/cookie-store/delete_cookies.tentative.html",
-     {}
-    ]
-   ],
-   "cookie-store/delete_cookies.tentative.https.html": [
-    [
-     "/cookie-store/delete_cookies.tentative.https.html",
-     {}
-    ]
-   ],
    "cookie-store/document_cookie.tentative.html": [
     [
      "/cookie-store/document_cookie.tentative.html",
      {}
     ]
    ],
    "cookie-store/document_cookie.tentative.https.html": [
     [
@@ -313965,40 +313949,34 @@
     ]
    ],
    "cookie-store/document_getAll_multiple.tentative.html": [
     [
      "/cookie-store/document_getAll_multiple.tentative.html",
      {}
     ]
    ],
-   "cookie-store/get_set_get_all.tentative.html": [
-    [
-     "/cookie-store/get_set_get_all.tentative.html",
-     {}
-    ]
-   ],
-   "cookie-store/get_set_get_all.tentative.https.html": [
-    [
-     "/cookie-store/get_set_get_all.tentative.https.html",
-     {}
-    ]
-   ],
    "cookie-store/http_cookie_and_set_cookie_headers.tentative.html": [
     [
      "/cookie-store/http_cookie_and_set_cookie_headers.tentative.html",
      {}
     ]
    ],
    "cookie-store/http_cookie_and_set_cookie_headers.tentative.https.html": [
     [
      "/cookie-store/http_cookie_and_set_cookie_headers.tentative.https.html",
      {}
     ]
    ],
+   "cookie-store/httponly_cookies.window.js": [
+    [
+     "/cookie-store/httponly_cookies.window.html",
+     {}
+    ]
+   ],
    "cookie-store/idlharness.tentative.html": [
     [
      "/cookie-store/idlharness.tentative.html",
      {}
     ]
    ],
    "cookie-store/idlharness_serviceworker.tentative.https.html": [
     [
@@ -428142,16 +428120,20 @@
   "cookie-store/README.md": [
    "40595162d15dec7e315ef16f94646045596d7b1c",
    "support"
   ],
   "cookie-store/cookieStore_delete_arguments.tentative.window.js": [
    "f33ce9a975c759ce6da8a5caa371ca026dd537c4",
    "testharness"
   ],
+  "cookie-store/cookieStore_delete_basic.tentative.window.js": [
+   "c0a5c01ffcdd3755eb3db3dc4a6ec398fd2aba37",
+   "testharness"
+  ],
   "cookie-store/cookieStore_event_arguments.tenative.window.js": [
    "a61074b6062928c29a83e0f7d456fdce9e3a3d47",
    "testharness"
   ],
   "cookie-store/cookieStore_event_basic.tentative.window.js": [
    "33faf57882e558a54d6cbf181141e03f1b3cd871",
    "testharness"
   ],
@@ -428206,52 +428188,40 @@
   "cookie-store/cookieStore_special_names.tentative.html": [
    "f839e2825dd18a6f54639fc2b7d4a18ce9906b25",
    "testharness"
   ],
   "cookie-store/cookieStore_special_names.tentative.https.html": [
    "4d53aaecbf9fea2865ca6492bc69b2ec3a47af79",
    "testharness"
   ],
-  "cookie-store/delete_cookies.tentative.html": [
-   "9ad9854eb07172eab8103a4131baf0817a926e16",
-   "testharness"
-  ],
-  "cookie-store/delete_cookies.tentative.https.html": [
-   "69d05ab73a4692a08aa33ac20aa43cd1f6bb4e52",
-   "testharness"
-  ],
   "cookie-store/document_cookie.tentative.html": [
    "23916c5325b2c98875eac4ab7291622b44974daf",
    "testharness"
   ],
   "cookie-store/document_cookie.tentative.https.html": [
    "447ba96e7bb23a0def44817e584891097bb81998",
    "testharness"
   ],
   "cookie-store/document_getAll_multiple.tentative.html": [
    "179f3ffe69715f9767ec2d2ef661c429fef52bc6",
    "testharness"
   ],
-  "cookie-store/get_set_get_all.tentative.html": [
-   "89c72f73d511ab3510653baebb7c77aab6441f35",
-   "testharness"
-  ],
-  "cookie-store/get_set_get_all.tentative.https.html": [
-   "e2164c6e423724be2f91d47c0fa4931944ebff4f",
-   "testharness"
-  ],
   "cookie-store/http_cookie_and_set_cookie_headers.tentative.html": [
    "7fb04dc519bafed5f35493f65664b51e23131a1d",
    "testharness"
   ],
   "cookie-store/http_cookie_and_set_cookie_headers.tentative.https.html": [
    "2ccfc03ad6fedb063e2cd3ff9726b8d482ab5cf0",
    "testharness"
   ],
+  "cookie-store/httponly_cookies.window.js": [
+   "555f8ba13eda737365689d07bca9f9778188a552",
+   "testharness"
+  ],
   "cookie-store/idlharness.tentative.html": [
    "2a588a0b80a3cee80af52b9109770fe8ec17becd",
    "testharness"
   ],
   "cookie-store/idlharness_serviceworker.js": [
    "aceb00f593b0447853fa70c8c971902cf02a164b",
    "support"
   ],
@@ -428283,37 +428253,29 @@
    "aa3ed15714a1ed2b7cac4ba2fc7998d9792b7339",
    "testharness"
   ],
   "cookie-store/ordering.tentative.https.html": [
    "e40eb0cdca00826731e9242682105b76baea9a03",
    "testharness"
   ],
   "cookie-store/resources/cookie-test-helpers.js": [
-   "09f5e60fc4b96a0cdb51b69a1c622c3898ad5568",
+   "4202b9a557fbef409b1ae1b9438231a461a2b3e6",
    "support"
   ],
   "cookie-store/resources/cookie_helper.py": [
    "4b95a4012e36cacceb6737f751e99634bd7326b9",
    "support"
   ],
-  "cookie-store/resources/delete_cookies.js": [
-   "f698e4dcc887b7e6d231fa0e8aa2aba58c3bda73",
-   "support"
-  ],
   "cookie-store/resources/document_cookie.js": [
    "b34ad56a2afd7f52c52dd0777b15eac2d77c4856",
    "support"
   ],
-  "cookie-store/resources/get_set_get_all.js": [
-   "235f22721a73a617d0b14068c8e639e93232526a",
-   "support"
-  ],
   "cookie-store/resources/http_cookie_and_set_cookie_headers.js": [
-   "12e0d0f889bbc298e47c2450b20df0fe86ffb566",
+   "4cf790a3ff1d6eb075d8f22e56a610e7c9d3c0d8",
    "support"
   ],
   "cookie-store/resources/no_name_and_no_value.js": [
    "907b6f8568f43f6f41fcaa3ec6876a512bcf6fec",
    "support"
   ],
   "cookie-store/resources/no_name_equals_in_value.js": [
    "8a5b87568d36dde7093b1bc6aae02ffe556887ca",
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/cookie-store/cookieStore_delete_basic.tentative.window.js
@@ -0,0 +1,10 @@
+'use strict';
+
+promise_test(async testCase => {
+  const p = cookieStore.delete('cookie-name');
+  assert_true(p instanceof Promise,
+              'cookieStore.delete() returns a promise');
+  const result = await p;
+  assert_equals(result, undefined,
+                'cookieStore.delete() promise resolves to undefined');
+}, 'cookieStore.delete return type is Promise<void>');
deleted file mode 100644
--- a/testing/web-platform/tests/cookie-store/delete_cookies.tentative.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>Async Cookies: delete cookies</title>
-<meta name="help" href="https://github.com/WICG/cookie-store/">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/cookie-test-helpers.js"></script>
-<script src="resources/delete_cookies.js"></script>
deleted file mode 100644
--- a/testing/web-platform/tests/cookie-store/delete_cookies.tentative.https.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>Async Cookies: delete cookies (HTTPS)</title>
-<meta name="help" href="https://github.com/WICG/cookie-store/">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/cookie-test-helpers.js"></script>
-<script src="resources/delete_cookies.js"></script>
deleted file mode 100644
--- a/testing/web-platform/tests/cookie-store/get_set_get_all.tentative.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>Async Cookies: get, set, getAll</title>
-<meta name="help" href="https://github.com/WICG/cookie-store/">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/cookie-test-helpers.js"></script>
-<script src="resources/get_set_get_all.js"></script>
deleted file mode 100644
--- a/testing/web-platform/tests/cookie-store/get_set_get_all.tentative.https.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>Async Cookies: get, set, getAll (HTTPS)</title>
-<meta name="help" href="https://github.com/WICG/cookie-store/">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/cookie-test-helpers.js"></script>
-<script src="resources/get_set_get_all.js"></script>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/cookie-store/httponly_cookies.window.js
@@ -0,0 +1,36 @@
+// META: script=resources/cookie-test-helpers.js
+
+'use strict';
+
+cookie_test(async t => {
+  let eventPromise = observeNextCookieChangeEvent();
+  await setCookieStringHttp('HTTPONLY-🍪=🔵; path=/; httponly');
+  assert_equals(
+      await getCookieString(),
+      undefined,
+      'HttpOnly cookie we wrote using HTTP in cookie jar' +
+        ' is invisible to script');
+  assert_equals(
+      await getCookieStringHttp(),
+      'HTTPONLY-🍪=🔵',
+    'HttpOnly cookie we wrote using HTTP in HTTP cookie jar');
+
+  eventPromise = observeNextCookieChangeEvent();
+  await setCookieStringHttp(
+      'HTTPONLY-🍪=DELETED; path=/; max-age=0; httponly');
+  assert_equals(
+      await getCookieString(),
+      undefined,
+      'Empty cookie jar after HTTP cookie-clearing using max-age=0');
+  assert_equals(
+      await getCookieStringHttp(),
+      undefined,
+      'Empty HTTP cookie jar after HTTP cookie-clearing using max-age=0');
+
+  // HTTPONLY cookie changes should not have been observed; perform
+  // a dummy change to verify that nothing else was queued up.
+  await cookieStore.set('TEST', 'dummy');
+  await verifyCookieChangeEvent(
+    eventPromise, {changed: [{name: 'TEST', value: 'dummy'}]},
+    'HttpOnly cookie deletion was not observed');
+}, 'HttpOnly cookies are not observed');
--- a/testing/web-platform/tests/cookie-store/resources/cookie-test-helpers.js
+++ b/testing/web-platform/tests/cookie-store/resources/cookie-test-helpers.js
@@ -6,62 +6,31 @@ const kPath = location.pathname.replace(
 // True when running in a document context as opposed to a worker context
 const kHasDocument = typeof document !== 'undefined';
 
 // True when running on unsecured 'http:' rather than secured 'https:'.
 const kIsUnsecured = location.protocol !== 'https:';
 
 const kCookieHelperCgi = 'resources/cookie_helper.py';
 
-// Async wrapper for an async function or promise that is expected
-// reject in an unsecured (non-https:) context and work in a secured
-// (https:) context.
-//
-// Parameters:
-//
-// - testCase: (TestCase) test case context
-// - code: (Error class or number) expected rejection type in unsecured context
-// - promise: (thenable) test code
-// - message: (optional; string) message to forward to promise_rejects in
-//   unsecured context
-async function promise_rejects_when_unsecured(
-  testCase,
-  code,
-  promise,
-  message = 'Feature unavailable from unsecured contexts') {
-  if (kIsUnsecured)
-    await promise_rejects(testCase, code, promise, message);
-  else await promise;
-};
-
-// Converts a list of cookie records {name, value} to [name=]value; ... as
-// seen in Cookie: and document.cookie.
-//
-// Parameters:
-// - cookies: (array of {name, value}) records to convert
-//
-// Returns a string serializing the records, or undefined if no records were
-// given.
-function cookieString(cookies) {
-  return cookies.length ? cookies.map((
-    {name, value}) => (name ? (name + '=') : '') + value).join('; ') :
-  undefined;
-}
-
 // Approximate async equivalent to the document.cookie getter but with
 // important differences: optional additional getAll arguments are
 // forwarded, and an empty cookie jar returns undefined.
 //
 // This is intended primarily for verification against expected cookie
 // jar contents. It should produce more readable messages using
 // assert_equals in failing cases than assert_object_equals would
 // using parsed cookie jar contents and also allows expectations to be
 // written more compactly.
 async function getCookieString(...args) {
-  return cookieString(await cookieStore.getAll(...args));
+  const cookies = await cookieStore.getAll(...args);
+  return cookies.length
+    ? cookies.map(({name, value}) =>
+                  (name ? (name + '=') : '') + value).join('; ')
+    : undefined;
 }
 
 // Approximate async equivalent to the document.cookie getter but from
 // the server's point of view. Returns UTF-8 interpretation. Allows
 // sub-path to be specified.
 //
 // Unlike document.cookie, this returns undefined when no cookies are
 // present.
deleted file mode 100644
--- a/testing/web-platform/tests/cookie-store/resources/delete_cookies.js
+++ /dev/null
@@ -1,44 +0,0 @@
-'use strict';
-
-cookie_test(async testCase => {
-  // TODO: This test doesn't create cookies and doesn't assert
-  // the behavior of delete(). Improve or remove it.
-
-  await cookieStore.delete('');
-  await cookieStore.delete('TEST');
-  await cookieStore.delete('META-🍪');
-  await cookieStore.delete('DOCUMENT-🍪');
-  await cookieStore.delete('HTTP-🍪');
-
-  await setCookieStringHttp(
-    'HTTPONLY-🍪=DELETED; path=/; max-age=0; httponly');
-
-  await promise_rejects_when_unsecured(
-      testCase,
-      new TypeError(),
-      cookieStore.delete('__Host-COOKIENAME'));
-  await promise_rejects_when_unsecured(
-      testCase,
-      new TypeError(),
-      cookieStore.delete('__Host-1🍪'));
-  await promise_rejects_when_unsecured(
-      testCase,
-      new TypeError(),
-      cookieStore.delete('__Host-2🌟'));
-  await promise_rejects_when_unsecured(
-      testCase,
-      new TypeError(),
-      cookieStore.delete('__Host-3🌱'));
-  await promise_rejects_when_unsecured(
-      testCase,
-      new TypeError(),
-      cookieStore.delete('__Host-unordered1🍪'));
-  await promise_rejects_when_unsecured(
-      testCase,
-      new TypeError(),
-      cookieStore.delete('__Host-unordered2🌟'));
-  await promise_rejects_when_unsecured(
-      testCase,
-      new TypeError(),
-      cookieStore.delete('__Host-unordered3🌱'));
-}, 'Test cookieStore.delete');
deleted file mode 100644
--- a/testing/web-platform/tests/cookie-store/resources/get_set_get_all.js
+++ /dev/null
@@ -1,74 +0,0 @@
-'use strict';
-
-cookie_test(async t => {
-  let eventPromise = observeNextCookieChangeEvent();
-  await cookieStore.set('TEST', 'value0');
-  assert_equals(
-      await getCookieString(),
-      'TEST=value0',
-      'Cookie jar contains only cookie we set');
-  assert_equals(
-    await getCookieStringHttp(),
-    'TEST=value0',
-    'HTTP cookie jar contains only cookie we set');
-  await verifyCookieChangeEvent(
-    eventPromise,
-    {changed: [{name: 'TEST', value: 'value0'}]},
-    'Observed value that was set');
-
-  eventPromise = observeNextCookieChangeEvent();
-  await cookieStore.set('TEST', 'value');
-  assert_equals(
-      await getCookieString(),
-      'TEST=value',
-      'Cookie jar contains only cookie we overwrote');
-  await verifyCookieChangeEvent(
-    eventPromise,
-    {changed: [{name: 'TEST', value: 'value'}]},
-    'Observed value that was overwritten');
-
-  let allCookies = await cookieStore.getAll();
-  assert_equals(
-      allCookies[0].name,
-      'TEST',
-      'First entry in allCookies should be named TEST');
-  assert_equals(
-      allCookies[0].value,
-      'value',
-      'First entry in allCookies should have value "value"');
-  assert_equals(
-      allCookies.length,
-      1,
-      'Only one cookie should exist in allCookies');
-  let firstCookie = await cookieStore.get();
-  assert_equals(
-      firstCookie.name,
-      'TEST',
-      'First cookie should be named TEST');
-  assert_equals(
-      firstCookie.value,
-      'value',
-      'First cookie should have value "value"');
-  let allCookies_TEST = await cookieStore.getAll('TEST');
-  assert_equals(
-      allCookies_TEST[0].name,
-      'TEST',
-      'First entry in allCookies_TEST should be named TEST');
-  assert_equals(
-      allCookies_TEST[0].value,
-      'value',
-      'First entry in allCookies_TEST should have value "value"');
-  assert_equals(
-      allCookies_TEST.length,
-      1,
-      'Only one cookie should exist in allCookies_TEST');
-  let firstCookie_TEST = await cookieStore.get('TEST');
-  assert_equals(
-      firstCookie_TEST.name,
-      'TEST',
-      'First TEST cookie should be named TEST');
-  assert_equals(
-      firstCookie_TEST.value,
-      'value',
-      'First TEST cookie should have value "value"');
-}, 'Get/set/get all cookies in store');
--- a/testing/web-platform/tests/cookie-store/resources/http_cookie_and_set_cookie_headers.js
+++ b/testing/web-platform/tests/cookie-store/resources/http_cookie_and_set_cookie_headers.js
@@ -11,63 +11,93 @@ cookie_test(async t => {
       await getCookieStringHttp(),
       'HTTP-🍪=🔵',
       'Cookie we wrote using HTTP in HTTP cookie jar');
   await verifyCookieChangeEvent(
     eventPromise, {changed: [{name: 'HTTP-🍪', value: '🔵'}]},
     'Cookie we wrote using HTTP is observed');
 
   eventPromise = observeNextCookieChangeEvent();
+  await setCookieStringHttp('HTTP-🍪=🔵🔵; path=/');
+  assert_equals(
+      await getCookieString(),
+      'HTTP-🍪=🔵🔵',
+      'Cookie we overwrote using HTTP in cookie jar');
+  assert_equals(
+      await getCookieStringHttp(),
+      'HTTP-🍪=🔵🔵',
+      'Cookie we overwrote using HTTP in HTTP cookie jar');
+  await verifyCookieChangeEvent(
+    eventPromise, {changed: [{name: 'HTTP-🍪', value: '🔵🔵'}]},
+    'Cookie we overwrote using HTTP is observed');
+
+  eventPromise = observeNextCookieChangeEvent();
   await setCookieStringHttp('HTTP-🍪=DELETED; path=/; max-age=0');
   assert_equals(
       await getCookieString(),
       undefined,
       'Empty cookie jar after HTTP cookie-clearing using max-age=0');
   assert_equals(
       await getCookieStringHttp(),
       undefined,
       'Empty HTTP cookie jar after HTTP cookie-clearing using max-age=0');
   await verifyCookieChangeEvent(
     eventPromise, {deleted: [{name: 'HTTP-🍪'}]},
     'Deletion observed after HTTP cookie-clearing using max-age=0');
   await cookieStore.delete('HTTP-🍪');
-}, 'Interoperability of HTTP Set-Cookie: with other APIs');
+}, 'HTTP set/overwrite/delete observed in CookieStore');
+
 
 cookie_test(async t => {
   let eventPromise = observeNextCookieChangeEvent();
-  await setCookieStringHttp('HTTPONLY-🍪=🔵; path=/; httponly');
+  await cookieStore.set('TEST', 'value0');
+  assert_equals(
+    await getCookieString(),
+    'TEST=value0',
+    'Cookie jar contains only cookie we set');
   assert_equals(
-      await getCookieString(),
-      undefined,
-      'HttpOnly cookie we wrote using HTTP in cookie jar' +
-        ' is invisible to script');
-  assert_equals(
-      await getCookieStringHttp(),
-      'HTTPONLY-🍪=🔵',
-    'HttpOnly cookie we wrote using HTTP in HTTP cookie jar');
+    await getCookieStringHttp(),
+    'TEST=value0',
+    'HTTP cookie jar contains only cookie we set');
+  await verifyCookieChangeEvent(
+    eventPromise,
+    {changed: [{name: 'TEST', value: 'value0'}]},
+    'Observed value that was set');
 
   eventPromise = observeNextCookieChangeEvent();
-  await setCookieStringHttp(
-      'HTTPONLY-🍪=DELETED; path=/; max-age=0; httponly');
+  await cookieStore.set('TEST', 'value');
   assert_equals(
-      await getCookieString(),
-      undefined,
-      'Empty cookie jar after HTTP cookie-clearing using max-age=0');
+    await getCookieString(),
+    'TEST=value',
+    'Cookie jar contains only cookie we set');
   assert_equals(
-      await getCookieStringHttp(),
-      undefined,
-      'Empty HTTP cookie jar after HTTP cookie-clearing using max-age=0');
+    await getCookieStringHttp(),
+    'TEST=value',
+    'HTTP cookie jar contains only cookie we set');
+  await verifyCookieChangeEvent(
+    eventPromise,
+    {changed: [{name: 'TEST', value: 'value'}]},
+    'Observed value that was overwritten');
 
-  // HTTPONLY cookie changes should not have been observed; perform
-  // a dummy change to verify that nothing else was queued up.
-  await cookieStore.set('TEST', 'dummy');
+  eventPromise = observeNextCookieChangeEvent();
+  await cookieStore.delete('TEST');
+  assert_equals(
+    await getCookieString(),
+    undefined,
+    'Cookie jar does not contain cookie we deleted');
+  assert_equals(
+    await getCookieStringHttp(),
+    undefined,
+    'HTTP cookie jar does not contain cookie we deleted');
   await verifyCookieChangeEvent(
-    eventPromise, {changed: [{name: 'TEST', value: 'dummy'}]},
-    'HttpOnly cookie deletion was not observed');
-}, 'HttpOnly cookies are not observed');
+    eventPromise,
+    {deleted: [{name: 'TEST'}]},
+    'Observed cookie that was deleted');
+}, 'CookieStore set/overwrite/delete observed in HTTP headers');
+
 
 cookie_test(async t => {
   // Non-UTF-8 byte sequences cause the Set-Cookie to be dropped.
   let eventPromise = observeNextCookieChangeEvent();
   await setCookieBinaryHttp(
       unescape(encodeURIComponent('HTTP-🍪=🔵')) + '\xef\xbf\xbd; path=/');
   assert_equals(
       await getCookieString(),
@@ -86,16 +116,39 @@ cookie_test(async t => {
       unescape(encodeURIComponent('HTTP-🍪=🔵')) + '\xef\xbf\xbd',
       'Binary cookie we wrote in binary HTTP cookie jar');
   await verifyCookieChangeEvent(
     eventPromise, {changed: [{name: 'HTTP-🍪', value: '🔵\ufffd'}]},
     'Binary cookie we wrote using HTTP is observed');
 
   eventPromise = observeNextCookieChangeEvent();
   await setCookieBinaryHttp(
+      unescape(encodeURIComponent('HTTP-🍪=🔵🔵')) + '\xef\xbf\xbd; path=/');
+  assert_equals(
+      await getCookieString(),
+      'HTTP-🍪=🔵🔵\ufffd',
+      'Binary cookie we overwrote using HTTP in cookie jar');
+  assert_equals(
+      await getCookieStringHttp(),
+      'HTTP-🍪=🔵🔵\ufffd',
+      'Binary cookie we overwrote using HTTP in HTTP cookie jar');
+  assert_equals(
+      decodeURIComponent(escape(await getCookieBinaryHttp())),
+      'HTTP-🍪=🔵🔵\ufffd',
+      'Binary cookie we overwrote in binary HTTP cookie jar');
+  assert_equals(
+      await getCookieBinaryHttp(),
+      unescape(encodeURIComponent('HTTP-🍪=🔵🔵')) + '\xef\xbf\xbd',
+      'Binary cookie we overwrote in binary HTTP cookie jar');
+  await verifyCookieChangeEvent(
+    eventPromise, {changed: [{name: 'HTTP-🍪', value: '🔵🔵\ufffd'}]},
+    'Binary cookie we overwrote using HTTP is observed');
+
+  eventPromise = observeNextCookieChangeEvent();
+  await setCookieBinaryHttp(
       unescape(encodeURIComponent('HTTP-🍪=DELETED; path=/; max-age=0')));
   assert_equals(
       await getCookieString(),
       undefined,
       'Empty cookie jar after binary HTTP cookie-clearing using max-age=0');
   assert_equals(
       await getCookieStringHttp(),
       undefined,
@@ -104,9 +157,9 @@ cookie_test(async t => {
   assert_equals(
       await getCookieBinaryHttp(),
       undefined,
       'Empty binary HTTP cookie jar after' +
         ' binary HTTP cookie-clearing using max-age=0');
   await verifyCookieChangeEvent(
     eventPromise, {deleted: [{name: 'HTTP-🍪'}]},
     'Deletion observed after binary HTTP cookie-clearing using max-age=0');
-}, 'Binary HTTP cookies');
+}, 'Binary HTTP set/overwrite/delete observed in CookieStore');