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

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

Issue 353223002: Omnibox: Fix URL-What-You-Typed Allowed-To-Be-Default-Match Issues (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove extra << Created 6 years, 5 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "chrome/browser/autocomplete/search_provider.h" 5 #include "chrome/browser/autocomplete/search_provider.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 2189 matching lines...) Expand 10 before | Expand all | Expand 10 after
2200 } cases[] = { 2200 } cases[] = {
2201 // Do not inline matches that do not contain the input; trim http as needed. 2201 // Do not inline matches that do not contain the input; trim http as needed.
2202 { "x", "http://www.abc.com", 2202 { "x", "http://www.abc.com",
2203 "www.abc.com", std::string(), false, false }, 2203 "www.abc.com", std::string(), false, false },
2204 { "https:", "http://www.abc.com", 2204 { "https:", "http://www.abc.com",
2205 "www.abc.com", std::string(), false, false }, 2205 "www.abc.com", std::string(), false, false },
2206 { "http://www.abc.com/a", "http://www.abc.com", 2206 { "http://www.abc.com/a", "http://www.abc.com",
2207 "http://www.abc.com", std::string(), false, 2207 "http://www.abc.com", std::string(), false,
2208 false }, 2208 false },
2209 { "http://www.abc.com", "https://www.abc.com", 2209 { "http://www.abc.com", "https://www.abc.com",
2210 "https://www.abc.com", std::string(), false, 2210 "https://www.abc.com", std::string(), true,
2211 false }, 2211 true },
Peter Kasting 2014/07/09 00:46:43 Hmm. This seems like a bad outcome. I think if t
Mark P 2014/07/09 19:54:17 I agree. Yet [see below]
Peter Kasting 2014/07/09 21:05:03 Yeah, I think we should.
Mark P 2014/07/09 22:31:36 Done.
2212 { "http://abc.com", "ftp://abc.com", 2212 { "http://abc.com", "ftp://abc.com",
2213 "ftp://abc.com", std::string(), false, 2213 "ftp://abc.com", std::string(), false,
2214 false }, 2214 false },
2215 { "https://www.abc.com", "http://www.abc.com", 2215 { "https://www.abc.com", "http://www.abc.com",
2216 "www.abc.com", std::string(), false, 2216 "www.abc.com", std::string(), true,
2217 false }, 2217 true },
2218 { "ftp://abc.com", "http://abc.com", 2218 { "ftp://abc.com", "http://abc.com",
2219 "abc.com", std::string(), false, 2219 "abc.com", std::string(), false,
2220 false }, 2220 false },
2221 2221
2222 // Do not inline matches with invalid input prefixes; trim http as needed. 2222 // Do not inline matches with invalid input prefixes; trim http as needed.
2223 { "ttp", "http://www.abc.com", 2223 { "ttp", "http://www.abc.com",
2224 "www.abc.com", std::string(), false, false }, 2224 "www.abc.com", std::string(), false, false },
2225 { "://w", "http://www.abc.com", 2225 { "://w", "http://www.abc.com",
2226 "www.abc.com", std::string(), false, false }, 2226 "www.abc.com", std::string(), false, false },
2227 { "ww.", "http://www.abc.com", 2227 { "ww.", "http://www.abc.com",
(...skipping 27 matching lines...) Expand all
2255 "http://www.abc.com", std::string(), true, true }, 2255 "http://www.abc.com", std::string(), true, true },
2256 2256
2257 // Inputs with trailing whitespace should inline when possible. 2257 // Inputs with trailing whitespace should inline when possible.
2258 { "abc.com ", "http://www.abc.com", 2258 { "abc.com ", "http://www.abc.com",
2259 "www.abc.com", std::string(), true, true }, 2259 "www.abc.com", std::string(), true, true },
2260 { "abc.com/ ", "http://www.abc.com", 2260 { "abc.com/ ", "http://www.abc.com",
2261 "www.abc.com", std::string(), true, true }, 2261 "www.abc.com", std::string(), true, true },
2262 { "abc.com ", "http://www.abc.com/bar", 2262 { "abc.com ", "http://www.abc.com/bar",
2263 "www.abc.com/bar", "/bar", false, false }, 2263 "www.abc.com/bar", "/bar", false, false },
2264 2264
2265 // A suggestion that's equivalent to what the input gets fixed up to
2266 // should be inlined.
2267 { "abc.com:", "http://abc.com/",
2268 "abc.com", "", true, true },
2269 { "abc.com:", "http://www.abc.com",
2270 "www.abc.com", "", true, true },
2271
2265 // Inline matches when the input is a leading substring of the scheme. 2272 // Inline matches when the input is a leading substring of the scheme.
2266 { "h", "http://www.abc.com", 2273 { "h", "http://www.abc.com",
2267 "http://www.abc.com", "ttp://www.abc.com", true, false }, 2274 "http://www.abc.com", "ttp://www.abc.com", true, false },
2268 { "http", "http://www.abc.com", 2275 { "http", "http://www.abc.com",
2269 "http://www.abc.com", "://www.abc.com", true, false }, 2276 "http://www.abc.com", "://www.abc.com", true, false },
2270 2277
2271 // Inline matches when the input is a leading substring of the full URL. 2278 // Inline matches when the input is a leading substring of the full URL.
2272 { "http:", "http://www.abc.com", 2279 { "http:", "http://www.abc.com",
2273 "http://www.abc.com", "//www.abc.com", true, false }, 2280 "http://www.abc.com", "//www.abc.com", true, false },
2274 { "http://w", "http://www.abc.com", 2281 { "http://w", "http://www.abc.com",
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
3196 3203
3197 // The expiration time is always updated. 3204 // The expiration time is always updated.
3198 provider_->GetSessionToken(); 3205 provider_->GetSessionToken();
3199 base::TimeTicks expiration_time_1 = provider_->token_expiration_time_; 3206 base::TimeTicks expiration_time_1 = provider_->token_expiration_time_;
3200 base::PlatformThread::Sleep(kSmallDelta); 3207 base::PlatformThread::Sleep(kSmallDelta);
3201 provider_->GetSessionToken(); 3208 provider_->GetSessionToken();
3202 base::TimeTicks expiration_time_2 = provider_->token_expiration_time_; 3209 base::TimeTicks expiration_time_2 = provider_->token_expiration_time_;
3203 EXPECT_GT(expiration_time_2, expiration_time_1); 3210 EXPECT_GT(expiration_time_2, expiration_time_1);
3204 EXPECT_GE(expiration_time_2, expiration_time_1 + kSmallDelta); 3211 EXPECT_GE(expiration_time_2, expiration_time_1 + kSmallDelta);
3205 } 3212 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698