Commit 1464fba3 authored by Justin Donnelly's avatar Justin Donnelly Committed by Commit Bot

[omnibox] Enable new answer layout by default.

This feature has been approved for launch.

Bug: 824893
Change-Id: I41dcae918a9649e2313dc592dfbe702f66123a03
Reviewed-on: https://chromium-review.googlesource.com/c/1359062
Commit-Queue: Justin Donnelly <jdonnelly@chromium.org>
Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#613304}
parent 52994137
......@@ -2234,11 +2234,18 @@ TEST_F(SearchProviderTest, DontCacheCalculatorSuggestions) {
const ExpectedMatch async_matches[4];
const ExpectedMatch sync_matches[4];
} cases[] = {
{ "[\"1+2\",[\"3\", \"1+2+3+4+5\"],[],[],"
{ "[\"1+2\",[\"= 3\", \"1+2+3+4+5\"],[],[],"
"{\"google:verbatimrelevance\":1300,"
"\"google:suggesttype\":[\"CALCULATOR\", \"QUERY\"],"
"\"google:suggestrelevance\":[1200, 900]}]",
{ { "1+2", true }, { "3", false }, { "1+2+3+4+5", false },
// The contents of the second match here are set to the query (the result
// is placed in the description instead) and therefore the
// allowed_to_default_match value is true for the second match (despite
// being received asynchronously) because of the logic in
// SearchProvider::PersistTopSuggestions which allows it to be promoted
// based on the fact that it has the same contents as the previous top
// match.
{ { "1+2", true }, { "1+2", true }, { "1+2+3+4+5", false },
kEmptyExpectedMatch },
{ { "1+23", true }, { "1+2+3+4+5", false }, kEmptyExpectedMatch,
kEmptyExpectedMatch } },
......
......@@ -103,7 +103,7 @@ const base::Feature kOmniboxRichEntitySuggestions{
// Feature used to enable enhanced presentation showing larger images, currently
// only used on desktop platforms.
const base::Feature kOmniboxNewAnswerLayout{"OmniboxNewAnswerLayout",
base::FEATURE_DISABLED_BY_DEFAULT};
base::FEATURE_ENABLED_BY_DEFAULT};
// Feature used to enable swapping the rows on answers.
const base::Feature kOmniboxReverseAnswers{"OmniboxReverseAnswers",
......
......@@ -272,6 +272,7 @@ TEST(SuggestionAnswerTest, AddImageURLsTo) {
ASSERT_EQ(0U, urls.size());
{
// Test with the image URL supplied by the "i" (image) param.
base::test::ScopedFeatureList feature_list;
feature_list.InitAndEnableFeature(features::kExperimentalUi);
json =
......@@ -287,6 +288,7 @@ TEST(SuggestionAnswerTest, AddImageURLsTo) {
urls.clear();
}
// Test with the image URL supplied by the "il" (image line) param.
json =
"{ \"l\" : ["
" { \"il\": { \"t\": [{ \"t\": \"some text\", \"tt\": 5 }] } },"
......@@ -298,6 +300,9 @@ TEST(SuggestionAnswerTest, AddImageURLsTo) {
EXPECT_EQ(GURL("https://gstatic.com/foo.png"), urls[0]);
urls.clear();
// Test with image URLs supplied by both the "i" and "il" params. In this
// case, prefer the URL provided by the "i" param because the new answer code
// uses this.
json =
"{ \"i\": { \"d\": \"https://gstatic.com/foo.png\", \"t\": 3 },"
" \"l\" : ["
......@@ -308,9 +313,11 @@ TEST(SuggestionAnswerTest, AddImageURLsTo) {
ASSERT_TRUE(ParseAnswer(json, &answer));
answer.AddImageURLsTo(&urls);
ASSERT_EQ(1U, urls.size());
EXPECT_EQ(GURL("https://gstatic.com/bar.png"), urls[0]);
EXPECT_EQ(GURL("https://gstatic.com/foo.png"), urls[0]);
urls.clear();
// Test with the image URL supplied by both "il" params. In this case, prefer
// the URL in the second line as the first is currently not used.
json =
"{ \"l\" : ["
" { \"il\": { \"t\": [{ \"t\": \"some text\", \"tt\": 5 }],"
......@@ -320,6 +327,5 @@ TEST(SuggestionAnswerTest, AddImageURLsTo) {
ASSERT_TRUE(ParseAnswer(json, &answer));
answer.AddImageURLsTo(&urls);
ASSERT_EQ(1U, urls.size());
// Note: first_line_.image_url() is not used in practice (so it's ignored).
EXPECT_EQ(GURL("https://gstatic.com/bar.jpg"), urls[0]);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment