#include "components/omnibox/browser/search_suggestion_parser.h"
#include <optional>
#include <sstream>
#include "base/base64.h"
#include "base/feature_list.h"
#include "base/json/json_reader.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "base/values.h"
#include "build/build_config.h"
#include "components/omnibox/browser/autocomplete_match.h"
#include "components/omnibox/browser/omnibox_feature_configs.h"
#include "components/omnibox/browser/omnibox_field_trial.h"
#include "components/omnibox/browser/test_scheme_classifier.h"
#include "components/omnibox/common/omnibox_features.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/omnibox_proto/answer_data.pb.h"
#include "third_party/omnibox_proto/answer_type.pb.h"
#include "third_party/omnibox_proto/entity_info.pb.h"
#include "third_party/omnibox_proto/navigational_intent.pb.h"
#include "third_party/omnibox_proto/rich_answer_template.pb.h"
#include "third_party/omnibox_proto/rich_suggest_template.pb.h"
namespace {
std::string SerializeAndEncodeEntityInfo(
const omnibox::EntityInfo& entity_info) { … }
std::string SerializeAndEncodeGroupsInfo(
const omnibox::GroupsInfo& groups_info) { … }
std::string SerializeAndEncodeRichSuggestTemplate(
const omnibox::RichSuggestTemplate& suggest_template) { … }
std::string NavigationalIntentsToJSON(
std::vector<omnibox::NavigationalIntent> nav_intents) { … }
bool ProtosAreEqual(const google::protobuf::MessageLite& actual,
const google::protobuf::MessageLite& expected) { … }
}
TEST(SearchSuggestionParserTest, DeserializeNonListJsonIsInvalid) { … }
TEST(SearchSuggestionParserTest, DeserializeMalformedJsonIsInvalid) { … }
TEST(SearchSuggestionParserTest, DeserializeJsonData) { … }
TEST(SearchSuggestionParserTest, DeserializeWithXssiGuard) { … }
TEST(SearchSuggestionParserTest, DeserializeWithTrailingComma) { … }
TEST(SearchSuggestionParserTest, ParseEmptyValueIsInvalid) { … }
TEST(SearchSuggestionParserTest, ParseNonSuggestionValueIsInvalid) { … }
TEST(SearchSuggestionParserTest, ParseSuggestResults) { … }
TEST(SearchSuggestionParserTest, ParsePrerenderSuggestion) { … }
TEST(SearchSuggestionParserTest, ParseBothPrefetchAndPrerenderSuggestion) { … }
TEST(SearchSuggestionParserTest, SuggestClassification) { … }
TEST(SearchSuggestionParserTest, NavigationClassification) { … }
TEST(SearchSuggestionParserTest, ParseSuggestionGroupInfo) { … }
TEST(SearchSuggestionParserTest, ParseSuggestionEntityInfo) { … }
TEST(SearchSuggestionParserTest, ParseSuggestionTemplateInfo) { … }
TEST(SearchSuggestionParserTest, ParseSuggestionTemplateInfoCounterfactual) { … }
TEST(SearchSuggestionParserTest, ParseValidTypes) { … }
TEST(SearchSuggestionParserTest, ParseValidSubtypes) { … }
TEST(SearchSuggestionParserTest, IgnoresExcessiveSubtypeEntries) { … }
TEST(SearchSuggestionParserTest, IgnoresMissingSubtypeEntries) { … }
TEST(SearchSuggestionParserTest, IgnoresUnexpectedSubtypeValues) { … }
TEST(SearchSuggestionParserTest, IgnoresSubtypesIfNotAList) { … }
TEST(SearchSuggestionParserTest, SubtypesWithEmptyArraysAreValid) { … }
TEST(SearchSuggestionParserTest, BadAnswersFailGracefully) { … }
TEST(SearchSuggestionParserTest, ParseCalculatorSuggestion) { … }
TEST(SearchSuggestionParserTest, ParseTailSuggestion) { … }