#include "lens_overlay_query_controller.h"
#include "base/base64url.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "base/test/test_future.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/lens/core/mojom/overlay_object.mojom.h"
#include "chrome/browser/lens/core/mojom/text.mojom.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/test/base/testing_profile.h"
#include "components/endpoint_fetcher/endpoint_fetcher.h"
#include "components/lens/lens_features.h"
#include "content/public/test/browser_task_environment.h"
#include "google_apis/common/api_error_codes.h"
#include "net/base/url_util.h"
#include "net/http/http_status_code.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/icu/source/common/unicode/locid.h"
#include "third_party/icu/source/common/unicode/unistr.h"
#include "third_party/icu/source/i18n/unicode/timezone.h"
#include "third_party/lens_server_proto/lens_overlay_request_id.pb.h"
#include "third_party/lens_server_proto/lens_overlay_server.pb.h"
#include "third_party/lens_server_proto/lens_overlay_visual_search_interaction_data.pb.h"
#include "ui/gfx/codec/jpeg_codec.h"
#include "url/gurl.h"
namespace lens {
constexpr char kTestQueryText[] = …;
constexpr char kTestSuggestSignals[] = …;
constexpr char kTestServerSessionId[] = …;
constexpr char kTestApiKey[] = …;
constexpr char kLocale[] = …;
constexpr char kTestPageUrl[] = …;
constexpr char kTestPageTitle[] = …;
constexpr char kSearchContextParamKey[] = …;
constexpr char kStartTimeQueryParam[] = …;
constexpr char kVisualSearchInteractionDataQueryParameterKey[] = …;
inline constexpr char kRequestIdParameterKey[] = …;
constexpr char kTestEncodedSearchContext[] = …;
constexpr char kRegion[] = …;
constexpr char kTimeZone[] = …;
constexpr char kGen204IdentifierQueryParameter[] = …;
class FakeEndpointFetcher : public EndpointFetcher { … };
class LensOverlayQueryControllerMock : public LensOverlayQueryController { … };
class LensOverlayQueryControllerTest : public testing::Test { … };
TEST_F(LensOverlayQueryControllerTest, FetchInitialQuery_ReturnsResponse) { … }
TEST_F(LensOverlayQueryControllerTest,
FetchRegionSearchInteraction_ReturnsResponses) { … }
TEST_F(LensOverlayQueryControllerTest,
FetchRegionSearchInteractionWithBytes_ReturnsResponse) { … }
TEST_F(LensOverlayQueryControllerTest,
FetchMultimodalSearchInteraction_ReturnsResponses) { … }
TEST_F(LensOverlayQueryControllerTest,
FetchTextOnlyInteraction_ReturnsResponse) { … }
TEST_F(LensOverlayQueryControllerTest,
FetchInteraction_StartsNewQueryFlowAfterTimeout) { … }
TEST_F(LensOverlayQueryControllerTest,
FetchInteraction_UsesSameAnalyticsIdForLensRequestAndUrl) { … }
}