chromium/components/offline_items_collection/core/offline_content_aggregator_unittest.cc

// Copyright 2017 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/offline_items_collection/core/offline_content_aggregator.h"

#include <map>

#include "base/functional/bind.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h"
#include "base/test/test_mock_time_task_runner.h"
#include "components/offline_items_collection/core/offline_item.h"
#include "components/offline_items_collection/core/test_support/mock_offline_content_provider.h"
#include "components/offline_items_collection/core/test_support/scoped_mock_offline_content_provider.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

_;
ContainerEq;
Eq;
Return;

namespace offline_items_collection {
namespace {

GetVisualsOptions;

struct CompareOfflineItemsById {};

// A custom comparator that makes sure two vectors contain the same elements.
// TODO(dtrainor): Look into building a better matcher that works with gmock.
template <typename T>
bool VectorContentsEq(const std::vector<T>& list1,
                      const std::vector<T>& list2) {}

MATCHER_P(OpenParamsEqual, params, "") {}

// Helper class that automatically unregisters itself from the aggregator in the
// case that someone calls OpenItem on it.
class OpenItemRemovalOfflineContentProvider
    : public ScopedMockOfflineContentProvider {};

// A helper class that delays GetAllItems() callback until RunCallback()
// is called.
class DelayedGetAllItemOfflineContentProvider
    : public ScopedMockOfflineContentProvider {};

class OfflineContentAggregatorTest : public testing::Test {};

void OfflineContentAggregatorTest::GetAllItemsAndVerify(
    OfflineContentProvider* provider,
    const OfflineContentProvider::OfflineItemList& expected) {}

void OfflineContentAggregatorTest::GetSingleItemAndVerify(
    OfflineContentProvider* provider,
    const ContentId& id,
    const std::optional<OfflineItem>& expected) {}

TEST_F(OfflineContentAggregatorTest, QueryingItemsWith2Providers) {}

TEST_F(OfflineContentAggregatorTest, QueryingItemFromRemovedProvider) {}

TEST_F(OfflineContentAggregatorTest, GetItemByIdPropagatesToRightProvider) {}

TEST_F(OfflineContentAggregatorTest, ActionPropagatesToRightProvider) {}

TEST_F(OfflineContentAggregatorTest, ActionPropagatesImmediately) {}

TEST_F(OfflineContentAggregatorTest, OnItemsAddedPropagatedToObservers) {}

TEST_F(OfflineContentAggregatorTest, OnItemRemovedPropagatedToObservers) {}

TEST_F(OfflineContentAggregatorTest, OnItemUpdatedPropagatedToObservers) {}

TEST_F(OfflineContentAggregatorTest, ProviderRemovedDuringCallbackFlush) {}

TEST_F(OfflineContentAggregatorTest, SameProviderWithMultipleNamespaces) {}

// Tests that if the aggregator is in the mid of GetAllItems() call and is
// waiting from multiple providers, it will remove deleted items from its
// response when notified.
TEST_F(OfflineContentAggregatorTest,
       ItemRemovedWhileWaitingForItemsFromOtherProviders) {}

// Tests that if the aggregator is in the mid of GetAllItems() call and is
// waiting from multiple providers, it will properly update items in its
// response when notified.
TEST_F(OfflineContentAggregatorTest,
       ItemUpdatedWhileWaitingForItemsFromOtherProviders) {}

}  // namespace
}  // namespace offline_items_collection