OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/history_url_provider.h" | 5 #include "chrome/browser/autocomplete/history_url_provider.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 | 455 |
456 // Create a B->C->A redirect chain, but set the visit counts such that they | 456 // Create a B->C->A redirect chain, but set the visit counts such that they |
457 // will appear in A,B,C order in the results. The autocomplete query will | 457 // will appear in A,B,C order in the results. The autocomplete query will |
458 // search for the most recent visit when looking for redirects, so this will | 458 // search for the most recent visit when looking for redirects, so this will |
459 // be found even though the previous visits had no redirects. | 459 // be found even though the previous visits had no redirects. |
460 history::RedirectList redirects_to_a; | 460 history::RedirectList redirects_to_a; |
461 redirects_to_a.push_back(GURL(test_cases[1].url)); | 461 redirects_to_a.push_back(GURL(test_cases[1].url)); |
462 redirects_to_a.push_back(GURL(test_cases[2].url)); | 462 redirects_to_a.push_back(GURL(test_cases[2].url)); |
463 redirects_to_a.push_back(GURL(test_cases[0].url)); | 463 redirects_to_a.push_back(GURL(test_cases[0].url)); |
464 history_service_->AddPage(GURL(test_cases[0].url), base::Time::Now(), | 464 history_service_->AddPage(GURL(test_cases[0].url), base::Time::Now(), |
465 NULL, 0, GURL(), redirects_to_a, content::PAGE_TRANSITION_TYPED, | 465 NULL, 0, GURL(), redirects_to_a, ui::PAGE_TRANSITION_TYPED, |
466 history::SOURCE_BROWSED, true); | 466 history::SOURCE_BROWSED, true); |
467 | 467 |
468 // Because all the results are part of a redirect chain with other results, | 468 // Because all the results are part of a redirect chain with other results, |
469 // all but the first one (A) should be culled. We should get the default | 469 // all but the first one (A) should be culled. We should get the default |
470 // "what you typed" result, plus this one. | 470 // "what you typed" result, plus this one. |
471 const base::string16 typing(ASCIIToUTF16("http://redirects/")); | 471 const base::string16 typing(ASCIIToUTF16("http://redirects/")); |
472 const UrlAndLegalDefault expected_results[] = { | 472 const UrlAndLegalDefault expected_results[] = { |
473 { base::UTF16ToUTF8(typing), true }, | 473 { base::UTF16ToUTF8(typing), true }, |
474 { test_cases[0].url, false } | 474 { test_cases[0].url, false } |
475 }; | 475 }; |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1029 autocomplete_->scoring_params_.experimental_scoring_enabled = true; | 1029 autocomplete_->scoring_params_.experimental_scoring_enabled = true; |
1030 ASSERT_NO_FATAL_FAILURE( | 1030 ASSERT_NO_FATAL_FAILURE( |
1031 RunTest(ASCIIToUTF16(test_cases[i].input), | 1031 RunTest(ASCIIToUTF16(test_cases[i].input), |
1032 base::string16(), false, output, max_matches)); | 1032 base::string16(), false, output, max_matches)); |
1033 for (int j = 0; j < max_matches; ++j) { | 1033 for (int j = 0; j < max_matches; ++j) { |
1034 EXPECT_EQ(test_cases[i].matches[j].experiment_relevance, | 1034 EXPECT_EQ(test_cases[i].matches[j].experiment_relevance, |
1035 matches_[j].relevance); | 1035 matches_[j].relevance); |
1036 } | 1036 } |
1037 } | 1037 } |
1038 } | 1038 } |
OLD | NEW |