chromium/chrome/browser/enterprise/connectors/device_trust/key_management/browser/commands/linux_key_rotation_command_unittest.cc

// 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.

#include "chrome/browser/enterprise/connectors/device_trust/key_management/browser/commands/linux_key_rotation_command.h"

#include <string>
#include <string_view>
#include <utility>

#include "base/base64.h"
#include "base/base_paths.h"
#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/memory/scoped_refptr.h"
#include "base/path_service.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/mock_callback.h"
#include "base/test/multiprocess_test.h"
#include "base/test/scoped_path_override.h"
#include "base/test/task_environment.h"
#include "base/test/test_future.h"
#include "base/threading/platform_thread.h"
#include "chrome/browser/enterprise/connectors/device_trust/key_management/browser/commands/metrics_utils.h"
#include "chrome/browser/enterprise/connectors/device_trust/key_management/core/shared_command_constants.h"
#include "mojo/public/cpp/platform/platform_channel.h"
#include "mojo/public/cpp/system/invitation.h"
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/test/test_url_loader_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/multiprocess_func_list.h"

_;

namespace enterprise_connectors {

namespace {

constexpr char kExitCodeHistogram[] =;

constexpr char kNonce[] =;

constexpr char kFakeDMToken[] =;

constexpr char kFakeDmServerUrl[] =;

static constexpr const char* kSwitches[] =;

base::FilePath GetBinaryFilePath() {}

}  // namespace

class LinuxKeyRotationCommandTest : public testing::Test {};

// Tests for the key mojo invitation where the chrome management service
// process successfully accepted the mojo invitation and connected to the
// url_loader_factory.
MULTIPROCESS_TEST_MAIN(MojoInvitation) {}

TEST_F(LinuxKeyRotationCommandTest, MojoAcceptInvitation) {}

// Tests for a key rotation when the chrome management service succeeded.
MULTIPROCESS_TEST_MAIN(Success) {}

TEST_F(LinuxKeyRotationCommandTest, RotateSuccess) {}

// Tests for a key rotation failure when the chrome management service failed.
MULTIPROCESS_TEST_MAIN(Failure) {}

TEST_F(LinuxKeyRotationCommandTest, RotateFailure) {}

// Tests for a key rotation failure when the chrome management service failed
// with an unknown error.
MULTIPROCESS_TEST_MAIN(UnknownFailure) {}

TEST_F(LinuxKeyRotationCommandTest, RotateFailure_UnknownError) {}

// Tests for a key rotation failure when an invalid process was launched.
TEST_F(LinuxKeyRotationCommandTest, RotateFailureInvalidProcess) {}

// Tests that the correct histogram is populated when the LogExitCode method
// receives a negative exit code.
TEST_F(LinuxKeyRotationCommandTest, NegativeExitCode) {}

// Tests that the command will fail with the expected message when the
// management service binary is not found.
TEST_F(LinuxKeyRotationCommandTest, MissingServiceBinary) {}

}  // namespace enterprise_connectors