#include "components/optimization_guide/core/prediction_model_download_manager.h"
#include <optional>
#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/path_service.h"
#include "base/sequence_checker.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/gmock_move_support.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "base/uuid.h"
#include "build/build_config.h"
#include "components/download/public/background_service/test/mock_download_service.h"
#include "components/optimization_guide/core/model_util.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/optimization_guide/core/optimization_guide_util.h"
#include "components/optimization_guide/core/prediction_model_download_observer.h"
#include "components/services/unzip/in_process_unzipper.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/zlib/google/zip.h"
#if !BUILDFLAG(IS_IOS)
#include "components/services/unzip/content/unzip_service.h"
#endif
namespace optimization_guide {
_;
Eq;
class TestPredictionModelDownloadObserver
: public PredictionModelDownloadObserver { … };
enum class PredictionModelDownloadFileStatus { … };
class PredictionModelDownloadManagerTest : public testing::Test { … };
TEST_F(PredictionModelDownloadManagerTest, DownloadServiceReadyPersistsGuids) { … }
TEST_F(PredictionModelDownloadManagerTest, StartDownloadRestrictedDownloading) { … }
TEST_F(PredictionModelDownloadManagerTest,
StartDownloadUnrestrictedDownloading) { … }
TEST_F(PredictionModelDownloadManagerTest, StartDownloadFailedToSchedule) { … }
TEST_F(PredictionModelDownloadManagerTest, IsAvailableForDownloads) { … }
TEST_F(PredictionModelDownloadManagerTest,
SuccessfulDownloadShouldNoLongerBeTracked) { … }
TEST_F(PredictionModelDownloadManagerTest,
FailedDownloadShouldNoLongerBeTracked) { … }
TEST_F(PredictionModelDownloadManagerTest, UnverifiedFileShouldDeleteTempFile) { … }
TEST_F(PredictionModelDownloadManagerTest,
VerifiedCrxWithInvalidPublisherShouldDeleteTempFile) { … }
TEST_F(PredictionModelDownloadManagerTest,
VerifiedCrxWithNoFilesShouldDeleteTempFile) { … }
TEST_F(PredictionModelDownloadManagerTest,
VerifiedCrxWithBadModelInfoFileShouldDeleteTempFile) { … }
TEST_F(PredictionModelDownloadManagerTest,
VerifiedCrxWithInvalidModelInfoShouldDeleteTempFile) { … }
TEST_F(PredictionModelDownloadManagerTest,
VerifiedCrxWithValidModelInfoFileButNoModelFileShouldDeleteTempFile) { … }
TEST_F(
PredictionModelDownloadManagerTest,
VerifiedCrxWithGoodModelFilesShouldDeleteDownloadFileButHaveContentExtracted) { … }
TEST_F(PredictionModelDownloadManagerTest,
VerifiedCrxWithAdditionalModelFiles) { … }
}