chromium/components/history/core/test/fake_web_history_service.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 "components/history/core/test/fake_web_history_service.h"

#include <stdint.h>

#include <algorithm>
#include <memory>

#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/time/time.h"
#include "components/sync/protocol/history_status.pb.h"
#include "net/base/url_util.h"
#include "net/http/http_status_code.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"

namespace history {

// FakeRequest -----------------------------------------------------------------

namespace {

// TODO(msramek): Find a way to keep these URLs in sync with what is used
// in WebHistoryService.

const char kLookupUrl[] =;

const char kDeleteUrl[] =;

const char kChromeClient[] =;

const char kWebAndAppClient[] =;

const char kSyncServerHost[] =;

}  // namespace

class FakeWebHistoryService::FakeRequest : public WebHistoryService::Request {};

FakeWebHistoryService::FakeRequest::FakeRequest(
    FakeWebHistoryService* service,
    const GURL& url,
    bool emulate_success,
    int emulate_response_code,
    WebHistoryService::CompletionCallback callback,
    base::Time begin,
    base::Time end,
    int max_count)
    :{}

bool FakeWebHistoryService::FakeRequest::IsPending() {}

int FakeWebHistoryService::FakeRequest::GetResponseCode() {}

const std::string& FakeWebHistoryService::FakeRequest::GetResponseBody() {}

void FakeWebHistoryService::FakeRequest::SetPostData(
    const std::string& post_data) {}

void FakeWebHistoryService::FakeRequest::SetPostDataAndType(
    const std::string& post_data,
    const std::string& mime_type) {}

void FakeWebHistoryService::FakeRequest::SetUserAgent(
    const std::string& user_agent) {}

void FakeWebHistoryService::FakeRequest::Start() {}

// FakeWebHistoryService -------------------------------------------------------

FakeWebHistoryService::FakeWebHistoryService()
    // NOTE: Simply pass null object for IdentityManager. WebHistoryService's
    // only usage of this object is to fetch access tokens via RequestImpl, and
    // FakeWebHistoryService deliberately replaces this flow with
    // FakeWebHistoryService::FakeRequest.
    :{}

FakeWebHistoryService::~FakeWebHistoryService() {}

void FakeWebHistoryService::SetupFakeResponse(
    bool emulate_success, int emulate_response_code) {}

void FakeWebHistoryService::AddSyncedVisit(const std::string& url,
                                           base::Time timestamp,
                                           const std::string& icon_url) {}

void FakeWebHistoryService::ClearSyncedVisits() {}

std::vector<FakeWebHistoryService::Visit>
FakeWebHistoryService::GetVisitsBetween(base::Time begin,
                                        base::Time end,
                                        size_t count,
                                        bool* more_results_left) {}

base::Time FakeWebHistoryService::GetTimeForKeyInQuery(
    const GURL& url, const std::string& key) {}

FakeWebHistoryService::Request* FakeWebHistoryService::CreateRequest(
    const GURL& url,
    CompletionCallback callback,
    const net::PartialNetworkTrafficAnnotationTag& partial_traffic_annotation) {}

bool FakeWebHistoryService::IsWebAndAppActivityEnabled() {}

void FakeWebHistoryService::SetWebAndAppActivityEnabled(bool enabled) {}

bool FakeWebHistoryService::AreOtherFormsOfBrowsingHistoryPresent() {}

void FakeWebHistoryService::SetOtherFormsOfBrowsingHistoryPresent(
    bool present) {}

FakeWebHistoryService::Visit::Visit(const std::string& url,
                                    base::Time timestamp,
                                    const std::string& icon_url)
    :{}

}  // namespace history