#include "components/optimization_guide/core/model_execution/on_device_model_component.h"
#include <memory>
#include "base/scoped_add_feature_flags.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "base/thread_annotations.h"
#include "base/types/cxx23_to_underlying.h"
#include "components/optimization_guide/core/model_execution/model_execution_prefs.h"
#include "components/optimization_guide/core/model_execution/test/test_on_device_model_component_state_manager.h"
#include "components/optimization_guide/core/optimization_guide_enums.h"
#include "components/optimization_guide/core/optimization_guide_features.h"
#include "components/optimization_guide/core/optimization_guide_switches.h"
#include "components/prefs/testing_pref_service.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace optimization_guide {
namespace {
const base::Value::Dict kTestManifest = …;
class StubObserver : public OnDeviceModelComponentStateManager::Observer { … };
class OnDeviceModelComponentTest : public testing::Test { … };
TEST_F(OnDeviceModelComponentTest, InstallsWhenEligible) { … }
TEST_F(OnDeviceModelComponentTest, AlreadyInstalledFlow) { … }
TEST_F(OnDeviceModelComponentTest, NotYetInstalledFlow) { … }
TEST_F(OnDeviceModelComponentTest, DoesNotInstallWhenFeatureNotEnabled) { … }
TEST_F(OnDeviceModelComponentTest,
DoesNotInstallWhenDisabledByEnterprisePolicy) { … }
TEST_F(OnDeviceModelComponentTest, NotEnoughDiskSpaceToInstall) { … }
TEST_F(OnDeviceModelComponentTest, NoEligibleFeatureUse) { … }
TEST_F(OnDeviceModelComponentTest, EligibleFeatureUseTooOld) { … }
TEST_F(OnDeviceModelComponentTest, NoPerformanceClass) { … }
TEST_F(OnDeviceModelComponentTest, PerformanceClassTooLow) { … }
TEST_F(OnDeviceModelComponentTest, UninstallNeeded) { … }
TEST_F(OnDeviceModelComponentTest, UninstallNeededDueToDiskSpace) { … }
TEST_F(OnDeviceModelComponentTest, KeepInstalledWhileNotEligible) { … }
TEST_F(OnDeviceModelComponentTest, KeepInstalledWhileNotAllowed) { … }
TEST_F(OnDeviceModelComponentTest, GetStateInitiallyNull) { … }
TEST_F(OnDeviceModelComponentTest, SetReady) { … }
TEST_F(OnDeviceModelComponentTest, InstallAfterPerformanceClassChanges) { … }
TEST_F(OnDeviceModelComponentTest, PerformanceClassChangesAfterInstall) { … }
TEST_F(OnDeviceModelComponentTest, DontUninstallAfterPerformanceClassChanges) { … }
TEST_F(OnDeviceModelComponentTest, InstallAfterEligibleFeatureWasUsed) { … }
TEST_F(OnDeviceModelComponentTest, LogsStatusOnUse) { … }
TEST_F(OnDeviceModelComponentTest, SetPrefsWhenManifestContainsBaseModelSpec) { … }
TEST_F(OnDeviceModelComponentTest, SetStateWhenModelOverridden) { … }
}
}