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

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

Issue 6804032: Add TLS-SRP (RFC 5054) support Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: use system srp and mpi libs, not local copies Created 9 years, 8 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
7 #include "chrome/browser/autocomplete/autocomplete_match.h" 7 #include "chrome/browser/autocomplete/autocomplete_match.h"
8 #include "chrome/browser/autocomplete/keyword_provider.h" 8 #include "chrome/browser/autocomplete/keyword_provider.h"
9 #include "chrome/browser/search_engines/template_url.h" 9 #include "chrome/browser/search_engines/template_url.h"
10 #include "chrome/browser/search_engines/template_url_model.h" 10 #include "chrome/browser/search_engines/template_url_model.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 {ASCIIToUTF16("a 1 2 3"), 3, {ASCIIToUTF16("aa 1 2 3"), 99 {ASCIIToUTF16("a 1 2 3"), 3, {ASCIIToUTF16("aa 1 2 3"),
100 ASCIIToUTF16("ab 1 2 3"), 100 ASCIIToUTF16("ab 1 2 3"),
101 ASCIIToUTF16("aaaa 1 2 3")}}, 101 ASCIIToUTF16("aaaa 1 2 3")}},
102 {ASCIIToUTF16("www.a"), 3, {ASCIIToUTF16("aa "), 102 {ASCIIToUTF16("www.a"), 3, {ASCIIToUTF16("aa "),
103 ASCIIToUTF16("ab "), 103 ASCIIToUTF16("ab "),
104 ASCIIToUTF16("aaaa ")}}, 104 ASCIIToUTF16("aaaa ")}},
105 // Exact matches should prevent returning inexact matches. 105 // Exact matches should prevent returning inexact matches.
106 {ASCIIToUTF16("aaaa foo"), 1, {ASCIIToUTF16("aaaa foo")}}, 106 {ASCIIToUTF16("aaaa foo"), 1, {ASCIIToUTF16("aaaa foo")}},
107 {ASCIIToUTF16("www.aaaa foo"), 1, {ASCIIToUTF16("aaaa foo")}}, 107 {ASCIIToUTF16("www.aaaa foo"), 1, {ASCIIToUTF16("aaaa foo")}},
108 108
109 // Clean up keyword input properly. "http" and "https" are the only 109 // Clean up keyword input properly. "http", "https", and "httpsv" are the
110 // allowed schemes. 110 // only allowed schemes.
111 {ASCIIToUTF16("www"), 1, {ASCIIToUTF16("www ")}}, 111 {ASCIIToUTF16("www"), 1, {ASCIIToUTF16("www ")}},
112 {ASCIIToUTF16("www."), 0, {}}, 112 {ASCIIToUTF16("www."), 0, {}},
113 {ASCIIToUTF16("www.w w"), 2, {ASCIIToUTF16("www w"), 113 {ASCIIToUTF16("www.w w"), 2, {ASCIIToUTF16("www w"),
114 ASCIIToUTF16("weasel w")}}, 114 ASCIIToUTF16("weasel w")}},
115 {ASCIIToUTF16("http://www"), 1, {ASCIIToUTF16("www ")}}, 115 {ASCIIToUTF16("http://www"), 1, {ASCIIToUTF16("www ")}},
116 {ASCIIToUTF16("http://www."), 0, {}}, 116 {ASCIIToUTF16("http://www."), 0, {}},
117 {ASCIIToUTF16("ftp: blah"), 0, {}}, 117 {ASCIIToUTF16("ftp: blah"), 0, {}},
118 {ASCIIToUTF16("mailto:z"), 0, {}}, 118 {ASCIIToUTF16("mailto:z"), 0, {}},
119 {ASCIIToUTF16("ftp://z"), 0, {}}, 119 {ASCIIToUTF16("ftp://z"), 0, {}},
120 {ASCIIToUTF16("https://z"), 1, {ASCIIToUTF16("z ")}}, 120 {ASCIIToUTF16("https://z"), 1, {ASCIIToUTF16("z ")}},
121 {ASCIIToUTF16("httpsv://z"), 1, {ASCIIToUTF16("z ")}},
121 }; 122 };
122 123
123 RunTest<string16>(edit_cases, arraysize(edit_cases), 124 RunTest<string16>(edit_cases, arraysize(edit_cases),
124 &AutocompleteMatch::fill_into_edit); 125 &AutocompleteMatch::fill_into_edit);
125 } 126 }
126 127
127 TEST_F(KeywordProviderTest, URL) { 128 TEST_F(KeywordProviderTest, URL) {
128 test_data<GURL> url_cases[] = { 129 test_data<GURL> url_cases[] = {
129 // No query input -> empty destination URL. 130 // No query input -> empty destination URL.
130 {ASCIIToUTF16("z"), 1, {GURL()}}, 131 {ASCIIToUTF16("z"), 1, {GURL()}},
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 template_url->set_short_name(ASCIIToUTF16("Test")); 208 template_url->set_short_name(ASCIIToUTF16("Test"));
208 model_->Add(template_url); 209 model_->Add(template_url);
209 ASSERT_TRUE(template_url == model_->GetTemplateURLForKeyword(keyword)); 210 ASSERT_TRUE(template_url == model_->GetTemplateURLForKeyword(keyword));
210 } 211 }
211 212
212 TEST_F(KeywordProviderTest, RemoveKeyword) { 213 TEST_F(KeywordProviderTest, RemoveKeyword) {
213 string16 url(ASCIIToUTF16("http://aaaa/?aaaa=1&b={searchTerms}&c")); 214 string16 url(ASCIIToUTF16("http://aaaa/?aaaa=1&b={searchTerms}&c"));
214 model_->Remove(model_->GetTemplateURLForKeyword(ASCIIToUTF16("aaaa"))); 215 model_->Remove(model_->GetTemplateURLForKeyword(ASCIIToUTF16("aaaa")));
215 ASSERT_TRUE(model_->GetTemplateURLForKeyword(ASCIIToUTF16("aaaa")) == NULL); 216 ASSERT_TRUE(model_->GetTemplateURLForKeyword(ASCIIToUTF16("aaaa")) == NULL);
216 } 217 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698