OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser_thread.h" | 13 #include "chrome/browser/browser_thread.h" |
14 #include "chrome/browser/history/history.h" | 14 #include "chrome/browser/history/history.h" |
| 15 #include "chrome/test/testing_browser_process.h" |
| 16 #include "chrome/test/testing_browser_process_test.h" |
15 #include "chrome/test/testing_profile.h" | 17 #include "chrome/test/testing_profile.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
17 | 19 |
18 using base::Time; | 20 using base::Time; |
19 using base::TimeDelta; | 21 using base::TimeDelta; |
20 | 22 |
21 namespace { | 23 namespace { |
22 | 24 |
23 struct TestEntry { | 25 struct TestEntry { |
24 const char* url; | 26 const char* url; |
25 const char* title; | 27 const char* title; |
26 const char* body; | 28 const char* body; |
27 } test_entries[] = { | 29 } test_entries[] = { |
28 {"http://www.google.com/1", "PAGEONE 1", "FOO some body text"}, | 30 {"http://www.google.com/1", "PAGEONE 1", "FOO some body text"}, |
29 {"http://www.google.com/2", "PAGEONE 2", "FOO some more blah blah"}, | 31 {"http://www.google.com/2", "PAGEONE 2", "FOO some more blah blah"}, |
30 {"http://www.google.com/3", "PAGETHREE 3", "BAR some hello world for you"}, | 32 {"http://www.google.com/3", "PAGETHREE 3", "BAR some hello world for you"}, |
31 }; | 33 }; |
32 | 34 |
33 class HistoryContentsProviderTest : public testing::Test, | 35 class HistoryContentsProviderTest : public TestingBrowserProcessTest, |
34 public ACProviderListener { | 36 public ACProviderListener { |
35 public: | 37 public: |
36 HistoryContentsProviderTest() | 38 HistoryContentsProviderTest() |
37 : ui_thread_(BrowserThread::UI, &message_loop_), | 39 : ui_thread_(BrowserThread::UI, &message_loop_), |
38 file_thread_(BrowserThread::FILE, &message_loop_) {} | 40 file_thread_(BrowserThread::FILE, &message_loop_) {} |
39 | 41 |
40 void RunQuery(const AutocompleteInput& input, | 42 void RunQuery(const AutocompleteInput& input, |
41 bool minimal_changes) { | 43 bool minimal_changes) { |
42 provider_->Start(input, minimal_changes); | 44 provider_->Start(input, minimal_changes); |
43 | 45 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 true, false); | 242 true, false); |
241 RunQuery(you_input, false); | 243 RunQuery(you_input, false); |
242 EXPECT_EQ(0U, matches().size()); | 244 EXPECT_EQ(0U, matches().size()); |
243 | 245 |
244 // Run a query that matches the bookmark | 246 // Run a query that matches the bookmark |
245 RunQuery(input, false); | 247 RunQuery(input, false); |
246 EXPECT_EQ(1U, matches().size()); | 248 EXPECT_EQ(1U, matches().size()); |
247 } | 249 } |
248 | 250 |
249 } // namespace | 251 } // namespace |
OLD | NEW |