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

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: Add includes for mac tests Created 4 years, 6 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
« no previous file with comments | « components/omnibox/browser/shortcuts_provider.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 const std::string expected_result; 634 const std::string expected_result;
635 } test_data[] = { 635 } test_data[] = {
636 { ASCIIToUTF16("foo"), 636 { ASCIIToUTF16("foo"),
637 metrics::OmniboxInputType::UNKNOWN, 637 metrics::OmniboxInputType::UNKNOWN,
638 "{google:baseURL}?{searchTerms}&{google:inputType}", 638 "{google:baseURL}?{searchTerms}&{google:inputType}",
639 "http://www.google.com/?foo&oit=1&" }, 639 "http://www.google.com/?foo&oit=1&" },
640 { ASCIIToUTF16("foo"), 640 { ASCIIToUTF16("foo"),
641 metrics::OmniboxInputType::URL, 641 metrics::OmniboxInputType::URL,
642 "{google:baseURL}?{searchTerms}&{google:inputType}", 642 "{google:baseURL}?{searchTerms}&{google:inputType}",
643 "http://www.google.com/?foo&oit=3&" }, 643 "http://www.google.com/?foo&oit=3&" },
644 { ASCIIToUTF16("foo"),
645 metrics::OmniboxInputType::FORCED_QUERY,
646 "{google:baseURL}?{searchTerms}&{google:inputType}",
647 "http://www.google.com/?foo&oit=5&" },
648 }; 644 };
649 TemplateURLData data; 645 TemplateURLData data;
650 data.input_encodings.push_back("UTF-8"); 646 data.input_encodings.push_back("UTF-8");
651 for (size_t i = 0; i < arraysize(test_data); ++i) { 647 for (size_t i = 0; i < arraysize(test_data); ++i) {
652 data.SetURL(test_data[i].url); 648 data.SetURL(test_data[i].url);
653 TemplateURL url(data); 649 TemplateURL url(data);
654 EXPECT_TRUE(url.url_ref().IsValid(search_terms_data_)); 650 EXPECT_TRUE(url.url_ref().IsValid(search_terms_data_));
655 ASSERT_TRUE(url.url_ref().SupportsReplacement(search_terms_data_)); 651 ASSERT_TRUE(url.url_ref().SupportsReplacement(search_terms_data_));
656 TemplateURLRef::SearchTermsArgs search_terms_args(test_data[i].search_term); 652 TemplateURLRef::SearchTermsArgs search_terms_args(test_data[i].search_term);
657 search_terms_args.input_type = test_data[i].input_type; 653 search_terms_args.input_type = test_data[i].input_type;
(...skipping 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1858 GURL("https://www.foo.org/search?q=Y+Z"), 1854 GURL("https://www.foo.org/search?q=Y+Z"),
1859 search_terms_data_, &search_terms)); 1855 search_terms_data_, &search_terms));
1860 EXPECT_EQ(base::ASCIIToUTF16("Y Z"), search_terms); 1856 EXPECT_EQ(base::ASCIIToUTF16("Y Z"), search_terms);
1861 EXPECT_TRUE(url.ExtractSearchTermsFromURL( 1857 EXPECT_TRUE(url.ExtractSearchTermsFromURL(
1862 GURL("https://www.foo.org/s#q=123"), 1858 GURL("https://www.foo.org/s#q=123"),
1863 search_terms_data_, &search_terms)); 1859 search_terms_data_, &search_terms));
1864 EXPECT_EQ(base::ASCIIToUTF16("123"), search_terms); 1860 EXPECT_EQ(base::ASCIIToUTF16("123"), search_terms);
1865 1861
1866 search_terms_data_.set_google_base_url("http://www.google.com/"); 1862 search_terms_data_.set_google_base_url("http://www.google.com/");
1867 } 1863 }
OLDNEW
« no previous file with comments | « components/omnibox/browser/shortcuts_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698