#include "base/path_service.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/thread_pool.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "base/threading/thread_restrictions.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/core/test_tflite_model_executor.h"
#include "components/optimization_guide/core/test_tflite_model_handler.h"
#include "components/optimization_guide/machine_learning_tflite_buildflags.h"
#include "components/optimization_guide/proto/common_types.pb.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/tflite_support/src/tensorflow_lite_support/cc/task/core/task_utils.h"
namespace optimization_guide {
namespace {
class NoUnloadingTestTFLiteModelHandler : public TestTFLiteModelHandler { … };
class AlwaysInMemTestTFLiteModelHandler : public TestTFLiteModelHandler { … };
class EnsureCancelledTestTFLiteModelExecutor : public TestTFLiteModelExecutor { … };
class EnsureCancelledTestTFLiteModelHandler : public TestTFLiteModelHandler { … };
class TFLiteModelExecutorTest : public testing::Test { … };
TEST_F(TFLiteModelExecutorTest, ExecuteReturnsImmediatelyIfNoModelLoaded) { … }
TEST_F(TFLiteModelExecutorTest, BatchExecuteReturnsImmediatelyIfNoModelLoaded) { … }
TEST_F(TFLiteModelExecutorTest, ExecuteWithLoadedModel) { … }
TEST_F(TFLiteModelExecutorTest, BatchExecuteWithLoadedModel) { … }
TEST_F(TFLiteModelExecutorTest, BatchExecutionSyncWithLoadedModel) { … }
TEST_F(TFLiteModelExecutorTest, BatchExecutionSyncNoModelLoaded) { … }
TEST_F(TFLiteModelExecutorTest, ExecuteTwiceWithLoadedModel) { … }
TEST_F(TFLiteModelExecutorTest, DoNotUnloadAfterExecution) { … }
#if !BUILDFLAG(BUILD_WITH_MEDIAPIPE_LIB)
class CancelledTFLiteModelExecutorTest : public TFLiteModelExecutorTest { … };
TEST_F(CancelledTFLiteModelExecutorTest, RunsTooLong) { … }
TEST_F(CancelledTFLiteModelExecutorTest, BatchRunsTooLong) { … }
#endif
TEST_F(TFLiteModelExecutorTest, UpdateModelFileWithPreloading) { … }
TEST_F(TFLiteModelExecutorTest, NullModelUpdate) { … }
class ForegroundTFLiteModelExecutorTest : public TFLiteModelExecutorTest { … };
TEST_F(ForegroundTFLiteModelExecutorTest, LoadAndUpdateAndUnloadModel) { … }
}
}