#include "chrome/browser/ui/lens/lens_overlay_url_builder.h"
#include "base/base64url.h"
#include "base/strings/escape.h"
#include "base/strings/stringprintf.h"
#include "base/test/protobuf_matchers.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/browser_process.h"
#include "components/lens/lens_features.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/lens_server_proto/lens_overlay_knowledge_intent_query.pb.h"
#include "third_party/lens_server_proto/lens_overlay_knowledge_query.pb.h"
#include "third_party/lens_server_proto/lens_overlay_stickiness_signals.pb.h"
#include "third_party/lens_server_proto/lens_overlay_translate_stickiness_signals.pb.h"
#include "third_party/omnibox_proto/search_context.pb.h"
#include "third_party/zlib/google/compression_utils.h"
namespace lens {
constexpr char kResultsSearchBaseUrl[] = …;
constexpr char kResultsRedirectBaseUrl[] = …;
constexpr char kLanguage[] = …;
constexpr char kPageUrl[] = …;
constexpr char kPageTitle[] = …;
class LensOverlayUrlBuilderTest : public testing::Test { … };
TEST_F(LensOverlayUrlBuilderTest, AppendTranslateParamsToMap) { … }
TEST_F(LensOverlayUrlBuilderTest, BuildTextOnlySearchURL) { … }
TEST_F(LensOverlayUrlBuilderTest, BuildTextOnlySearchURLForLensTextSelection) { … }
TEST_F(LensOverlayUrlBuilderTest,
BuildTextOnlySearchURLWithSearchContextFlagOff) { … }
TEST_F(LensOverlayUrlBuilderTest, BuildTextOnlySearchURLWithPageUrlAndTitle) { … }
TEST_F(LensOverlayUrlBuilderTest, BuildTextOnlySearchURLWithPageUrl) { … }
TEST_F(LensOverlayUrlBuilderTest, BuildTextOnlySearchURLWithPageTitle) { … }
TEST_F(LensOverlayUrlBuilderTest, BuildTextOnlySearchURLEmpty) { … }
TEST_F(LensOverlayUrlBuilderTest, BuildTextOnlySearchURLPunctuation) { … }
TEST_F(LensOverlayUrlBuilderTest, BuildTextOnlySearchURLWhitespace) { … }
TEST_F(LensOverlayUrlBuilderTest, BuildLensSearchURLEmptyClusterInfo) { … }
TEST_F(LensOverlayUrlBuilderTest, BuildLensSearchURLWithSessionId) { … }
TEST_F(LensOverlayUrlBuilderTest, BuildLensSearchURLWithNoTextQuery) { … }
TEST_F(LensOverlayUrlBuilderTest, BuildLensSearchURLWithAdditionalParams) { … }
TEST_F(LensOverlayUrlBuilderTest, BuildMultimodalSearchURLWithSearchContext) { … }
TEST_F(LensOverlayUrlBuilderTest,
BuildImageOnlySearchURLWithSearchContextDoesNotAttachContext) { … }
TEST_F(LensOverlayUrlBuilderTest,
BuildMultimodalSearchURLWithSearchContextFlagOff) { … }
TEST_F(LensOverlayUrlBuilderTest, HasCommonSearchQueryParameters) { … }
TEST_F(LensOverlayUrlBuilderTest, HasCommonSearchQueryParametersWithoutLocale) { … }
TEST_F(LensOverlayUrlBuilderTest,
HasCommonSearchQueryParametersMissingQueryParams) { … }
TEST_F(LensOverlayUrlBuilderTest,
AppendInvocationSourceParamToUrlAppendsEntryPoints) { … }
TEST_F(LensOverlayUrlBuilderTest,
AppendDarkModeParamToURLToUrlAppendsDarkMode) { … }
TEST_F(LensOverlayUrlBuilderTest, HasCommonSearchQueryParametersNoQueryParams) { … }
TEST_F(LensOverlayUrlBuilderTest, IsValidSearchURL) { … }
TEST_F(LensOverlayUrlBuilderTest, IsValidSearchURLDifferentDomains) { … }
TEST_F(LensOverlayUrlBuilderTest, IsValidSearchURLDifferentSchemes) { … }
TEST_F(LensOverlayUrlBuilderTest, IsValidSearchURLDifferentPaths) { … }
TEST_F(LensOverlayUrlBuilderTest, IsValidSearchURLInvalidURL) { … }
TEST_F(LensOverlayUrlBuilderTest, RemoveIgnoredSearchURLParameters) { … }
TEST_F(LensOverlayUrlBuilderTest, GetSearchResultsUrlFromRedirectUrl) { … }
}