| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/autocomplete/autocomplete.h" | 9 #include "chrome/browser/autocomplete/autocomplete.h" |
| 10 #include "chrome/browser/autocomplete/autocomplete_match.h" | 10 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 // We need the ID scope and page ID so that the visit tracker can find it. | 70 // We need the ID scope and page ID so that the visit tracker can find it. |
| 71 // We just use the index for the page ID below. | 71 // We just use the index for the page ID below. |
| 72 const void* id_scope = reinterpret_cast<void*>(1); | 72 const void* id_scope = reinterpret_cast<void*>(1); |
| 73 GURL url(test_entries[i].url); | 73 GURL url(test_entries[i].url); |
| 74 | 74 |
| 75 // Add everything in order of time. We don't want to have a time that | 75 // Add everything in order of time. We don't want to have a time that |
| 76 // is "right now" or it will nondeterministically appear in the results. | 76 // is "right now" or it will nondeterministically appear in the results. |
| 77 Time t = Time::Now() - TimeDelta::FromDays(arraysize(test_entries) + i); | 77 Time t = Time::Now() - TimeDelta::FromDays(arraysize(test_entries) + i); |
| 78 | 78 |
| 79 history_service->AddPage(url, t, id_scope, i, GURL(), | 79 history_service->AddPage(url, t, id_scope, i, GURL(), |
| 80 PageTransition::LINK, history::RedirectList(), | 80 content::PAGE_TRANSITION_LINK, |
| 81 history::RedirectList(), |
| 81 history::SOURCE_BROWSED, false); | 82 history::SOURCE_BROWSED, false); |
| 82 history_service->SetPageTitle(url, UTF8ToUTF16(test_entries[i].title)); | 83 history_service->SetPageTitle(url, UTF8ToUTF16(test_entries[i].title)); |
| 83 history_service->SetPageContents(url, UTF8ToUTF16(test_entries[i].body)); | 84 history_service->SetPageContents(url, UTF8ToUTF16(test_entries[i].body)); |
| 84 } | 85 } |
| 85 | 86 |
| 86 provider_ = new HistoryContentsProvider(this, profile_.get(), BodyOnly()); | 87 provider_ = new HistoryContentsProvider(this, profile_.get(), BodyOnly()); |
| 87 } | 88 } |
| 88 | 89 |
| 89 virtual void TearDown() { | 90 virtual void TearDown() { |
| 90 provider_ = NULL; | 91 provider_ = NULL; |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 true, AutocompleteInput::ALL_MATCHES); | 274 true, AutocompleteInput::ALL_MATCHES); |
| 274 RunQuery(you_input, false); | 275 RunQuery(you_input, false); |
| 275 EXPECT_EQ(0U, matches().size()); | 276 EXPECT_EQ(0U, matches().size()); |
| 276 | 277 |
| 277 // Run a query that matches the bookmark | 278 // Run a query that matches the bookmark |
| 278 RunQuery(input, false); | 279 RunQuery(input, false); |
| 279 EXPECT_EQ(1U, matches().size()); | 280 EXPECT_EQ(1U, matches().size()); |
| 280 } | 281 } |
| 281 | 282 |
| 282 } // namespace | 283 } // namespace |
| OLD | NEW |