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/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_quick_provider.h" | 11 #include "chrome/browser/autocomplete/history_quick_provider.h" |
12 #include "chrome/browser/autocomplete/history_url_provider.h" | 12 #include "chrome/browser/autocomplete/history_url_provider.h" |
13 #include "chrome/browser/history/history.h" | 13 #include "chrome/browser/history/history.h" |
14 #include "chrome/browser/net/url_fixer_upper.h" | 14 #include "chrome/browser/net/url_fixer_upper.h" |
15 #include "chrome/test/base/testing_browser_process.h" | 15 #include "chrome/test/base/testing_browser_process.h" |
16 #include "chrome/test/base/testing_browser_process_test.h" | |
17 #include "chrome/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
18 #include "content/browser/browser_thread.h" | 17 #include "content/browser/browser_thread.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
20 | 19 |
21 using base::Time; | 20 using base::Time; |
22 using base::TimeDelta; | 21 using base::TimeDelta; |
23 | 22 |
24 struct TestURLInfo { | 23 struct TestURLInfo { |
25 const char* url; | 24 const char* url; |
26 const char* title; | 25 const char* title; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // URLs for testing ctrl-enter behavior. | 90 // URLs for testing ctrl-enter behavior. |
92 {"http://binky/", "Intranet binky", 2, 2}, | 91 {"http://binky/", "Intranet binky", 2, 2}, |
93 {"http://winky/", "Intranet winky", 2, 2}, | 92 {"http://winky/", "Intranet winky", 2, 2}, |
94 {"http://www.winky.com/", "Internet winky", 5, 0}, | 93 {"http://www.winky.com/", "Internet winky", 5, 0}, |
95 | 94 |
96 // URLs used by EmptyVisits. | 95 // URLs used by EmptyVisits. |
97 {"http://pandora.com/", "Pandora", 2, 2}, | 96 {"http://pandora.com/", "Pandora", 2, 2}, |
98 {"http://p/", "p", 0, 0}, | 97 {"http://p/", "p", 0, 0}, |
99 }; | 98 }; |
100 | 99 |
101 class HistoryURLProviderTest : public TestingBrowserProcessTest, | 100 class HistoryURLProviderTest : public testing::Test, |
102 public ACProviderListener { | 101 public ACProviderListener { |
103 public: | 102 public: |
104 HistoryURLProviderTest() | 103 HistoryURLProviderTest() |
105 : ui_thread_(BrowserThread::UI, &message_loop_), | 104 : ui_thread_(BrowserThread::UI, &message_loop_), |
106 file_thread_(BrowserThread::FILE, &message_loop_) { | 105 file_thread_(BrowserThread::FILE, &message_loop_) { |
107 HistoryQuickProvider::set_disabled(true); | 106 HistoryQuickProvider::set_disabled(true); |
108 } | 107 } |
109 | 108 |
110 virtual ~HistoryURLProviderTest() { | 109 virtual ~HistoryURLProviderTest() { |
111 HistoryQuickProvider::set_disabled(false); | 110 HistoryQuickProvider::set_disabled(false); |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 }; | 533 }; |
535 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { | 534 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { |
536 const std::string output[1] = { | 535 const std::string output[1] = { |
537 URLFixerUpper::FixupURL(test_cases[i].input, std::string()).spec() | 536 URLFixerUpper::FixupURL(test_cases[i].input, std::string()).spec() |
538 }; | 537 }; |
539 RunTest(ASCIIToUTF16(test_cases[i].input), string16(), false, | 538 RunTest(ASCIIToUTF16(test_cases[i].input), string16(), false, |
540 test_cases[i].has_output ? output : NULL, | 539 test_cases[i].has_output ? output : NULL, |
541 test_cases[i].has_output ? 1 : 0); | 540 test_cases[i].has_output ? 1 : 0); |
542 } | 541 } |
543 } | 542 } |
OLD | NEW |