chromium/chrome/browser/upgrade_detector/upgrade_detector_impl_unittest.cc

// Copyright 2014 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/upgrade_detector/upgrade_detector_impl.h"

#include <initializer_list>
#include <memory>
#include <string>
#include <utility>
#include <vector>

#include "base/memory/raw_ptr.h"
#include "base/time/clock.h"
#include "base/time/tick_clock.h"
#include "base/time/time.h"
#include "base/values.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/upgrade_detector/installed_version_poller.h"
#include "chrome/browser/upgrade_detector/upgrade_observer.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/scoped_testing_local_state.h"
#include "chrome/test/base/testing_browser_process.h"
#include "components/prefs/testing_pref_service.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

#if !BUILDFLAG(IS_CHROMEOS_ASH)
#include "components/enterprise/browser/controller/fake_browser_dm_token_storage.h"
#endif  // !BUILDFLAG(IS_CHROMEOS_ASH)

#if BUILDFLAG(IS_CHROMEOS_LACROS)
#include "chromeos/lacros/lacros_test_helper.h"
#endif

#if BUILDFLAG(IS_WIN)
#include "chrome/install_static/install_modes.h"
#include "chrome/install_static/test/scoped_install_details.h"
#endif  // BUILDFLAG(IS_WIN)

AnyNumber;

namespace {

class TestUpgradeDetectorImpl : public UpgradeDetectorImpl {};

class TestUpgradeNotificationListener : public UpgradeObserver {};

class MockUpgradeObserver : public UpgradeObserver {};

}  // namespace

class UpgradeDetectorImplTest : public ::testing::Test {};

TEST_F(UpgradeDetectorImplTest, VariationsChanges) {}

TEST_F(UpgradeDetectorImplTest, VariationsCriticalChanges) {}

// Tests that the proper notifications are sent for the expected stages as the
// RelaunchNotificationPeriod policy is changed. The period is set to one day,
// such that the thresholds for the annoyance levels are expected to be:
// very low: 1h
// low: 8h
// elevated: 16h
// grace: 23h
// high: 24h
TEST_F(UpgradeDetectorImplTest, TestPeriodChanges) {}

// Appends the time and stage from detector to |notifications|.
ACTION_P2(AppendTicksAndStage, detector, notifications) {}

// A value parameterized test fixture for running tests with different
// RelaunchNotificationPeriod settings.
class UpgradeDetectorImplTimerTest : public UpgradeDetectorImplTest,
                                     public ::testing::WithParamInterface<int> {};

INSTANTIATE_TEST_SUITE_P();  // 3:05:00.

// Tests that the notification timer is handled as desired.
TEST_P(UpgradeDetectorImplTimerTest, TestNotificationTimer) {}

// Tests that the thresholds are adjusted according to the value of the relaunch
// window policy when default relaunch notification period is used.
TEST_F(UpgradeDetectorImplTest, TestDeadlineAdjustmentDefaultPeriod) {}

// Tests that the thresholds are adjusted according to the value of the relaunch
// window policy when a custom relaunch notification period is specified.
TEST_F(UpgradeDetectorImplTest, TestDeadlineAdjustmentCustomPeriod) {}

// Tests correct deadlines are set when an upgrade is detected.
TEST_F(UpgradeDetectorImplTest, AnnoyanceLevelDeadlines) {}