chromium/chrome/updater/device_management/dm_policy_builder_for_testing.cc

// Copyright 2020 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/updater/device_management/dm_policy_builder_for_testing.h"

#include <stdint.h>

#include <memory>
#include <string>
#include <utility>

#include "base/logging.h"
#include "base/time/time.h"
#include "chrome/updater/protos/omaha_settings.pb.h"
#include "chrome/updater/test/unit_test_util.h"
#include "components/policy/proto/device_management_backend.pb.h"
#include "crypto/rsa_private_key.h"
#include "crypto/signature_creator.h"

namespace updater {

namespace {

// A test signing key raw bytes in DER-encoded PKCS8 format.
const uint8_t kSigningKey1[] =;

// SHA256 signature of kSigningKey for "example.com" domain.
const uint8_t kSigningKey1Signature[] =;

// Another (new) test signing key raw bytes in DER-encoded PKCS8 format.
const uint8_t kSigningKey2[] =;

// SHA256 signature of kSigningKey2 for "example.com" domain.
const uint8_t kSigningKey2Signature[] =;

}  // namespace

std::unique_ptr<DMSigningKeyForTesting> GetTestKey1() {}

std::unique_ptr<DMSigningKeyForTesting> GetTestKey2() {}

std::unique_ptr<
    ::wireless_android_enterprise_devicemanagement::OmahaSettingsClientProto>
GetDefaultTestingOmahaPolicyProto() {}

std::unique_ptr<::enterprise_management::DeviceManagementResponse>
GetDMResponseForOmahaPolicy(
    bool first_request,
    bool rotate_to_new_key,
    DMPolicyBuilderForTesting::SigningOption signing_option,
    const std::string& dm_token,
    const std::string& device_id,
    const ::wireless_android_enterprise_devicemanagement::
        OmahaSettingsClientProto& omaha_settings) {}

std::unique_ptr<::enterprise_management::DeviceManagementResponse>
GetDefaultTestingPolicyFetchDMResponse(
    bool first_request,
    bool rotate_to_new_key,
    DMPolicyBuilderForTesting::SigningOption signing_option) {}

DMSigningKeyForTesting::DMSigningKeyForTesting(const uint8_t key_data[],
                                               size_t key_data_length,
                                               const uint8_t key_signature[],
                                               size_t key_signature_length,
                                               int key_version,
                                               const std::string& domain)
    :{}

DMSigningKeyForTesting::~DMSigningKeyForTesting() = default;

std::string DMSigningKeyForTesting::GetPublicKeyString() const {}

void DMSigningKeyForTesting::SignData(const std::string& data,
                                      std::string* signature) const {}

DMPolicyBuilderForTesting::DMPolicyBuilderForTesting(
    const std::string& dm_token,
    const std::string& user_name,
    const std::string& device_id,
    std::unique_ptr<DMSigningKeyForTesting> signing_key,
    std::unique_ptr<DMSigningKeyForTesting> new_signing_key,
    SigningOption signing_option)
    :{}

DMPolicyBuilderForTesting::~DMPolicyBuilderForTesting() = default;

// static
std::unique_ptr<DMPolicyBuilderForTesting>
DMPolicyBuilderForTesting::CreateInstanceWithOptions(
    bool first_request,
    bool rotate_to_new_key,
    SigningOption signing_option,
    const std::string& dm_token,
    const std::string& device_id) {}

void DMPolicyBuilderForTesting::FillPolicyFetchResponseWithPayload(
    enterprise_management::PolicyFetchResponse* policy_response,
    const std::string& policy_type,
    const std::string& policy_payload,
    bool attach_new_public_key) const {}

std::string DMPolicyBuilderForTesting::GetResponseBlobForPolicyPayload(
    const std::string& policy_type,
    const std::string& policy_payload) const {}

std::unique_ptr<::enterprise_management::DeviceManagementResponse>
DMPolicyBuilderForTesting::BuildDMResponseForPolicies(
    const base::flat_map<std::string, std::string>& policies) const {}

std::unique_ptr<::enterprise_management::DeviceManagementResponse>
DMPolicyBuilderForTesting::BuildDMResponseWithError(
    ::enterprise_management::DeviceManagementErrorDetail error) const {}

}  // namespace updater