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

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

Issue 39206: NO CODE CHANGE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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) 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 27 matching lines...) Expand all
38 static const TemplateURLModel::Initializer kTestKeywordData[] = { 38 static const TemplateURLModel::Initializer kTestKeywordData[] = {
39 { L"aa", L"aa.com?foo=%s", L"aa" }, 39 { L"aa", L"aa.com?foo=%s", L"aa" },
40 { L"aaaa", L"http://aaaa/?aaaa=1&b=%s&c", L"aaaa" }, 40 { L"aaaa", L"http://aaaa/?aaaa=1&b=%s&c", L"aaaa" },
41 { L"aaaaa", L"%s", L"aaaaa" }, 41 { L"aaaaa", L"%s", L"aaaaa" },
42 { L"ab", L"bogus URL %s", L"ab" }, 42 { L"ab", L"bogus URL %s", L"ab" },
43 { L"weasel", L"weasel%sweasel", L"weasel" }, 43 { L"weasel", L"weasel%sweasel", L"weasel" },
44 { L"www", L" +%2B?=%sfoo ", L"www" }, 44 { L"www", L" +%2B?=%sfoo ", L"www" },
45 { L"z", L"%s=z", L"z" }, 45 { L"z", L"%s=z", L"z" },
46 }; 46 };
47 47
48 model_.reset(new TemplateURLModel(kTestKeywordData, arraysize(kTestKeywordData ))); 48 model_.reset(new TemplateURLModel(kTestKeywordData,
49 arraysize(kTestKeywordData)));
49 kw_provider_ = new KeywordProvider(NULL, model_.get()); 50 kw_provider_ = new KeywordProvider(NULL, model_.get());
50 } 51 }
51 52
52 void KeywordProviderTest::TearDown() { 53 void KeywordProviderTest::TearDown() {
53 model_.reset(); 54 model_.reset();
54 kw_provider_ = NULL; 55 kw_provider_ = NULL;
55 } 56 }
56 57
57 template<class ResultType> 58 template<class ResultType>
58 void KeywordProviderTest::RunTest( 59 void KeywordProviderTest::RunTest(
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 template_url->set_short_name(L"Test"); 186 template_url->set_short_name(L"Test");
186 model_->Add(template_url); 187 model_->Add(template_url);
187 ASSERT_TRUE(template_url == model_->GetTemplateURLForKeyword(keyword)); 188 ASSERT_TRUE(template_url == model_->GetTemplateURLForKeyword(keyword));
188 } 189 }
189 190
190 TEST_F(KeywordProviderTest, RemoveKeyword) { 191 TEST_F(KeywordProviderTest, RemoveKeyword) {
191 std::wstring url(L"http://aaaa/?aaaa=1&b={searchTerms}&c"); 192 std::wstring url(L"http://aaaa/?aaaa=1&b={searchTerms}&c");
192 model_->Remove(model_->GetTemplateURLForKeyword(L"aaaa")); 193 model_->Remove(model_->GetTemplateURLForKeyword(L"aaaa"));
193 ASSERT_TRUE(model_->GetTemplateURLForKeyword(L"aaaa") == NULL); 194 ASSERT_TRUE(model_->GetTemplateURLForKeyword(L"aaaa") == NULL);
194 } 195 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/history_url_provider.cc ('k') | chrome/browser/bookmarks/bookmark_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698