Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(520)

Side by Side Diff: components/search_engines/template_url_unittest.cc

Issue 1855423003: Interpret '?' and Ctrl-K or Ctrl-E as putting omnibox in keyword search mode for Default Search Pro… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed forced queries using '?'. Removed Ctrl-K preserving the user's keyword if they're already … Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/base_paths.h" 7 #include "base/base_paths.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 const std::string expected_result; 580 const std::string expected_result;
581 } test_data[] = { 581 } test_data[] = {
582 { ASCIIToUTF16("foo"), 582 { ASCIIToUTF16("foo"),
583 metrics::OmniboxInputType::UNKNOWN, 583 metrics::OmniboxInputType::UNKNOWN,
584 "{google:baseURL}?{searchTerms}&{google:inputType}", 584 "{google:baseURL}?{searchTerms}&{google:inputType}",
585 "http://www.google.com/?foo&oit=1&" }, 585 "http://www.google.com/?foo&oit=1&" },
586 { ASCIIToUTF16("foo"), 586 { ASCIIToUTF16("foo"),
587 metrics::OmniboxInputType::URL, 587 metrics::OmniboxInputType::URL,
588 "{google:baseURL}?{searchTerms}&{google:inputType}", 588 "{google:baseURL}?{searchTerms}&{google:inputType}",
589 "http://www.google.com/?foo&oit=3&" }, 589 "http://www.google.com/?foo&oit=3&" },
590 { ASCIIToUTF16("foo"),
591 metrics::OmniboxInputType::FORCED_QUERY,
592 "{google:baseURL}?{searchTerms}&{google:inputType}",
593 "http://www.google.com/?foo&oit=5&" },
594 }; 590 };
595 TemplateURLData data; 591 TemplateURLData data;
596 data.input_encodings.push_back("UTF-8"); 592 data.input_encodings.push_back("UTF-8");
597 for (size_t i = 0; i < arraysize(test_data); ++i) { 593 for (size_t i = 0; i < arraysize(test_data); ++i) {
598 data.SetURL(test_data[i].url); 594 data.SetURL(test_data[i].url);
599 TemplateURL url(data); 595 TemplateURL url(data);
600 EXPECT_TRUE(url.url_ref().IsValid(search_terms_data_)); 596 EXPECT_TRUE(url.url_ref().IsValid(search_terms_data_));
601 ASSERT_TRUE(url.url_ref().SupportsReplacement(search_terms_data_)); 597 ASSERT_TRUE(url.url_ref().SupportsReplacement(search_terms_data_));
602 TemplateURLRef::SearchTermsArgs search_terms_args(test_data[i].search_term); 598 TemplateURLRef::SearchTermsArgs search_terms_args(test_data[i].search_term);
603 search_terms_args.input_type = test_data[i].input_type; 599 search_terms_args.input_type = test_data[i].input_type;
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1779 GURL("https://www.foo.org/search?q=Y+Z"), 1775 GURL("https://www.foo.org/search?q=Y+Z"),
1780 search_terms_data_, &search_terms)); 1776 search_terms_data_, &search_terms));
1781 EXPECT_EQ(base::ASCIIToUTF16("Y Z"), search_terms); 1777 EXPECT_EQ(base::ASCIIToUTF16("Y Z"), search_terms);
1782 EXPECT_TRUE(url.ExtractSearchTermsFromURL( 1778 EXPECT_TRUE(url.ExtractSearchTermsFromURL(
1783 GURL("https://www.foo.org/s#q=123"), 1779 GURL("https://www.foo.org/s#q=123"),
1784 search_terms_data_, &search_terms)); 1780 search_terms_data_, &search_terms));
1785 EXPECT_EQ(base::ASCIIToUTF16("123"), search_terms); 1781 EXPECT_EQ(base::ASCIIToUTF16("123"), search_terms);
1786 1782
1787 search_terms_data_.set_google_base_url("http://www.google.com/"); 1783 search_terms_data_.set_google_base_url("http://www.google.com/");
1788 } 1784 }
OLDNEW
« components/omnibox/browser/omnibox_view.h ('K') | « components/omnibox/browser/shortcuts_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698