chromium/chrome/browser/web_applications/test/fake_web_contents_manager.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/test/fake_web_contents_manager.h"

#include <memory>
#include <optional>
#include <string_view>

#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/weak_ptr.h"
#include "base/sequence_checker.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/web_applications/web_app_helpers.h"
#include "chrome/browser/web_applications/web_app_install_info.h"
#include "chrome/browser/web_applications/web_app_install_utils.h"
#include "chrome/browser/web_applications/web_contents/web_app_data_retriever.h"
#include "chrome/browser/web_applications/web_contents/web_app_icon_downloader.h"
#include "components/webapps/browser/web_contents/web_app_url_loader.h"
#include "components/webapps/common/web_page_metadata.mojom.h"
#include "content/public/browser/web_contents.h"
#include "third_party/blink/public/mojom/manifest/manifest.mojom.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "url/url_constants.h"

namespace web_app {
namespace {
bool EqualsWithComparison(
    const GURL& a,
    const GURL& b,
    webapps::WebAppUrlLoader::UrlComparison url_comparison) {}
}  // namespace

// TODO(http://b/262606416): Replace FakeWebAppUrlLoader with this by redoing
// how the web contents dependency is wrapped.
class FakeWebContentsManager::FakeUrlLoader : public webapps::WebAppUrlLoader {};

class FakeWebContentsManager::FakeWebAppIconDownloader
    : public WebAppIconDownloader {};

// TODO(http://b/262606416): Replace FakeDataRetriever with this by redoing
// how the web contents dependency is wrapped.
class FakeWebContentsManager::FakeWebAppDataRetriever
    : public WebAppDataRetriever {};

// static
webapps::mojom::WebPageMetadataPtr
FakeWebContentsManager::CreateMetadataWithTitle(std::u16string title) {}

// static
webapps::mojom::WebPageMetadataPtr
FakeWebContentsManager::CreateMetadataWithIconAndTitle(std::u16string title,
                                                       GURL document_icon_url,
                                                       int32_t icon_size) {}

FakeWebContentsManager::FakePageState::FakePageState() = default;
FakeWebContentsManager::FakePageState::~FakePageState() = default;
FakeWebContentsManager::FakePageState::FakePageState(FakePageState&&) = default;
FakeWebContentsManager::FakePageState&
FakeWebContentsManager::FakePageState::operator=(FakePageState&&) = default;

FakeWebContentsManager::FakeIconState::FakeIconState() = default;
FakeWebContentsManager::FakeIconState::~FakeIconState() = default;

FakeWebContentsManager::FakeWebContentsManager() = default;
FakeWebContentsManager::~FakeWebContentsManager() = default;

void FakeWebContentsManager::SetUrlLoaded(content::WebContents* web_contents,
                                          const GURL& url) {}

std::unique_ptr<webapps::WebAppUrlLoader>
FakeWebContentsManager::CreateUrlLoader() {}

std::unique_ptr<WebAppDataRetriever>
FakeWebContentsManager::CreateDataRetriever() {}

std::unique_ptr<WebAppIconDownloader>
FakeWebContentsManager::CreateIconDownloader() {}

void FakeWebContentsManager::SetIconState(
    const GURL& icon_url,
    const FakeWebContentsManager::FakeIconState& icon_state) {}
FakeWebContentsManager::FakeIconState&
FakeWebContentsManager::GetOrCreateIconState(const GURL& icon_url) {}
void FakeWebContentsManager::DeleteIconState(const GURL& icon_url) {}

webapps::AppId FakeWebContentsManager::CreateBasicInstallPageState(
    const GURL& install_url,
    const GURL& manifest_url,
    const GURL& start_url,
    std::u16string_view name) {}

void FakeWebContentsManager::SetPageState(
    const GURL& gurl,
    FakeWebContentsManager::FakePageState page_state) {}
FakeWebContentsManager::FakePageState&
FakeWebContentsManager::GetOrCreatePageState(const GURL& gurl) {}
void FakeWebContentsManager::DeletePageState(const GURL& gurl) {}

bool FakeWebContentsManager::HasPageState(const GURL& gurl) {}

void FakeWebContentsManager::TrackLoadUrlCalls(
    LoadUrlTracker load_url_tracker) {}

base::WeakPtr<FakeWebContentsManager> FakeWebContentsManager::GetWeakPtr() {}

}  // namespace web_app