chromium/chrome/test/data/extensions/api_test/service_worker/registration/ntp_extension/extension_version_2/background.js

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

self.currentVersion = 2;

chrome.runtime.onInstalled.addListener((details) => {
  chrome.test.sendMessage('v' + self.currentVersion + ' installed');
});

// Respond with the version of the background context.
chrome.runtime.onMessage.addListener(
  (message, sender, sendResponse) => {
  if (message == 'get-current-version') {
    sendResponse(self.currentVersion);
  }
});