| 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_contents_provider.h" | 5 #include "chrome/browser/autocomplete/history_contents_provider.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // We need the ID scope and page ID so that the visit tracker can find it. | 76 // We need the ID scope and page ID so that the visit tracker can find it. |
| 77 // We just use the index for the page ID below. | 77 // We just use the index for the page ID below. |
| 78 const void* id_scope = reinterpret_cast<void*>(1); | 78 const void* id_scope = reinterpret_cast<void*>(1); |
| 79 GURL url(test_entries[i].url); | 79 GURL url(test_entries[i].url); |
| 80 | 80 |
| 81 // Add everything in order of time. We don't want to have a time that | 81 // Add everything in order of time. We don't want to have a time that |
| 82 // is "right now" or it will nondeterministically appear in the results. | 82 // is "right now" or it will nondeterministically appear in the results. |
| 83 Time t = Time::Now() - TimeDelta::FromDays(arraysize(test_entries) + i); | 83 Time t = Time::Now() - TimeDelta::FromDays(arraysize(test_entries) + i); |
| 84 | 84 |
| 85 history_service->AddPage(url, t, id_scope, i, GURL(), | 85 history_service->AddPage(url, t, id_scope, i, GURL(), |
| 86 history::RedirectList(), |
| 86 content::PAGE_TRANSITION_LINK, | 87 content::PAGE_TRANSITION_LINK, |
| 87 history::RedirectList(), | |
| 88 history::SOURCE_BROWSED, false); | 88 history::SOURCE_BROWSED, false); |
| 89 history_service->SetPageTitle(url, UTF8ToUTF16(test_entries[i].title)); | 89 history_service->SetPageTitle(url, UTF8ToUTF16(test_entries[i].title)); |
| 90 history_service->SetPageContents(url, UTF8ToUTF16(test_entries[i].body)); | 90 history_service->SetPageContents(url, UTF8ToUTF16(test_entries[i].body)); |
| 91 } | 91 } |
| 92 | 92 |
| 93 provider_ = new HistoryContentsProvider(this, profile_.get(), BodyOnly()); | 93 provider_ = new HistoryContentsProvider(this, profile_.get(), BodyOnly()); |
| 94 } | 94 } |
| 95 | 95 |
| 96 virtual void TearDown() { | 96 virtual void TearDown() { |
| 97 provider_ = NULL; | 97 provider_ = NULL; |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 true, AutocompleteInput::ALL_MATCHES); | 282 true, AutocompleteInput::ALL_MATCHES); |
| 283 RunQuery(you_input, false); | 283 RunQuery(you_input, false); |
| 284 EXPECT_EQ(0U, matches().size()); | 284 EXPECT_EQ(0U, matches().size()); |
| 285 | 285 |
| 286 // Run a query that matches the bookmark | 286 // Run a query that matches the bookmark |
| 287 RunQuery(input, false); | 287 RunQuery(input, false); |
| 288 EXPECT_EQ(1U, matches().size()); | 288 EXPECT_EQ(1U, matches().size()); |
| 289 } | 289 } |
| 290 | 290 |
| 291 } // namespace | 291 } // namespace |
| OLD | NEW |