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

Side by Side Diff: chrome/browser/autocomplete/keyword_provider_unittest.cc

Issue 193092: Replace a bunch of hardcoded URLs with constants from url_constants.h... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/browser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "base/message_loop.h" 5 #include "base/message_loop.h"
6 #include "chrome/browser/autocomplete/keyword_provider.h" 6 #include "chrome/browser/autocomplete/keyword_provider.h"
7 #include "chrome/browser/search_engines/template_url.h" 7 #include "chrome/browser/search_engines/template_url.h"
8 #include "chrome/browser/search_engines/template_url_model.h" 8 #include "chrome/browser/search_engines/template_url_model.h"
9 #include "googleurl/src/gurl.h" 9 #include "googleurl/src/gurl.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 {L"mailto:z", 1, {L"z "}}, 109 {L"mailto:z", 1, {L"z "}},
110 }; 110 };
111 111
112 RunTest<std::wstring>(edit_cases, arraysize(edit_cases), 112 RunTest<std::wstring>(edit_cases, arraysize(edit_cases),
113 &AutocompleteMatch::fill_into_edit); 113 &AutocompleteMatch::fill_into_edit);
114 } 114 }
115 115
116 TEST_F(KeywordProviderTest, URL) { 116 TEST_F(KeywordProviderTest, URL) {
117 test_data<GURL> url_cases[] = { 117 test_data<GURL> url_cases[] = {
118 // No query input -> empty destination URL. 118 // No query input -> empty destination URL.
119 {L"z", 1, {GURL("")}}, 119 {L"z", 1, {GURL()}},
120 {L"z \t", 1, {GURL("")}}, 120 {L"z \t", 1, {GURL()}},
121 121
122 // Check that tokenization only collapses whitespace between first tokens 122 // Check that tokenization only collapses whitespace between first tokens
123 // and query input, but not rest of URL, is escaped. 123 // and query input, but not rest of URL, is escaped.
124 {L"z a b c++", 1, {GURL("a+++b+++c%2B%2B=z")}}, 124 {L"z a b c++", 1, {GURL("a+++b+++c%2B%2B=z")}},
125 {L"www.www www", 1, {GURL(" +%2B?=wwwfoo ")}}, 125 {L"www.www www", 1, {GURL(" +%2B?=wwwfoo ")}},
126 126
127 // Substitution should work with various locations of the "%s". 127 // Substitution should work with various locations of the "%s".
128 {L"aaa 1a2b", 2, {GURL("http://aaaa/?aaaa=1&b=1a2b&c"), 128 {L"aaa 1a2b", 2, {GURL("http://aaaa/?aaaa=1&b=1a2b&c"),
129 GURL("1a2b")}}, 129 GURL("1a2b")}},
130 {L"a 1 2 3", 3, {GURL("aa.com?foo=1+2+3"), GURL("bogus URL 1+2+3"), 130 {L"a 1 2 3", 3, {GURL("aa.com?foo=1+2+3"), GURL("bogus URL 1+2+3"),
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 template_url->set_short_name(L"Test"); 186 template_url->set_short_name(L"Test");
187 model_->Add(template_url); 187 model_->Add(template_url);
188 ASSERT_TRUE(template_url == model_->GetTemplateURLForKeyword(keyword)); 188 ASSERT_TRUE(template_url == model_->GetTemplateURLForKeyword(keyword));
189 } 189 }
190 190
191 TEST_F(KeywordProviderTest, RemoveKeyword) { 191 TEST_F(KeywordProviderTest, RemoveKeyword) {
192 std::wstring url(L"http://aaaa/?aaaa=1&b={searchTerms}&c"); 192 std::wstring url(L"http://aaaa/?aaaa=1&b={searchTerms}&c");
193 model_->Remove(model_->GetTemplateURLForKeyword(L"aaaa")); 193 model_->Remove(model_->GetTemplateURLForKeyword(L"aaaa"));
194 ASSERT_TRUE(model_->GetTemplateURLForKeyword(L"aaaa") == NULL); 194 ASSERT_TRUE(model_->GetTemplateURLForKeyword(L"aaaa") == NULL);
195 } 195 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698