summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-02 21:40:00 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-02 21:40:00 +0000
commitd486a085bd85065f8952d43f20e3f2c622ef7b7a (patch)
tree6b56ee8893dd1660a3c2ed7a2ecb8a5c8d948441 /chrome/browser/autocomplete
parent740847d37d057d41ea5956ec0cb123a7dbd5b904 (diff)
downloadchromium_src-d486a085bd85065f8952d43f20e3f2c622ef7b7a.zip
chromium_src-d486a085bd85065f8952d43f20e3f2c622ef7b7a.tar.gz
chromium_src-d486a085bd85065f8952d43f20e3f2c622ef7b7a.tar.bz2
Unittest for fix to allow navigation when there is no history DB.
BUG=25822 TEST=none Review URL: http://codereview.chromium.org/343067 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30744 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete')
-rw-r--r--chrome/browser/autocomplete/history_contents_provider_unittest.cc2
-rw-r--r--chrome/browser/autocomplete/history_url_provider_unittest.cc36
-rw-r--r--chrome/browser/autocomplete/search_provider_unittest.cc2
3 files changed, 33 insertions, 7 deletions
diff --git a/chrome/browser/autocomplete/history_contents_provider_unittest.cc b/chrome/browser/autocomplete/history_contents_provider_unittest.cc
index 1afbd88..f956228 100644
--- a/chrome/browser/autocomplete/history_contents_provider_unittest.cc
+++ b/chrome/browser/autocomplete/history_contents_provider_unittest.cc
@@ -54,7 +54,7 @@ class HistoryContentsProviderTest : public testing::Test,
// testing::Test
virtual void SetUp() {
profile_.reset(new TestingProfile());
- profile_->CreateHistoryService(false);
+ profile_->CreateHistoryService(false, false);
HistoryService* history_service =
profile_->GetHistoryService(Profile::EXPLICIT_ACCESS);
diff --git a/chrome/browser/autocomplete/history_url_provider_unittest.cc b/chrome/browser/autocomplete/history_url_provider_unittest.cc
index 6254e7f..e11b7e5 100644
--- a/chrome/browser/autocomplete/history_url_provider_unittest.cc
+++ b/chrome/browser/autocomplete/history_url_provider_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -105,10 +105,15 @@ class HistoryURLProviderTest : public testing::Test,
protected:
// testing::Test
- virtual void SetUp();
+ virtual void SetUp() {
+ SetUpImpl(false);
+ }
virtual void TearDown();
- // Fills test data into the history system
+ // Does the real setup.
+ void SetUpImpl(bool no_db);
+
+ // Fills test data into the history system.
void FillData();
// Runs an autocomplete query on |text| and checks to see that the returned
@@ -130,16 +135,23 @@ class HistoryURLProviderTest : public testing::Test,
scoped_refptr<HistoryURLProvider> autocomplete_;
};
+class HistoryURLProviderTestNoDB : public HistoryURLProviderTest {
+ protected:
+ virtual void SetUp() {
+ SetUpImpl(true);
+ }
+};
+
void HistoryURLProviderTest::OnProviderUpdate(bool updated_matches) {
if (autocomplete_->done())
MessageLoop::current()->Quit();
}
-void HistoryURLProviderTest::SetUp() {
+void HistoryURLProviderTest::SetUpImpl(bool no_db) {
profile_.reset(new TestingProfile());
profile_->CreateBookmarkModel(true);
profile_->BlockUntilBookmarkModelLoaded();
- profile_->CreateHistoryService(true);
+ profile_->CreateHistoryService(true, no_db);
history_service_ = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS);
autocomplete_ = new HistoryURLProvider(this, profile_.get());
@@ -384,3 +396,17 @@ TEST_F(HistoryURLProviderTest, Fixup) {
std::string fixup_5[] = {"http://www.17173.com/"};
RunTest(L"17173", std::wstring(), false, fixup_5, arraysize(fixup_5));
}
+
+TEST_F(HistoryURLProviderTestNoDB, NavigateWithoutDB) {
+ // Ensure that we will still produce matches for navigation when there is no
+ // database.
+ std::string navigation_1[] = {"http://test.com/"};
+ RunTest(L"test.com", std::wstring(), false, navigation_1,
+ arraysize(navigation_1));
+
+ std::string navigation_2[] = {"http://slash/"};
+ RunTest(L"slash", std::wstring(), false, navigation_2,
+ arraysize(navigation_2));
+
+ RunTest(L"this is a query", std::wstring(), false, NULL, 0);
+}
diff --git a/chrome/browser/autocomplete/search_provider_unittest.cc b/chrome/browser/autocomplete/search_provider_unittest.cc
index b5f9bcd..9b53178 100644
--- a/chrome/browser/autocomplete/search_provider_unittest.cc
+++ b/chrome/browser/autocomplete/search_provider_unittest.cc
@@ -88,7 +88,7 @@ void SearchProviderTest::SetUp() {
SearchProvider::set_query_suggest_immediately(true);
// We need both the history service and template url model loaded.
- profile_.CreateHistoryService(true);
+ profile_.CreateHistoryService(true, false);
profile_.CreateTemplateURLModel();
TemplateURLModel* turl_model = profile_.GetTemplateURLModel();