#include "components/optimization_guide/core/model_execution/model_execution_fetcher.h"
#include <memory>
#include <optional>
#include "base/memory/scoped_refptr.h"
#include "base/run_loop.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/task_environment.h"
#include "base/test/test.pb.h"
#include "components/optimization_guide/core/model_execution/feature_keys.h"
#include "components/optimization_guide/core/model_execution/optimization_guide_model_execution_error.h"
#include "components/optimization_guide/core/optimization_guide_features.h"
#include "components/optimization_guide/core/optimization_guide_util.h"
#include "components/optimization_guide/proto/model_execution.pb.h"
#include "components/signin/public/base/consent_level.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "components/signin/public/identity_manager/identity_test_environment.h"
#include "components/signin/public/identity_manager/test_identity_manager_observer.h"
#include "components/variations/scoped_variations_ids_provider.h"
#include "google_apis/gaia/google_service_auth_error.h"
#include "net/base/url_util.h"
#include "optimization_guide_model_execution_error.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/test/test_url_loader_factory.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace optimization_guide {
TestMessage;
namespace {
constexpr char kOptimizationGuideServiceUrl[] = …;
TestMessage BuildTestMessage(const std::string& test_message_str) { … }
proto::ExecuteResponse BuildTestExecuteResponse(const TestMessage& message) { … }
}
ModelExecutionError;
class ModelExecutionFetcherTest : public testing::Test { … };
TEST_F(ModelExecutionFetcherTest, TestSuccessfulResponse) { … }
TEST_F(ModelExecutionFetcherTest, TestNetErrorResponse) { … }
TEST_F(ModelExecutionFetcherTest, TestBadResponse) { … }
TEST_F(ModelExecutionFetcherTest, TestRequestCanceled) { … }
TEST_F(ModelExecutionFetcherTest, TestMultipleParallelRequests) { … }
TEST_F(ModelExecutionFetcherTest, TestSuccessfulResponseWithLogin) { … }
TEST_F(ModelExecutionFetcherTest, TestAccessTokenFailureWithLogin) { … }
TEST_F(ModelExecutionFetcherTest, TestNoUserSignIn) { … }
}