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

Unified Diff: chrome/browser/history/history_unittest.cc

Issue 322983003: Rename HistoryService::NotifyRenderProcessHostDestruction (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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
Index: chrome/browser/history/history_unittest.cc
diff --git a/chrome/browser/history/history_unittest.cc b/chrome/browser/history/history_unittest.cc
index 411c712dae9d5ca72f9b1580996f2ff44058ad03..b3fdc693a2be9f9cf7d0f23edabd4b7bc79c213f 100644
--- a/chrome/browser/history/history_unittest.cc
+++ b/chrome/browser/history/history_unittest.cc
@@ -901,10 +901,10 @@ TEST_F(HistoryBackendDBTest,
// The tracker uses RenderProcessHost pointers for scoping but never
// dereferences them. We use ints because it's easier. This function converts
// between the two.
-static void* MakeFakeHost(int id) {
- void* host = 0;
- memcpy(&host, &id, sizeof(id));
- return host;
+static void* MakeFakeContextID(int id) {
+ ContextID context_id = 0;
sdefresne 2014/06/10 15:51:54 nit: can't this function be replaced with "Context
方觉(Fang Jue) 2014/06/11 12:41:46 n 2014/06/10 15:51:54, sdefresne wrote:
+ memcpy(&context_id, &id, sizeof(id));
+ return context_id;
}
class HistoryTest : public testing::Test {
@@ -963,7 +963,7 @@ class HistoryTest : public testing::Test {
void CleanupHistoryService() {
DCHECK(history_service_);
- history_service_->NotifyRenderProcessHostDestruction(0);
+ history_service_->ClearCachedDataForContextID(0);
history_service_->SetOnBackendDestroyTask(base::MessageLoop::QuitClosure());
history_service_->Cleanup();
history_service_.reset();
@@ -1098,7 +1098,7 @@ TEST_F(HistoryTest, AddRedirect) {
// Add the sequence of pages as a server with no referrer. Note that we need
// to have a non-NULL page ID scope.
history_service_->AddPage(
- first_redirects.back(), base::Time::Now(), MakeFakeHost(1),
+ first_redirects.back(), base::Time::Now(), MakeFakeContextID(1),
0, GURL(), first_redirects, content::PAGE_TRANSITION_LINK,
history::SOURCE_BROWSED, true);
@@ -1137,7 +1137,8 @@ TEST_F(HistoryTest, AddRedirect) {
second_redirects.push_back(first_redirects[1]);
second_redirects.push_back(GURL("http://last.page.com/"));
history_service_->AddPage(second_redirects[1], base::Time::Now(),
- MakeFakeHost(1), 1, second_redirects[0], second_redirects,
+ MakeFakeContextID(1), 1,
+ second_redirects[0], second_redirects,
static_cast<content::PageTransition>(
content::PAGE_TRANSITION_LINK |
content::PAGE_TRANSITION_CLIENT_REDIRECT),
@@ -1327,12 +1328,12 @@ TEST_F(HistoryTest, SetTitle) {
TEST_F(HistoryTest, DISABLED_Segments) {
ASSERT_TRUE(history_service_.get());
- static const void* scope = static_cast<void*>(this);
+ static ContextID context_id = static_cast<ContextID>(this);
// Add a URL.
const GURL existing_url("http://www.google.com/");
history_service_->AddPage(
- existing_url, base::Time::Now(), scope, 0, GURL(),
+ existing_url, base::Time::Now(), context_id, 0, GURL(),
history::RedirectList(), content::PAGE_TRANSITION_TYPED,
history::SOURCE_BROWSED, false);
@@ -1352,7 +1353,7 @@ TEST_F(HistoryTest, DISABLED_Segments) {
// Add a URL which doesn't create a segment.
const GURL link_url("http://yahoo.com/");
history_service_->AddPage(
- link_url, base::Time::Now(), scope, 0, GURL(),
+ link_url, base::Time::Now(), context_id, 0, GURL(),
history::RedirectList(), content::PAGE_TRANSITION_LINK,
history::SOURCE_BROWSED, false);
@@ -1372,7 +1373,7 @@ TEST_F(HistoryTest, DISABLED_Segments) {
// Add a page linked from existing_url.
history_service_->AddPage(
GURL("http://www.google.com/foo"), base::Time::Now(),
- scope, 3, existing_url, history::RedirectList(),
+ context_id, 3, existing_url, history::RedirectList(),
content::PAGE_TRANSITION_LINK, history::SOURCE_BROWSED,
false);
@@ -1402,15 +1403,15 @@ TEST_F(HistoryTest, MostVisitedURLs) {
const GURL url3("http://www.google.com/url3/");
const GURL url4("http://www.google.com/url4/");
- static const void* scope = static_cast<void*>(this);
+ static ContextID context_id = static_cast<ContextID>(this);
// Add two pages.
history_service_->AddPage(
- url0, base::Time::Now(), scope, 0, GURL(),
+ url0, base::Time::Now(), context_id, 0, GURL(),
history::RedirectList(), content::PAGE_TRANSITION_TYPED,
history::SOURCE_BROWSED, false);
history_service_->AddPage(
- url1, base::Time::Now(), scope, 0, GURL(),
+ url1, base::Time::Now(), context_id, 0, GURL(),
history::RedirectList(), content::PAGE_TRANSITION_TYPED,
history::SOURCE_BROWSED, false);
history_service_->QueryMostVisitedURLs(
@@ -1426,7 +1427,7 @@ TEST_F(HistoryTest, MostVisitedURLs) {
// Add another page.
history_service_->AddPage(
- url2, base::Time::Now(), scope, 0, GURL(),
+ url2, base::Time::Now(), context_id, 0, GURL(),
history::RedirectList(), content::PAGE_TRANSITION_TYPED,
history::SOURCE_BROWSED, false);
history_service_->QueryMostVisitedURLs(
@@ -1443,7 +1444,7 @@ TEST_F(HistoryTest, MostVisitedURLs) {
// Revisit url2, making it the top URL.
history_service_->AddPage(
- url2, base::Time::Now(), scope, 0, GURL(),
+ url2, base::Time::Now(), context_id, 0, GURL(),
history::RedirectList(), content::PAGE_TRANSITION_TYPED,
history::SOURCE_BROWSED, false);
history_service_->QueryMostVisitedURLs(
@@ -1460,7 +1461,7 @@ TEST_F(HistoryTest, MostVisitedURLs) {
// Revisit url1, making it the top URL.
history_service_->AddPage(
- url1, base::Time::Now(), scope, 0, GURL(),
+ url1, base::Time::Now(), context_id, 0, GURL(),
history::RedirectList(), content::PAGE_TRANSITION_TYPED,
history::SOURCE_BROWSED, false);
history_service_->QueryMostVisitedURLs(
@@ -1482,7 +1483,7 @@ TEST_F(HistoryTest, MostVisitedURLs) {
// Visit url4 using redirects.
history_service_->AddPage(
- url4, base::Time::Now(), scope, 0, GURL(),
+ url4, base::Time::Now(), context_id, 0, GURL(),
redirects, content::PAGE_TRANSITION_TYPED,
history::SOURCE_BROWSED, false);
history_service_->QueryMostVisitedURLs(

Powered by Google App Engine
This is Rietveld 408576698