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/message_loop.h" | 6 #include "base/message_loop.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/autocomplete/autocomplete_match.h" | 10 #include "chrome/browser/autocomplete/autocomplete_match.h" |
11 #include "chrome/browser/autocomplete/history_url_provider.h" | 11 #include "chrome/browser/autocomplete/history_url_provider.h" |
12 #include "chrome/browser/browser_thread.h" | 12 #include "chrome/browser/browser_thread.h" |
13 #include "chrome/browser/history/history.h" | 13 #include "chrome/browser/history/history.h" |
| 14 #include "chrome/test/testing_browser_process.h" |
| 15 #include "chrome/test/testing_browser_process_test.h" |
14 #include "chrome/test/testing_profile.h" | 16 #include "chrome/test/testing_profile.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
16 | 18 |
17 using base::Time; | 19 using base::Time; |
18 using base::TimeDelta; | 20 using base::TimeDelta; |
19 | 21 |
20 struct TestURLInfo { | 22 struct TestURLInfo { |
21 std::string url; | 23 std::string url; |
22 std::string title; | 24 std::string title; |
23 int visit_count; | 25 int visit_count; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 {"http://www.\xEA\xB5\x90\xEC\x9C\xA1.kr/", "Korean", 2, 2}, | 85 {"http://www.\xEA\xB5\x90\xEC\x9C\xA1.kr/", "Korean", 2, 2}, |
84 {"http://spaces.com/path%20with%20spaces/foo.html", "Spaces", 2, 2}, | 86 {"http://spaces.com/path%20with%20spaces/foo.html", "Spaces", 2, 2}, |
85 {"http://ms/c++%20style%20guide", "Style guide", 2, 2}, | 87 {"http://ms/c++%20style%20guide", "Style guide", 2, 2}, |
86 | 88 |
87 // URLs for testing ctrl-enter behavior. | 89 // URLs for testing ctrl-enter behavior. |
88 {"http://binky/", "Intranet binky", 2, 2}, | 90 {"http://binky/", "Intranet binky", 2, 2}, |
89 {"http://winky/", "Intranet winky", 2, 2}, | 91 {"http://winky/", "Intranet winky", 2, 2}, |
90 {"http://www.winky.com/", "Internet winky", 5, 0}, | 92 {"http://www.winky.com/", "Internet winky", 5, 0}, |
91 }; | 93 }; |
92 | 94 |
93 class HistoryURLProviderTest : public testing::Test, | 95 class HistoryURLProviderTest : public TestingBrowserProcessTest, |
94 public ACProviderListener { | 96 public ACProviderListener { |
95 public: | 97 public: |
96 HistoryURLProviderTest() | 98 HistoryURLProviderTest() |
97 : ui_thread_(BrowserThread::UI, &message_loop_), | 99 : ui_thread_(BrowserThread::UI, &message_loop_), |
98 file_thread_(BrowserThread::FILE, &message_loop_) {} | 100 file_thread_(BrowserThread::FILE, &message_loop_) {} |
99 | 101 |
100 // ACProviderListener | 102 // ACProviderListener |
101 virtual void OnProviderUpdate(bool updated_matches); | 103 virtual void OnProviderUpdate(bool updated_matches); |
102 | 104 |
103 protected: | 105 protected: |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 std::string navigation_1[] = {"http://test.com/"}; | 456 std::string navigation_1[] = {"http://test.com/"}; |
455 RunTest(ASCIIToUTF16("test.com"), string16(), false, navigation_1, | 457 RunTest(ASCIIToUTF16("test.com"), string16(), false, navigation_1, |
456 arraysize(navigation_1)); | 458 arraysize(navigation_1)); |
457 | 459 |
458 std::string navigation_2[] = {"http://slash/"}; | 460 std::string navigation_2[] = {"http://slash/"}; |
459 RunTest(ASCIIToUTF16("slash"), string16(), false, navigation_2, | 461 RunTest(ASCIIToUTF16("slash"), string16(), false, navigation_2, |
460 arraysize(navigation_2)); | 462 arraysize(navigation_2)); |
461 | 463 |
462 RunTest(ASCIIToUTF16("this is a query"), string16(), false, NULL, 0); | 464 RunTest(ASCIIToUTF16("this is a query"), string16(), false, NULL, 0); |
463 } | 465 } |
OLD | NEW |