chromium/components/component_updater/component_updater_service_unittest.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/component_updater/component_updater_service.h"

#include <algorithm>
#include <cstdint>
#include <memory>
#include <string>
#include <utility>
#include <vector>

#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
#include "base/task/sequenced_task_runner.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/task_environment.h"
#include "base/values.h"
#include "build/branding_buildflags.h"
#include "components/component_updater/component_updater_service_internal.h"
#include "components/prefs/testing_pref_service.h"
#include "components/update_client/crx_update_item.h"
#include "components/update_client/test_configurator.h"
#include "components/update_client/test_installer.h"
#include "components/update_client/update_client.h"
#include "components/update_client/update_client_errors.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

Configurator;
Result;
TestConfigurator;
UpdateClient;

_;
AnyNumber;
Invoke;
Mock;
Return;
Unused;

namespace component_updater {

class MockInstaller : public update_client::CrxInstaller {};

class MockUpdateClient : public UpdateClient {};

class MockServiceObserver : public ServiceObserver {};

class MockUpdateScheduler : public UpdateScheduler {};

class LoopHandler {};

class ComponentUpdaterTest : public testing::Test {};

class OnDemandTester {};

void OnDemandTester::OnDemand(ComponentUpdateService* cus,
                              const std::string& id,
                              OnDemandUpdater::Priority priority) {}

void OnDemandTester::OnDemandComplete(update_client::Error error) {}

std::unique_ptr<ComponentUpdateService> TestComponentUpdateServiceFactory(
    scoped_refptr<Configurator> config) {}

ComponentUpdaterTest::ComponentUpdaterTest() {}

ComponentUpdaterTest::~ComponentUpdaterTest() {}

void ComponentUpdaterTest::RunThreads() {}

void ComponentUpdaterTest::RunUpdateTask(
    const UpdateScheduler::UserTask& user_task) {}

void ComponentUpdaterTest::Schedule(
    const base::TimeDelta& initial_delay,
    const base::TimeDelta& delay,
    const UpdateScheduler::UserTask& user_task,
    const UpdateScheduler::OnStopTaskCallback& on_stop) {}

TEST_F(ComponentUpdaterTest, AddObserver) {}

TEST_F(ComponentUpdaterTest, RemoveObserver) {}

// Tests that UpdateClient::Update is called by the timer loop when
// components are registered, and the component update starts.
// Also tests that Uninstall is called when a component is unregistered.
TEST_F(ComponentUpdaterTest, RegisterComponent) {}

// Tests that on-demand updates invoke UpdateClient::Install.
TEST_F(ComponentUpdaterTest, OnDemandUpdate) {}

// Tests that throttling an update invokes UpdateClient::Install.
TEST_F(ComponentUpdaterTest, MaybeThrottle) {}

TEST_F(ComponentUpdaterTest, ComponentDetails) {}

TEST_F(ComponentUpdaterTest, UpdatesDisabled) {}

}  // namespace component_updater