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" |
11 #include "chrome/browser/autocomplete/history_contents_provider.h" | 11 #include "chrome/browser/autocomplete/history_contents_provider.h" |
12 #include "chrome/browser/bookmarks/bookmark_model.h" | 12 #include "chrome/browser/bookmarks/bookmark_model.h" |
13 #include "chrome/browser/history/history.h" | 13 #include "chrome/browser/history/history.h" |
14 #include "chrome/test/base/testing_browser_process.h" | 14 #include "chrome/test/base/testing_browser_process.h" |
15 #include "chrome/test/base/testing_browser_process_test.h" | |
16 #include "chrome/test/base/testing_profile.h" | 15 #include "chrome/test/base/testing_profile.h" |
17 #include "content/browser/browser_thread.h" | 16 #include "content/browser/browser_thread.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
19 | 18 |
20 using base::Time; | 19 using base::Time; |
21 using base::TimeDelta; | 20 using base::TimeDelta; |
22 | 21 |
23 namespace { | 22 namespace { |
24 | 23 |
25 struct TestEntry { | 24 struct TestEntry { |
26 const char* url; | 25 const char* url; |
27 const char* title; | 26 const char* title; |
28 const char* body; | 27 const char* body; |
29 } test_entries[] = { | 28 } test_entries[] = { |
30 {"http://www.google.com/1", "PAGEONE 1", "FOO some body text"}, | 29 {"http://www.google.com/1", "PAGEONE 1", "FOO some body text"}, |
31 {"http://www.google.com/2", "PAGEONE 2", "FOO some more blah blah"}, | 30 {"http://www.google.com/2", "PAGEONE 2", "FOO some more blah blah"}, |
32 {"http://www.google.com/3", "PAGETHREE 3", "BAR some hello world for you"}, | 31 {"http://www.google.com/3", "PAGETHREE 3", "BAR some hello world for you"}, |
33 }; | 32 }; |
34 | 33 |
35 class HistoryContentsProviderTest : public TestingBrowserProcessTest, | 34 class HistoryContentsProviderTest : public testing::Test, |
36 public ACProviderListener { | 35 public ACProviderListener { |
37 public: | 36 public: |
38 HistoryContentsProviderTest() | 37 HistoryContentsProviderTest() |
39 : ui_thread_(BrowserThread::UI, &message_loop_), | 38 : ui_thread_(BrowserThread::UI, &message_loop_), |
40 file_thread_(BrowserThread::FILE, &message_loop_) {} | 39 file_thread_(BrowserThread::FILE, &message_loop_) {} |
41 | 40 |
42 void RunQuery(const AutocompleteInput& input, | 41 void RunQuery(const AutocompleteInput& input, |
43 bool minimal_changes) { | 42 bool minimal_changes) { |
44 provider_->Start(input, minimal_changes); | 43 provider_->Start(input, minimal_changes); |
45 | 44 |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 true, AutocompleteInput::ALL_MATCHES); | 270 true, AutocompleteInput::ALL_MATCHES); |
272 RunQuery(you_input, false); | 271 RunQuery(you_input, false); |
273 EXPECT_EQ(0U, matches().size()); | 272 EXPECT_EQ(0U, matches().size()); |
274 | 273 |
275 // Run a query that matches the bookmark | 274 // Run a query that matches the bookmark |
276 RunQuery(input, false); | 275 RunQuery(input, false); |
277 EXPECT_EQ(1U, matches().size()); | 276 EXPECT_EQ(1U, matches().size()); |
278 } | 277 } |
279 | 278 |
280 } // namespace | 279 } // namespace |
OLD | NEW |