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

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: Fixed unit test compilation Created 4 years, 7 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 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1804 GURL("https://www.foo.org/search?q=Y+Z"), 1800 GURL("https://www.foo.org/search?q=Y+Z"),
1805 search_terms_data_, &search_terms)); 1801 search_terms_data_, &search_terms));
1806 EXPECT_EQ(base::ASCIIToUTF16("Y Z"), search_terms); 1802 EXPECT_EQ(base::ASCIIToUTF16("Y Z"), search_terms);
1807 EXPECT_TRUE(url.ExtractSearchTermsFromURL( 1803 EXPECT_TRUE(url.ExtractSearchTermsFromURL(
1808 GURL("https://www.foo.org/s#q=123"), 1804 GURL("https://www.foo.org/s#q=123"),
1809 search_terms_data_, &search_terms)); 1805 search_terms_data_, &search_terms));
1810 EXPECT_EQ(base::ASCIIToUTF16("123"), search_terms); 1806 EXPECT_EQ(base::ASCIIToUTF16("123"), search_terms);
1811 1807
1812 search_terms_data_.set_google_base_url("http://www.google.com/"); 1808 search_terms_data_.set_google_base_url("http://www.google.com/");
1813 } 1809 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698