chromium/services/service_manager/tests/service_manager/service_manager_unittest.cc

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

#include <stddef.h>
#include <stdint.h>

#include <memory>
#include <utility>

#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/ptr_util.h"
#include "base/path_service.h"
#include "base/process/process.h"
#include "base/process/process_handle.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/task_environment.h"
#include "base/token.h"
#include "build/build_config.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/platform/platform_channel.h"
#include "mojo/public/cpp/platform/platform_handle.h"
#include "mojo/public/cpp/system/invitation.h"
#include "services/service_manager/public/cpp/binder_registry.h"
#include "services/service_manager/public/cpp/constants.h"
#include "services/service_manager/public/cpp/service.h"
#include "services/service_manager/public/cpp/service_receiver.h"
#include "services/service_manager/public/cpp/test/test_service_manager.h"
#include "services/service_manager/public/mojom/service_manager.mojom.h"
#include "services/service_manager/service_process_launcher.h"
#include "services/service_manager/tests/service_manager/service_manager.test-mojom.h"
#include "services/service_manager/tests/service_manager/test_manifests.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace service_manager {

namespace {

void OnServiceStartedCallback(int* start_count,
                              std::string* service_name,
                              base::OnceClosure continuation,
                              const service_manager::Identity& identity) {}

void OnServiceFailedToStartCallback(bool* run,
                                    base::OnceClosure continuation,
                                    const service_manager::Identity& identity) {}

void OnServicePIDReceivedCallback(std::string* service_name,
                                  uint32_t* service_pid,
                                  base::OnceClosure continuation,
                                  const service_manager::Identity& identity,
                                  uint32_t pid) {}

class TestService : public Service, public test::mojom::CreateInstanceTest {};

class SimpleService : public Service {};

}  // namespace

class ServiceManagerTest : public testing::Test,
                           public mojom::ServiceManagerListener {};

TEST_F(ServiceManagerTest, CreateInstance) {}

// Tests that starting a regular packaged service works, and that when starting
// the service again, a new service is created unless the same user ID and
// instance names are used.
TEST_F(ServiceManagerTest, CreatePackagedRegularInstances) {}

// Tests that starting a shared instance packaged service works, and that when
// starting that service again, a new service is created only when a different
// instance name is specified.
TEST_F(ServiceManagerTest, CreatePackagedSharedAcrossGroupsInstances) {}

// Tests that creating a singleton packaged service works, and that when
// starting that service again a new service is never created.
TEST_F(ServiceManagerTest, CreatePackagedSingletonInstances) {}

TEST_F(ServiceManagerTest, PIDReceivedCallback) {}

TEST_F(ServiceManagerTest, ClientProcessCapabilityEnforced) {}

TEST_F(ServiceManagerTest, ClonesDisconnectedConnectors) {}

}  // namespace service_manager