OLD | NEW |
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/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "chrome/browser/autocomplete/history_url_provider.h" | 9 #include "chrome/browser/autocomplete/history_url_provider.h" |
10 #include "chrome/browser/bookmarks/bookmark_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.h" |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 | 314 |
315 // Create a B->C->A redirect chain, but set the visit counts such that they | 315 // Create a B->C->A redirect chain, but set the visit counts such that they |
316 // will appear in A,B,C order in the results. The autocomplete query will | 316 // will appear in A,B,C order in the results. The autocomplete query will |
317 // search for the most recent visit when looking for redirects, so this will | 317 // search for the most recent visit when looking for redirects, so this will |
318 // be found even though the previous visits had no redirects. | 318 // be found even though the previous visits had no redirects. |
319 HistoryService::RedirectList redirects_to_a; | 319 HistoryService::RedirectList redirects_to_a; |
320 redirects_to_a.push_back(GURL(redirect[1].url)); | 320 redirects_to_a.push_back(GURL(redirect[1].url)); |
321 redirects_to_a.push_back(GURL(redirect[2].url)); | 321 redirects_to_a.push_back(GURL(redirect[2].url)); |
322 redirects_to_a.push_back(GURL(redirect[0].url)); | 322 redirects_to_a.push_back(GURL(redirect[0].url)); |
323 history_service_->AddPage(GURL(redirect[0].url), NULL, 0, GURL(), | 323 history_service_->AddPage(GURL(redirect[0].url), NULL, 0, GURL(), |
324 PageTransition::TYPED, redirects_to_a); | 324 PageTransition::TYPED, redirects_to_a, true); |
325 | 325 |
326 // Because all the results are part of a redirect chain with other results, | 326 // Because all the results are part of a redirect chain with other results, |
327 // all but the first one (A) should be culled. We should get the default | 327 // all but the first one (A) should be culled. We should get the default |
328 // "what you typed" result, plus this one. | 328 // "what you typed" result, plus this one. |
329 const std::wstring typing(L"http://redirects/"); | 329 const std::wstring typing(L"http://redirects/"); |
330 const std::string expected_results[] = { | 330 const std::string expected_results[] = { |
331 WideToUTF8(typing), | 331 WideToUTF8(typing), |
332 redirect[0].url}; | 332 redirect[0].url}; |
333 RunTest(typing, std::wstring(), true, expected_results, | 333 RunTest(typing, std::wstring(), true, expected_results, |
334 arraysize(expected_results)); | 334 arraysize(expected_results)); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 | 367 |
368 // An input looks like a IP address like "127.0.0.1" should result in | 368 // An input looks like a IP address like "127.0.0.1" should result in |
369 // "http://127.0.0.1/". | 369 // "http://127.0.0.1/". |
370 std::string fixup_4[] = {"http://127.0.0.1/"}; | 370 std::string fixup_4[] = {"http://127.0.0.1/"}; |
371 RunTest(L"127.0.0.1", std::wstring(), false, fixup_4, arraysize(fixup_4)); | 371 RunTest(L"127.0.0.1", std::wstring(), false, fixup_4, arraysize(fixup_4)); |
372 | 372 |
373 // An number "17173" should result in "http://www.17173.com/" in db. | 373 // An number "17173" should result in "http://www.17173.com/" in db. |
374 std::string fixup_5[] = {"http://www.17173.com/"}; | 374 std::string fixup_5[] = {"http://www.17173.com/"}; |
375 RunTest(L"17173", std::wstring(), false, fixup_5, arraysize(fixup_5)); | 375 RunTest(L"17173", std::wstring(), false, fixup_5, arraysize(fixup_5)); |
376 } | 376 } |
OLD | NEW |