#include "components/optimization_guide/core/model_execution/on_device_model_adaptation_loader.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "components/optimization_guide/core/model_execution/feature_keys.h"
#include "components/optimization_guide/core/model_execution/model_execution_features.h"
#include "components/optimization_guide/core/model_execution/model_execution_prefs.h"
#include "components/optimization_guide/core/model_execution/on_device_model_feature_adapter.h"
#include "components/optimization_guide/core/model_execution/test/test_on_device_model_component_state_manager.h"
#include "components/optimization_guide/core/optimization_guide_constants.h"
#include "components/optimization_guide/core/test_model_info_builder.h"
#include "components/optimization_guide/core/test_optimization_guide_model_provider.h"
#include "components/optimization_guide/proto/on_device_base_model_metadata.pb.h"
#include "components/prefs/testing_pref_service.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace optimization_guide {
namespace {
constexpr char kBaseModelName[] = …;
constexpr char kBaseModelVersion[] = …;
proto::Any CreateOnDeviceBaseModelMetadata(
const OnDeviceBaseModelSpec& model_spec) { … }
void WriteConfigToFile(const base::FilePath& file_path,
const proto::OnDeviceModelExecutionConfig& config) { … }
}
class FakeOptimizationGuideModelProvider
: public TestOptimizationGuideModelProvider { … };
class OnDeviceModelAdaptationLoaderTest : public testing::Test { … };
TEST_F(OnDeviceModelAdaptationLoaderTest, BaseModelUnavailable) { … }
TEST_F(OnDeviceModelAdaptationLoaderTest, AdaptationModelInvalid) { … }
TEST_F(OnDeviceModelAdaptationLoaderTest, AdaptationModelIncompatible) { … }
TEST_F(OnDeviceModelAdaptationLoaderTest,
AdaptationModelInvalidWithoutExecutionConfig) { … }
TEST_F(OnDeviceModelAdaptationLoaderTest,
AdaptationModelInvalidMissingExecutionConfig) { … }
TEST_F(OnDeviceModelAdaptationLoaderTest,
AdaptationModelInvalidMultipleFeaturesInExecutionConfig) { … }
TEST_F(OnDeviceModelAdaptationLoaderTest, AdaptationModelValid) { … }
TEST_F(OnDeviceModelAdaptationLoaderTest, AdaptationModelValidWithoutWeights) { … }
}