Make schemeful websocket test more robust

This change makes the regexp more strict and cleans up the test's
cookies when finished.

Bug: 1141450
Change-Id: I706e42f321f4dbcc58931634356bab2b1e56fb05
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2492240
Commit-Queue: Steven Bingler <bingler@chromium.org>
Reviewed-by: Mike West <mkwst@chromium.org>
Cr-Commit-Position: refs/heads/master@{#819880}
diff --git a/cookies/schemeful-same-site/schemeful-websockets.sub.tentative.html b/cookies/schemeful-same-site/schemeful-websockets.sub.tentative.html
index 8e7c073..2626d1c 100644
--- a/cookies/schemeful-same-site/schemeful-websockets.sub.tentative.html
+++ b/cookies/schemeful-same-site/schemeful-websockets.sub.tentative.html
@@ -5,6 +5,7 @@
   <script src="/resources/testharness.js"></script>
   <script src="/resources/testharnessreport.js"></script>
   <script src="/cookies/resources/testharness-helpers.js"></script>
+  <script src="/cookies/resources/cookie-helper.sub.js"></script>
 </head>
 <body>
 <div id=log></div>
@@ -12,6 +13,11 @@
   async_test(function (t) {
     document.cookie = `samesite_strict=1; sameSite=strict; path=/`;
     document.cookie = `samesite_lax=1; sameSite=lax; path=/`;
+    t.add_cleanup(function() {
+      credFetch(origin + "/cookies/resources/drop.py?name=" + "samesite_strict");
+      credFetch(origin + "/cookies/resources/drop.py?name=" + "samesite_lax");
+    });
+
 
     var ws = new WebSocket("ws://{{host}}:{{ports[ws][0]}}/echo-cookie");
     ws.onclose = t.step_func_done(function () {
@@ -32,10 +38,9 @@
         ws2.onclose = null;
         ws2.close();
         // Cross-scheme WebSockets shouldn't get anything.
-        assert_regexp_match(e2.data, /(none)/, "Cross-scheme");
+        assert_regexp_match(e2.data, /^\(none\)$/, "Cross-scheme");
       });
     });
-
   }, "Cross-scheme WebSockets are cross-site");
 </script>
 </body>