chromium/content/public/test/embedded_worker_instance_test_harness.h

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

#ifndef CONTENT_PUBLIC_TEST_EMBEDDED_WORKER_INSTANCE_TEST_HARNESS_H_
#define CONTENT_PUBLIC_TEST_EMBEDDED_WORKER_INSTANCE_TEST_HARNESS_H_

#include <stdint.h>

#include "browser_task_environment.h"
#include "content/public/browser/browser_context.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/hid/hid.mojom.h"
#include "third_party/blink/public/mojom/usb/web_usb_service.mojom.h"

namespace content {

class EmbeddedWorkerInstance;
class EmbeddedWorkerTestHelper;
class ServiceWorkerVersion;

// EmbeddedWorkerInstanceTestHarness provides helper functions to set up a test
// environment with an EmbeddedWorkerInstance, and allow a test to test the
// worker with bound services.
//
// Example:
//
//  class MyWorkerTest : public EmbeddedWorkerInstanceTestHarness {
//    std::unique_ptr<BrowserContext> CreateBrowserContext() override {
//      // Create the BrowserContext and store the raw pointer
//      // to the created BrowserContext.
//      ...
//    }
//  };
//
//  CreateAndStartWorker(); //  Create and start a worker!
//
//  mojo::Remote<Xyz> xyz_service;
//  // Note a new binding function might need to be added to this harness file
//  // if that is not available.
//  BindXyzServiceToWorker(origin, xyz_service.BindNewPipeAndPassReceiver()));
//  xyz_service->DoSomething();
//
//  StopAndResetWorker();  // Stop and delete the worker!

class EmbeddedWorkerInstanceTestHarness : public testing::Test {};

}  // namespace content

#endif  // CONTENT_PUBLIC_TEST_EMBEDDED_WORKER_INSTANCE_TEST_HARNESS_H_