chromium/chrome/browser/notifications/scheduler/internal/impression_history_tracker_unittest.cc

// Copyright 2019 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/notifications/scheduler/internal/impression_history_tracker.h"

#include <memory>
#include <utility>
#include <vector>

#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "chrome/browser/notifications/scheduler/test/fake_clock.h"
#include "chrome/browser/notifications/scheduler/test/test_utils.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

_;
Invoke;
StoreEntries;

namespace notifications {
namespace {

const char kGuid1[] =;
const char kGuid2[] =;
const char kButtonId[] =;
const char kTimeStr[] =;

struct TestCase {};

Impression CreateImpression(const base::Time& create_time,
                            const std::string& guid) {}

Impression CreateImpression(const base::Time& create_time,
                            const std::string& guid,
                            UserFeedback feedback) {}

Impression CreateImpression(
    const base::Time& create_time,
    const std::string& guid,
    UserFeedback feedback,
    base::TimeDelta ignore_timeout_duration,
    Impression::ImpressionResultMap impression_mapping) {}

TestCase CreateDefaultTestCase() {}

class MockImpressionStore : public CollectionStore<ClientState> {};

class MockDelegate final : public ImpressionHistoryTracker::Delegate {};

// TODO(xingliu): Add more test cases following the test doc.
class ImpressionHistoryTrackerTest : public ::testing::Test {};

// New client data should be added to impression tracker.
TEST_F(ImpressionHistoryTrackerTest, NewReigstedClient) {}

// Data for deprecated client should be deleted.
TEST_F(ImpressionHistoryTrackerTest, DeprecateClient) {}

// Verifies expired impression will be deleted.
TEST_F(ImpressionHistoryTrackerTest, DeleteExpiredImpression) {}

// Verifies the state of new impression added to the tracker.
TEST_F(ImpressionHistoryTrackerTest, AddImpression) {}

// Verifies that impression loaded from the database can be retrieved correctly.
TEST_F(ImpressionHistoryTrackerTest, GetImpressionLoadedFromDb) {}

// If impression has been deleted, click should have no result.
TEST_F(ImpressionHistoryTrackerTest, ClickNoImpression) {}

// Verifies a consecutive dismiss will generate impression result.
TEST_F(ImpressionHistoryTrackerTest, ConsecutiveDismisses) {}

// Verifies consecutive dismisses or timeout-ignored impressions will generate
// impression result with timeout configured.
TEST_F(ImpressionHistoryTrackerTest, ConsecutiveDismissesWithIgnoreTimeout) {}

// Defines the expected state of impression data after certain user action.
struct UserActionTestParam {};

class ImpressionHistoryTrackerUserActionTest
    : public ImpressionHistoryTrackerTest,
      public ::testing::WithParamInterface<UserActionTestParam> {};

const UserActionTestParam kUserActionTestParams[] =;

// TODO(hesen): Add test for custom suppression duration from client.
// User actions like clicks should update the ClientState data accordingly.
TEST_P(ImpressionHistoryTrackerUserActionTest, UserAction) {}

INSTANTIATE_TEST_SUITE_P();

}  // namespace

}  // namespace notifications