[Security] Fix WPTs that are wrong or with undeterministic failure output

This fixes three tests:
  - blob-popup.https.html checked for a random string to be empty,
  which makes test expectations unreliable, use length instead.
  - coop-navigated-popup.https.html had a failure in the cleanup, trying
  to use a non-existent object. This change defines the broadcast channel
  beforehand and uses the proper variable name.
  - historical/coep-navigate-popup-unsafe-inherit.https.html had an
  invalid expectation that navigating a popup from a COOP: same-origin
  document to a COOP: unsafe-none document should not create a new
  browsing context group.

Bug: 922191
Change-Id: Ife24aee4369a3a25bbff32a2fe5e8c29abb2d468
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2030902
Commit-Queue: Pâris Meuleman <pmeuleman@chromium.org>
Auto-Submit: Pâris Meuleman <pmeuleman@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Arthur Hemery <ahemery@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737734}
diff --git a/html/cross-origin-opener-policy/blob-popup.https.html b/html/cross-origin-opener-policy/blob-popup.https.html
index a4e53e7..a26520d 100644
--- a/html/cross-origin-opener-policy/blob-popup.https.html
+++ b/html/cross-origin-opener-policy/blob-popup.https.html
@@ -11,7 +11,7 @@
 
   const bc = new BroadcastChannel(token());
   bc.onmessage = t.step_func_done(({ data }) => {
-    assert_equals(data.name, "");
+    assert_equals(data.name.length, 0);
     assert_false(data.opener);
     assert_true(furtherPopup.closed);
     assert_equals(furtherPopup.document.URL, "about:blank");
diff --git a/html/cross-origin-opener-policy/coop-navigated-popup.https.html b/html/cross-origin-opener-policy/coop-navigated-popup.https.html
index e174193..ef610a4 100644
--- a/html/cross-origin-opener-policy/coop-navigated-popup.https.html
+++ b/html/cross-origin-opener-policy/coop-navigated-popup.https.html
@@ -12,16 +12,16 @@
   const noCOOP = "/common/blank.html";
   const popupName = token();
   const popup = window.open(noCOOP, popupName);
+  const channel = new BroadcastChannel(token());
   // Close the popup once the test is complete.
   // The browsing context is closed after the navigation hence use the broadcast channel
   // to trigger the closure.
   t.add_cleanup(() => {
-    bc.postMessage("close");
+    channel.postMessage("close");
   });
   popup.onload = t.step_func(() => {
     assert_equals(popup.name, popupName);
     assert_equals(new URL(popup.document.URL).pathname, noCOOP);
-    const channel = new BroadcastChannel(token());
     channel.onmessage = t.step_func_done(event => {
       const payload = event.data;
       // The name should be empty, but we're checking the length rather than a
diff --git a/html/cross-origin-opener-policy/historical/coep-navigate-popup-unsafe-inherit.https.html b/html/cross-origin-opener-policy/historical/coep-navigate-popup-unsafe-inherit.https.html
index c389058..21feef7 100644
--- a/html/cross-origin-opener-policy/historical/coep-navigate-popup-unsafe-inherit.https.html
+++ b/html/cross-origin-opener-policy/historical/coep-navigate-popup-unsafe-inherit.https.html
@@ -11,7 +11,7 @@
     "title": "coop unsafe-inherit/coep",
     "coop": "unsafe-inherit", // historical value, equivalent to "unsafe-none"
     "coep": "require-corp",
-    "opener": true
+    "opener": false
   },
   {
     "title": "coop unsafe-inherit/no coep",