Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(285)

Unified Diff: chrome/browser/autocomplete/history_quick_provider_unittest.cc

Issue 9316109: Move Ownership of IMUI to HistoryService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Qualify globally scoped friend classes. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/history/history.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autocomplete/history_quick_provider_unittest.cc
===================================================================
--- chrome/browser/autocomplete/history_quick_provider_unittest.cc (revision 120346)
+++ chrome/browser/autocomplete/history_quick_provider_unittest.cc (working copy)
@@ -18,6 +18,7 @@
#include "chrome/browser/history/history.h"
#include "chrome/browser/history/in_memory_url_index.h"
#include "chrome/browser/history/url_database.h"
+#include "chrome/browser/history/url_index_private_data.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_browser_process.h"
@@ -99,11 +100,8 @@
};
void SetUp();
+ void TearDown();
- void TearDown() {
- provider_ = NULL;
- }
-
virtual void GetTestData(size_t* data_count, TestURLInfo** test_data);
// Fills test data into the history system.
@@ -117,6 +115,9 @@
bool can_inline_top_result,
string16 expected_fill_into_edit);
+ // Pass-through functions to simplify our friendship with URLIndexPrivateData.
+ bool UpdateURL(const history::URLRow& row);
+
MessageLoopForUI message_loop_;
content::TestBrowserThread ui_thread_;
content::TestBrowserThread file_thread_;
@@ -141,6 +142,18 @@
FillData();
}
+void HistoryQuickProviderTest::TearDown() {
+ provider_ = NULL;
+}
+
+bool HistoryQuickProviderTest::UpdateURL(const history::URLRow& row) {
+ history::InMemoryURLIndex* index = provider_->GetIndex();
+ DCHECK(index);
+ history::URLIndexPrivateData* private_data = index->private_data();
+ DCHECK(private_data);
+ return private_data->UpdateURL(row);
+}
+
void HistoryQuickProviderTest::OnProviderUpdate(bool updated_matches) {
MessageLoop::current()->Quit();
}
@@ -156,12 +169,6 @@
void HistoryQuickProviderTest::FillData() {
history::URLDatabase* db = history_service_->InMemoryDatabase();
ASSERT_TRUE(db != NULL);
-
- history::InMemoryURLIndex* index =
- new history::InMemoryURLIndex(FilePath());
- PrefService* prefs = profile_->GetPrefs();
- std::string languages(prefs->GetString(prefs::kAcceptLanguages));
- index->Init(db, languages);
size_t data_count = 0;
TestURLInfo* test_data = NULL;
GetTestData(&data_count, &test_data);
@@ -171,15 +178,14 @@
Time visit_time = Time::Now() - TimeDelta::FromDays(cur.days_from_now);
history::URLRow url_info(current_url);
+ url_info.set_id(i + 5000);
url_info.set_title(UTF8ToUTF16(cur.title));
url_info.set_visit_count(cur.visit_count);
url_info.set_typed_count(cur.typed_count);
url_info.set_last_visit(visit_time);
url_info.set_hidden(false);
- index->UpdateURL(i, url_info);
+ UpdateURL(url_info);
}
-
- provider_->set_index(index);
}
HistoryQuickProviderTest::SetShouldContain::SetShouldContain(
« no previous file with comments | « no previous file | chrome/browser/history/history.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698