chromium/chrome/test/data/extensions/api_test/service_worker/messaging/connect_to_worker/connect_and_disconnect/content_script.js

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

var port = chrome.runtime.connect();
port.onMessage.addListener(msg => {
  // Expect no messages from the extension SW.
  chrome.test.fail();
});
port.disconnect();