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

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: fix crashes on about: schemes 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 2188 matching lines...) Expand 10 before | Expand all | Expand 10 after
2199 const bool allowed_to_be_default_match_in_prevent_inline_mode; 2199 const bool allowed_to_be_default_match_in_prevent_inline_mode;
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",
2210 "https://www.abc.com", std::string(), false,
2211 false },
2212 { "http://abc.com", "ftp://abc.com",
2213 "ftp://abc.com", std::string(), false,
2214 false },
2215 { "https://www.abc.com", "http://www.abc.com",
2216 "www.abc.com", std::string(), false,
2217 false },
2218 { "ftp://abc.com", "http://abc.com",
2219 "abc.com", std::string(), false,
2220 false },
2221 2209
2222 // Do not inline matches with invalid input prefixes; trim http as needed. 2210 // Do not inline matches with invalid input prefixes; trim http as needed.
2223 { "ttp", "http://www.abc.com", 2211 { "ttp", "http://www.abc.com",
2224 "www.abc.com", std::string(), false, false }, 2212 "www.abc.com", std::string(), false, false },
2225 { "://w", "http://www.abc.com", 2213 { "://w", "http://www.abc.com",
2226 "www.abc.com", std::string(), false, false }, 2214 "www.abc.com", std::string(), false, false },
2227 { "ww.", "http://www.abc.com", 2215 { "ww.", "http://www.abc.com",
2228 "www.abc.com", std::string(), false, false }, 2216 "www.abc.com", std::string(), false, false },
2229 { ".ab", "http://www.abc.com", 2217 { ".ab", "http://www.abc.com",
2230 "www.abc.com", std::string(), false, false }, 2218 "www.abc.com", std::string(), false, false },
(...skipping 24 matching lines...) Expand all
2255 "http://www.abc.com", std::string(), true, true }, 2243 "http://www.abc.com", std::string(), true, true },
2256 2244
2257 // Inputs with trailing whitespace should inline when possible. 2245 // Inputs with trailing whitespace should inline when possible.
2258 { "abc.com ", "http://www.abc.com", 2246 { "abc.com ", "http://www.abc.com",
2259 "www.abc.com", std::string(), true, true }, 2247 "www.abc.com", std::string(), true, true },
2260 { "abc.com/ ", "http://www.abc.com", 2248 { "abc.com/ ", "http://www.abc.com",
2261 "www.abc.com", std::string(), true, true }, 2249 "www.abc.com", std::string(), true, true },
2262 { "abc.com ", "http://www.abc.com/bar", 2250 { "abc.com ", "http://www.abc.com/bar",
2263 "www.abc.com/bar", "/bar", false, false }, 2251 "www.abc.com/bar", "/bar", false, false },
2264 2252
2253 // A suggestion that's equivalent to what the input gets fixed up to
2254 // should be inlined.
2255 { "abc.com:", "http://abc.com/",
2256 "abc.com", "", true, true },
2257 { "abc.com:", "http://www.abc.com",
2258 "www.abc.com", "", true, true },
2259
2265 // Inline matches when the input is a leading substring of the scheme. 2260 // Inline matches when the input is a leading substring of the scheme.
2266 { "h", "http://www.abc.com", 2261 { "h", "http://www.abc.com",
2267 "http://www.abc.com", "ttp://www.abc.com", true, false }, 2262 "http://www.abc.com", "ttp://www.abc.com", true, false },
2268 { "http", "http://www.abc.com", 2263 { "http", "http://www.abc.com",
2269 "http://www.abc.com", "://www.abc.com", true, false }, 2264 "http://www.abc.com", "://www.abc.com", true, false },
2270 2265
2271 // Inline matches when the input is a leading substring of the full URL. 2266 // Inline matches when the input is a leading substring of the full URL.
2272 { "http:", "http://www.abc.com", 2267 { "http:", "http://www.abc.com",
2273 "http://www.abc.com", "//www.abc.com", true, false }, 2268 "http://www.abc.com", "//www.abc.com", true, false },
2274 { "http://w", "http://www.abc.com", 2269 { "http://w", "http://www.abc.com",
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after
3198 3193
3199 // The expiration time is always updated. 3194 // The expiration time is always updated.
3200 provider_->GetSessionToken(); 3195 provider_->GetSessionToken();
3201 base::TimeTicks expiration_time_1 = provider_->token_expiration_time_; 3196 base::TimeTicks expiration_time_1 = provider_->token_expiration_time_;
3202 base::PlatformThread::Sleep(kSmallDelta); 3197 base::PlatformThread::Sleep(kSmallDelta);
3203 provider_->GetSessionToken(); 3198 provider_->GetSessionToken();
3204 base::TimeTicks expiration_time_2 = provider_->token_expiration_time_; 3199 base::TimeTicks expiration_time_2 = provider_->token_expiration_time_;
3205 EXPECT_GT(expiration_time_2, expiration_time_1); 3200 EXPECT_GT(expiration_time_2, expiration_time_1);
3206 EXPECT_GE(expiration_time_2, expiration_time_1 + kSmallDelta); 3201 EXPECT_GE(expiration_time_2, expiration_time_1 + kSmallDelta);
3207 } 3202 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/search_provider.cc ('k') | chrome/browser/autocomplete/shortcuts_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698