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 "chrome/browser/autocomplete/history_quick_provider.h" | 5 #include "chrome/browser/autocomplete/history_quick_provider.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
14 #include "base/scoped_ptr.h" | 14 #include "base/scoped_ptr.h" |
15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
16 #include "chrome/browser/autocomplete/autocomplete_match.h" | 16 #include "chrome/browser/autocomplete/autocomplete_match.h" |
17 #include "chrome/browser/browser_thread.h" | 17 #include "chrome/browser/browser_thread.h" |
18 #include "chrome/browser/history/history.h" | 18 #include "chrome/browser/history/history.h" |
19 #include "chrome/browser/history/url_database.h" | 19 #include "chrome/browser/history/url_database.h" |
20 #include "chrome/browser/prefs/pref_service.h" | 20 #include "chrome/browser/prefs/pref_service.h" |
21 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
| 22 #include "chrome/test/testing_browser_process.h" |
| 23 #include "chrome/test/testing_browser_process_test.h" |
22 #include "chrome/test/testing_profile.h" | 24 #include "chrome/test/testing_profile.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
24 | 26 |
25 using base::Time; | 27 using base::Time; |
26 using base::TimeDelta; | 28 using base::TimeDelta; |
27 | 29 |
28 struct TestURLInfo { | 30 struct TestURLInfo { |
29 std::string url; | 31 std::string url; |
30 std::string title; | 32 std::string title; |
31 int visit_count; | 33 int visit_count; |
(...skipping 25 matching lines...) Expand all Loading... |
57 {"http://startest.com/y/l", "L", 1, 1, 6}, | 59 {"http://startest.com/y/l", "L", 1, 1, 6}, |
58 {"http://startest.com/y/m", "M", 1, 1, 6}, | 60 {"http://startest.com/y/m", "M", 1, 1, 6}, |
59 {"http://abcdefghixyzjklmnopqrstuvw.com/a", "An XYZ", 1, 1, 0}, | 61 {"http://abcdefghixyzjklmnopqrstuvw.com/a", "An XYZ", 1, 1, 0}, |
60 {"http://spaces.com/path%20with%20spaces/foo.html", "Spaces", 2, 2, 0}, | 62 {"http://spaces.com/path%20with%20spaces/foo.html", "Spaces", 2, 2, 0}, |
61 {"http://abcdefghijklxyzmnopqrstuvw.com/a", "An XYZ", 1, 1, 0}, | 63 {"http://abcdefghijklxyzmnopqrstuvw.com/a", "An XYZ", 1, 1, 0}, |
62 {"http://abcdefxyzghijklmnopqrstuvw.com/a", "An XYZ", 1, 1, 0}, | 64 {"http://abcdefxyzghijklmnopqrstuvw.com/a", "An XYZ", 1, 1, 0}, |
63 {"http://abcxyzdefghijklmnopqrstuvw.com/a", "An XYZ", 1, 1, 0}, | 65 {"http://abcxyzdefghijklmnopqrstuvw.com/a", "An XYZ", 1, 1, 0}, |
64 {"http://xyzabcdefghijklmnopqrstuvw.com/a", "An XYZ", 1, 1, 0}, | 66 {"http://xyzabcdefghijklmnopqrstuvw.com/a", "An XYZ", 1, 1, 0}, |
65 }; | 67 }; |
66 | 68 |
67 class HistoryQuickProviderTest : public testing::Test, | 69 class HistoryQuickProviderTest : public TestingBrowserProcessTest, |
68 public ACProviderListener { | 70 public ACProviderListener { |
69 public: | 71 public: |
70 HistoryQuickProviderTest() | 72 HistoryQuickProviderTest() |
71 : ui_thread_(BrowserThread::UI, &message_loop_), | 73 : ui_thread_(BrowserThread::UI, &message_loop_), |
72 file_thread_(BrowserThread::FILE, &message_loop_) {} | 74 file_thread_(BrowserThread::FILE, &message_loop_) {} |
73 | 75 |
74 // ACProviderListener | 76 // ACProviderListener |
75 virtual void OnProviderUpdate(bool updated_matches); | 77 virtual void OnProviderUpdate(bool updated_matches); |
76 | 78 |
77 protected: | 79 protected: |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 string16 text(ASCIIToUTF16("startest")); | 230 string16 text(ASCIIToUTF16("startest")); |
229 std::vector<std::string> expected_urls; | 231 std::vector<std::string> expected_urls; |
230 expected_urls.push_back("http://startest.com/y/a"); | 232 expected_urls.push_back("http://startest.com/y/a"); |
231 expected_urls.push_back("http://startest.com/y/b"); | 233 expected_urls.push_back("http://startest.com/y/b"); |
232 expected_urls.push_back("http://startest.com/x/c"); | 234 expected_urls.push_back("http://startest.com/x/c"); |
233 expected_urls.push_back("http://startest.com/x/d"); | 235 expected_urls.push_back("http://startest.com/x/d"); |
234 expected_urls.push_back("http://startest.com/y/e"); | 236 expected_urls.push_back("http://startest.com/y/e"); |
235 expected_urls.push_back("http://startest.com/y/f"); | 237 expected_urls.push_back("http://startest.com/y/f"); |
236 RunTest(text, expected_urls, "http://startest.com/y/a"); | 238 RunTest(text, expected_urls, "http://startest.com/y/a"); |
237 } | 239 } |
OLD | NEW |