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

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

Issue 338363004: Remove Profile* from TemplateURL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/autocomplete/autocomplete_match.h" 8 #include "chrome/browser/autocomplete/autocomplete_match.h"
9 #include "chrome/browser/autocomplete/keyword_provider.h" 9 #include "chrome/browser/autocomplete/keyword_provider.h"
10 #include "chrome/browser/search_engines/template_url.h" 10 #include "chrome/browser/search_engines/template_url.h"
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 RunTest<base::string16>(contents_cases, arraysize(contents_cases), 252 RunTest<base::string16>(contents_cases, arraysize(contents_cases),
253 &AutocompleteMatch::contents); 253 &AutocompleteMatch::contents);
254 } 254 }
255 255
256 TEST_F(KeywordProviderTest, AddKeyword) { 256 TEST_F(KeywordProviderTest, AddKeyword) {
257 TemplateURLData data; 257 TemplateURLData data;
258 data.short_name = ASCIIToUTF16("Test"); 258 data.short_name = ASCIIToUTF16("Test");
259 base::string16 keyword(ASCIIToUTF16("foo")); 259 base::string16 keyword(ASCIIToUTF16("foo"));
260 data.SetKeyword(keyword); 260 data.SetKeyword(keyword);
261 data.SetURL("http://www.google.com/foo?q={searchTerms}"); 261 data.SetURL("http://www.google.com/foo?q={searchTerms}");
262 TemplateURL* template_url = new TemplateURL(NULL, data); 262 TemplateURL* template_url = new TemplateURL(data);
263 model_->Add(template_url); 263 model_->Add(template_url);
264 ASSERT_TRUE(template_url == model_->GetTemplateURLForKeyword(keyword)); 264 ASSERT_TRUE(template_url == model_->GetTemplateURLForKeyword(keyword));
265 } 265 }
266 266
267 TEST_F(KeywordProviderTest, RemoveKeyword) { 267 TEST_F(KeywordProviderTest, RemoveKeyword) {
268 base::string16 url(ASCIIToUTF16("http://aaaa/?aaaa=1&b={searchTerms}&c")); 268 base::string16 url(ASCIIToUTF16("http://aaaa/?aaaa=1&b={searchTerms}&c"));
269 model_->Remove(model_->GetTemplateURLForKeyword(ASCIIToUTF16("aaaa"))); 269 model_->Remove(model_->GetTemplateURLForKeyword(ASCIIToUTF16("aaaa")));
270 ASSERT_TRUE(model_->GetTemplateURLForKeyword(ASCIIToUTF16("aaaa")) == NULL); 270 ASSERT_TRUE(model_->GetTemplateURLForKeyword(ASCIIToUTF16("aaaa")) == NULL);
271 } 271 }
272 272
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 TestData<GURL> url_cases[] = { 346 TestData<GURL> url_cases[] = {
347 { ASCIIToUTF16("a 1 2 3"), 3, 347 { ASCIIToUTF16("a 1 2 3"), 3,
348 { { GURL("aa.com?a=b&foo=1+2+3"), false }, 348 { { GURL("aa.com?a=b&foo=1+2+3"), false },
349 { GURL("bogus URL 1+2+3"), false }, 349 { GURL("bogus URL 1+2+3"), false },
350 { GURL("http://aaaa/?aaaa=1&b=1+2+3&c"), false } } }, 350 { GURL("http://aaaa/?aaaa=1&b=1+2+3&c"), false } } },
351 }; 351 };
352 352
353 RunTest<GURL>(url_cases, arraysize(url_cases), 353 RunTest<GURL>(url_cases, arraysize(url_cases),
354 &AutocompleteMatch::destination_url); 354 &AutocompleteMatch::destination_url);
355 } 355 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/history_url_provider_unittest.cc ('k') | chrome/browser/autocomplete/search_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698