chromium/chrome/browser/web_applications/isolated_web_apps/test/test_signed_web_bundle_builder.cc

// Copyright 2023 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/web_applications/isolated_web_apps/test/test_signed_web_bundle_builder.h"

#include <memory>
#include <string_view>
#include <vector>

#include "base/files/file_enumerator.h"
#include "base/files/file_util.h"
#include "base/threading/thread_restrictions.h"
#include "base/version.h"
#include "chrome/browser/web_applications/test/web_app_icon_test_utils.h"
#include "components/web_package/test_support/signed_web_bundles/web_bundle_signer.h"
#include "components/web_package/web_bundle_builder.h"
#include "net/base/mime_util.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/skia/include/core/SkStream.h"
#include "third_party/skia/include/encode/SkPngEncoder.h"

namespace web_app {

namespace {
constexpr std::string_view kTestManifest =;

constexpr std::array<uint8_t, 32> kEd25519PublicKey =;

constexpr std::array<uint8_t, 64> kEd25519PrivateKey =;

constexpr std::array<uint8_t, 33> kEcdsaP256PublicKey =;

constexpr std::array<uint8_t, 32> kEcdsaP256PrivateKey =;

// Returns the value of `web_bundle_id` if specified, or generates a fallback ID
// from `key_pair`'s public key.
web_package::SignedWebBundleId GetWebBundleIdWithFallback(
    const std::optional<web_package::SignedWebBundleId>& web_bundle_id,
    const web_package::test::KeyPair& key_pair) {}
}  // namespace

namespace test {

std::string EncodeAsPng(const SkBitmap& bitmap) {}

web_package::test::Ed25519KeyPair GetDefaultEd25519KeyPair() {}

web_package::SignedWebBundleId GetDefaultEd25519WebBundleId() {}

web_package::test::EcdsaP256KeyPair GetDefaultEcdsaP256KeyPair() {}

web_package::SignedWebBundleId GetDefaultEcdsaP256WebBundleId() {}

}  // namespace test

TestSignedWebBundle::TestSignedWebBundle(
    std::vector<uint8_t> data,
    const web_package::SignedWebBundleId& id)
    :{}

TestSignedWebBundle::TestSignedWebBundle(const TestSignedWebBundle&) = default;

TestSignedWebBundle::TestSignedWebBundle(TestSignedWebBundle&&) = default;

TestSignedWebBundle::~TestSignedWebBundle() = default;

TestSignedWebBundleBuilder::TestSignedWebBundleBuilder(
    web_package::test::KeyPair key_pair,
    web_package::test::WebBundleSigner::ErrorsForTesting errors_for_testing)
    :{}

TestSignedWebBundleBuilder::TestSignedWebBundleBuilder(
    web_package::test::KeyPairs key_pairs,
    const web_package::SignedWebBundleId& web_bundle_id,
    web_package::test::WebBundleSigner::ErrorsForTesting errors_for_testing)
    :{}

TestSignedWebBundleBuilder::~TestSignedWebBundleBuilder() = default;

TestSignedWebBundleBuilder::BuildOptions::BuildOptions()
    :{}

TestSignedWebBundleBuilder::BuildOptions::BuildOptions(const BuildOptions&) =
    default;
TestSignedWebBundleBuilder::BuildOptions::BuildOptions(BuildOptions&&) =
    default;
TestSignedWebBundleBuilder::BuildOptions::~BuildOptions() = default;

void TestSignedWebBundleBuilder::AddManifest(std::string_view manifest_string) {}

void TestSignedWebBundleBuilder::AddPngImage(std::string_view url,
                                             std::string_view image_string) {}

void TestSignedWebBundleBuilder::AddHtml(std::string_view url,
                                         std::string_view html_content) {}

void TestSignedWebBundleBuilder::AddJavaScript(
    std::string_view url,
    std::string_view script_content) {}

void TestSignedWebBundleBuilder::AddFilesFromFolder(
    const base::FilePath& folder) {}

void TestSignedWebBundleBuilder::AddPrimaryUrl(GURL url) {}

TestSignedWebBundle TestSignedWebBundleBuilder::Build() {}

TestSignedWebBundle TestSignedWebBundleBuilder::BuildDefault(
    BuildOptions build_options) {}

}  // namespace web_app