| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // History unit tests come in two flavors: | 5 // History unit tests come in two flavors: |
| 6 // | 6 // |
| 7 // 1. The more complicated style is that the unit test creates a full history | 7 // 1. The more complicated style is that the unit test creates a full history |
| 8 // service. This spawns a background thread for the history backend, and | 8 // service. This spawns a background thread for the history backend, and |
| 9 // all communication is asynchronous. This is useful for testing more | 9 // all communication is asynchronous. This is useful for testing more |
| 10 // complicated things or end-to-end behavior. | 10 // complicated things or end-to-end behavior. |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 | 377 |
| 378 TEST_F(HistoryTest, AddPage) { | 378 TEST_F(HistoryTest, AddPage) { |
| 379 scoped_refptr<HistoryService> history(new HistoryService); | 379 scoped_refptr<HistoryService> history(new HistoryService); |
| 380 history_service_ = history; | 380 history_service_ = history; |
| 381 ASSERT_TRUE(history->Init(history_dir_, NULL)); | 381 ASSERT_TRUE(history->Init(history_dir_, NULL)); |
| 382 | 382 |
| 383 // Add the page once from a child frame. | 383 // Add the page once from a child frame. |
| 384 const GURL test_url("http://www.google.com/"); | 384 const GURL test_url("http://www.google.com/"); |
| 385 history->AddPage(test_url, NULL, 0, GURL(), | 385 history->AddPage(test_url, NULL, 0, GURL(), |
| 386 PageTransition::MANUAL_SUBFRAME, | 386 PageTransition::MANUAL_SUBFRAME, |
| 387 HistoryService::RedirectList()); | 387 HistoryService::RedirectList(), false); |
| 388 EXPECT_TRUE(QueryURL(history, test_url)); | 388 EXPECT_TRUE(QueryURL(history, test_url)); |
| 389 EXPECT_EQ(1, query_url_row_.visit_count()); | 389 EXPECT_EQ(1, query_url_row_.visit_count()); |
| 390 EXPECT_EQ(0, query_url_row_.typed_count()); | 390 EXPECT_EQ(0, query_url_row_.typed_count()); |
| 391 EXPECT_TRUE(query_url_row_.hidden()); // Hidden because of child frame. | 391 EXPECT_TRUE(query_url_row_.hidden()); // Hidden because of child frame. |
| 392 | 392 |
| 393 // Add the page once from the main frame (should unhide it). | 393 // Add the page once from the main frame (should unhide it). |
| 394 history->AddPage(test_url, NULL, 0, GURL(), PageTransition::LINK, | 394 history->AddPage(test_url, NULL, 0, GURL(), PageTransition::LINK, |
| 395 HistoryService::RedirectList()); | 395 HistoryService::RedirectList(), false); |
| 396 EXPECT_TRUE(QueryURL(history, test_url)); | 396 EXPECT_TRUE(QueryURL(history, test_url)); |
| 397 EXPECT_EQ(2, query_url_row_.visit_count()); // Added twice. | 397 EXPECT_EQ(2, query_url_row_.visit_count()); // Added twice. |
| 398 EXPECT_EQ(0, query_url_row_.typed_count()); // Never typed. | 398 EXPECT_EQ(0, query_url_row_.typed_count()); // Never typed. |
| 399 EXPECT_FALSE(query_url_row_.hidden()); // Because loaded in main frame. | 399 EXPECT_FALSE(query_url_row_.hidden()); // Because loaded in main frame. |
| 400 } | 400 } |
| 401 | 401 |
| 402 TEST_F(HistoryTest, AddPageSameTimes) { | 402 TEST_F(HistoryTest, AddPageSameTimes) { |
| 403 scoped_refptr<HistoryService> history(new HistoryService); | 403 scoped_refptr<HistoryService> history(new HistoryService); |
| 404 history_service_ = history; | 404 history_service_ = history; |
| 405 ASSERT_TRUE(history->Init(history_dir_, NULL)); | 405 ASSERT_TRUE(history->Init(history_dir_, NULL)); |
| 406 | 406 |
| 407 Time now = Time::Now(); | 407 Time now = Time::Now(); |
| 408 const GURL test_urls[] = { | 408 const GURL test_urls[] = { |
| 409 GURL("http://timer.first.page/"), | 409 GURL("http://timer.first.page/"), |
| 410 GURL("http://timer.second.page/"), | 410 GURL("http://timer.second.page/"), |
| 411 GURL("http://timer.third.page/"), | 411 GURL("http://timer.third.page/"), |
| 412 }; | 412 }; |
| 413 | 413 |
| 414 // Make sure that two pages added at the same time with no intervening | 414 // Make sure that two pages added at the same time with no intervening |
| 415 // additions have different timestamps. | 415 // additions have different timestamps. |
| 416 history->AddPage(test_urls[0], now, NULL, 0, GURL(), | 416 history->AddPage(test_urls[0], now, NULL, 0, GURL(), |
| 417 PageTransition::LINK, | 417 PageTransition::LINK, |
| 418 HistoryService::RedirectList()); | 418 HistoryService::RedirectList(), false); |
| 419 EXPECT_TRUE(QueryURL(history, test_urls[0])); | 419 EXPECT_TRUE(QueryURL(history, test_urls[0])); |
| 420 EXPECT_EQ(1, query_url_row_.visit_count()); | 420 EXPECT_EQ(1, query_url_row_.visit_count()); |
| 421 EXPECT_TRUE(now == query_url_row_.last_visit()); // gtest doesn't like Time | 421 EXPECT_TRUE(now == query_url_row_.last_visit()); // gtest doesn't like Time |
| 422 | 422 |
| 423 history->AddPage(test_urls[1], now, NULL, 0, GURL(), | 423 history->AddPage(test_urls[1], now, NULL, 0, GURL(), |
| 424 PageTransition::LINK, | 424 PageTransition::LINK, |
| 425 HistoryService::RedirectList()); | 425 HistoryService::RedirectList(), false); |
| 426 EXPECT_TRUE(QueryURL(history, test_urls[1])); | 426 EXPECT_TRUE(QueryURL(history, test_urls[1])); |
| 427 EXPECT_EQ(1, query_url_row_.visit_count()); | 427 EXPECT_EQ(1, query_url_row_.visit_count()); |
| 428 EXPECT_TRUE(now + TimeDelta::FromMicroseconds(1) == | 428 EXPECT_TRUE(now + TimeDelta::FromMicroseconds(1) == |
| 429 query_url_row_.last_visit()); | 429 query_url_row_.last_visit()); |
| 430 | 430 |
| 431 // Make sure the next page, at a different time, is also correct. | 431 // Make sure the next page, at a different time, is also correct. |
| 432 history->AddPage(test_urls[2], now + TimeDelta::FromMinutes(1), | 432 history->AddPage(test_urls[2], now + TimeDelta::FromMinutes(1), |
| 433 NULL, 0, GURL(), | 433 NULL, 0, GURL(), |
| 434 PageTransition::LINK, | 434 PageTransition::LINK, |
| 435 HistoryService::RedirectList()); | 435 HistoryService::RedirectList(), false); |
| 436 EXPECT_TRUE(QueryURL(history, test_urls[2])); | 436 EXPECT_TRUE(QueryURL(history, test_urls[2])); |
| 437 EXPECT_EQ(1, query_url_row_.visit_count()); | 437 EXPECT_EQ(1, query_url_row_.visit_count()); |
| 438 EXPECT_TRUE(now + TimeDelta::FromMinutes(1) == | 438 EXPECT_TRUE(now + TimeDelta::FromMinutes(1) == |
| 439 query_url_row_.last_visit()); | 439 query_url_row_.last_visit()); |
| 440 } | 440 } |
| 441 | 441 |
| 442 TEST_F(HistoryTest, AddRedirect) { | 442 TEST_F(HistoryTest, AddRedirect) { |
| 443 scoped_refptr<HistoryService> history(new HistoryService); | 443 scoped_refptr<HistoryService> history(new HistoryService); |
| 444 history_service_ = history; | 444 history_service_ = history; |
| 445 ASSERT_TRUE(history->Init(history_dir_, NULL)); | 445 ASSERT_TRUE(history->Init(history_dir_, NULL)); |
| 446 | 446 |
| 447 const char* first_sequence[] = { | 447 const char* first_sequence[] = { |
| 448 "http://first.page/", | 448 "http://first.page/", |
| 449 "http://second.page/"}; | 449 "http://second.page/"}; |
| 450 int first_count = arraysize(first_sequence); | 450 int first_count = arraysize(first_sequence); |
| 451 HistoryService::RedirectList first_redirects; | 451 HistoryService::RedirectList first_redirects; |
| 452 for (int i = 0; i < first_count; i++) | 452 for (int i = 0; i < first_count; i++) |
| 453 first_redirects.push_back(GURL(first_sequence[i])); | 453 first_redirects.push_back(GURL(first_sequence[i])); |
| 454 | 454 |
| 455 // Add the sequence of pages as a server with no referrer. Note that we need | 455 // Add the sequence of pages as a server with no referrer. Note that we need |
| 456 // to have a non-NULL page ID scope. | 456 // to have a non-NULL page ID scope. |
| 457 history->AddPage(first_redirects.back(), MakeFakeHost(1), 0, GURL(), | 457 history->AddPage(first_redirects.back(), MakeFakeHost(1), 0, GURL(), |
| 458 PageTransition::LINK, first_redirects); | 458 PageTransition::LINK, first_redirects, true); |
| 459 | 459 |
| 460 // The first page should be added once with a link visit type (because we set | 460 // The first page should be added once with a link visit type (because we set |
| 461 // LINK when we added the original URL, and a referrer of nowhere (0). | 461 // LINK when we added the original URL, and a referrer of nowhere (0). |
| 462 EXPECT_TRUE(QueryURL(history, first_redirects[0])); | 462 EXPECT_TRUE(QueryURL(history, first_redirects[0])); |
| 463 EXPECT_EQ(1, query_url_row_.visit_count()); | 463 EXPECT_EQ(1, query_url_row_.visit_count()); |
| 464 ASSERT_EQ(1U, query_url_visits_.size()); | 464 ASSERT_EQ(1U, query_url_visits_.size()); |
| 465 int64 first_visit = query_url_visits_[0].visit_id; | 465 int64 first_visit = query_url_visits_[0].visit_id; |
| 466 EXPECT_EQ(PageTransition::LINK | | 466 EXPECT_EQ(PageTransition::LINK | |
| 467 PageTransition::CHAIN_START, query_url_visits_[0].transition); | 467 PageTransition::CHAIN_START, query_url_visits_[0].transition); |
| 468 EXPECT_EQ(0, query_url_visits_[0].referring_visit); // No referrer. | 468 EXPECT_EQ(0, query_url_visits_[0].referring_visit); // No referrer. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 486 // Now add a client redirect from that second visit to a third, client | 486 // Now add a client redirect from that second visit to a third, client |
| 487 // redirects are tracked by the RenderView prior to updating history, | 487 // redirects are tracked by the RenderView prior to updating history, |
| 488 // so we pass in a CLIENT_REDIRECT qualifier to mock that behavior. | 488 // so we pass in a CLIENT_REDIRECT qualifier to mock that behavior. |
| 489 HistoryService::RedirectList second_redirects; | 489 HistoryService::RedirectList second_redirects; |
| 490 second_redirects.push_back(first_redirects[1]); | 490 second_redirects.push_back(first_redirects[1]); |
| 491 second_redirects.push_back(GURL("http://last.page/")); | 491 second_redirects.push_back(GURL("http://last.page/")); |
| 492 history->AddPage(second_redirects[1], MakeFakeHost(1), 1, | 492 history->AddPage(second_redirects[1], MakeFakeHost(1), 1, |
| 493 second_redirects[0], | 493 second_redirects[0], |
| 494 static_cast<PageTransition::Type>(PageTransition::LINK | | 494 static_cast<PageTransition::Type>(PageTransition::LINK | |
| 495 PageTransition::CLIENT_REDIRECT), | 495 PageTransition::CLIENT_REDIRECT), |
| 496 second_redirects); | 496 second_redirects, true); |
| 497 | 497 |
| 498 // The last page (source of the client redirect) should NOT have an | 498 // The last page (source of the client redirect) should NOT have an |
| 499 // additional visit added, because it was a client redirect (normally it | 499 // additional visit added, because it was a client redirect (normally it |
| 500 // would). We should only have 1 left over from the first sequence. | 500 // would). We should only have 1 left over from the first sequence. |
| 501 EXPECT_TRUE(QueryURL(history, second_redirects[0])); | 501 EXPECT_TRUE(QueryURL(history, second_redirects[0])); |
| 502 EXPECT_EQ(1, query_url_row_.visit_count()); | 502 EXPECT_EQ(1, query_url_row_.visit_count()); |
| 503 | 503 |
| 504 // The final page should be set as a client redirect from the previous visit. | 504 // The final page should be set as a client redirect from the previous visit. |
| 505 EXPECT_TRUE(QueryURL(history, second_redirects[1])); | 505 EXPECT_TRUE(QueryURL(history, second_redirects[1])); |
| 506 EXPECT_EQ(1, query_url_row_.visit_count()); | 506 EXPECT_EQ(1, query_url_row_.visit_count()); |
| 507 ASSERT_EQ(1U, query_url_visits_.size()); | 507 ASSERT_EQ(1U, query_url_visits_.size()); |
| 508 EXPECT_EQ(PageTransition::CLIENT_REDIRECT | | 508 EXPECT_EQ(PageTransition::CLIENT_REDIRECT | |
| 509 PageTransition::CHAIN_END, query_url_visits_[0].transition); | 509 PageTransition::CHAIN_END, query_url_visits_[0].transition); |
| 510 EXPECT_EQ(second_visit, query_url_visits_[0].referring_visit); | 510 EXPECT_EQ(second_visit, query_url_visits_[0].referring_visit); |
| 511 } | 511 } |
| 512 | 512 |
| 513 TEST_F(HistoryTest, Typed) { | 513 TEST_F(HistoryTest, Typed) { |
| 514 scoped_refptr<HistoryService> history(new HistoryService); | 514 scoped_refptr<HistoryService> history(new HistoryService); |
| 515 history_service_ = history; | 515 history_service_ = history; |
| 516 ASSERT_TRUE(history->Init(history_dir_, NULL)); | 516 ASSERT_TRUE(history->Init(history_dir_, NULL)); |
| 517 | 517 |
| 518 // Add the page once as typed. | 518 // Add the page once as typed. |
| 519 const GURL test_url("http://www.google.com/"); | 519 const GURL test_url("http://www.google.com/"); |
| 520 history->AddPage(test_url, NULL, 0, GURL(), PageTransition::TYPED, | 520 history->AddPage(test_url, NULL, 0, GURL(), PageTransition::TYPED, |
| 521 HistoryService::RedirectList()); | 521 HistoryService::RedirectList(), false); |
| 522 EXPECT_TRUE(QueryURL(history, test_url)); | 522 EXPECT_TRUE(QueryURL(history, test_url)); |
| 523 | 523 |
| 524 // We should have the same typed & visit count. | 524 // We should have the same typed & visit count. |
| 525 EXPECT_EQ(1, query_url_row_.visit_count()); | 525 EXPECT_EQ(1, query_url_row_.visit_count()); |
| 526 EXPECT_EQ(1, query_url_row_.typed_count()); | 526 EXPECT_EQ(1, query_url_row_.typed_count()); |
| 527 | 527 |
| 528 // Add the page again not typed. | 528 // Add the page again not typed. |
| 529 history->AddPage(test_url, NULL, 0, GURL(), PageTransition::LINK, | 529 history->AddPage(test_url, NULL, 0, GURL(), PageTransition::LINK, |
| 530 HistoryService::RedirectList()); | 530 HistoryService::RedirectList(), false); |
| 531 EXPECT_TRUE(QueryURL(history, test_url)); | 531 EXPECT_TRUE(QueryURL(history, test_url)); |
| 532 | 532 |
| 533 // The second time should not have updated the typed count. | 533 // The second time should not have updated the typed count. |
| 534 EXPECT_EQ(2, query_url_row_.visit_count()); | 534 EXPECT_EQ(2, query_url_row_.visit_count()); |
| 535 EXPECT_EQ(1, query_url_row_.typed_count()); | 535 EXPECT_EQ(1, query_url_row_.typed_count()); |
| 536 | 536 |
| 537 // Add the page again as a generated URL. | 537 // Add the page again as a generated URL. |
| 538 history->AddPage(test_url, NULL, 0, GURL(), | 538 history->AddPage(test_url, NULL, 0, GURL(), |
| 539 PageTransition::GENERATED, HistoryService::RedirectList()); | 539 PageTransition::GENERATED, HistoryService::RedirectList(), |
| 540 false); |
| 540 EXPECT_TRUE(QueryURL(history, test_url)); | 541 EXPECT_TRUE(QueryURL(history, test_url)); |
| 541 | 542 |
| 542 // This should have worked like a link click. | 543 // This should have worked like a link click. |
| 543 EXPECT_EQ(3, query_url_row_.visit_count()); | 544 EXPECT_EQ(3, query_url_row_.visit_count()); |
| 544 EXPECT_EQ(1, query_url_row_.typed_count()); | 545 EXPECT_EQ(1, query_url_row_.typed_count()); |
| 545 | 546 |
| 546 // Add the page again as a reload. | 547 // Add the page again as a reload. |
| 547 history->AddPage(test_url, NULL, 0, GURL(), | 548 history->AddPage(test_url, NULL, 0, GURL(), |
| 548 PageTransition::RELOAD, HistoryService::RedirectList()); | 549 PageTransition::RELOAD, HistoryService::RedirectList(), |
| 550 false); |
| 549 EXPECT_TRUE(QueryURL(history, test_url)); | 551 EXPECT_TRUE(QueryURL(history, test_url)); |
| 550 | 552 |
| 551 // This should not have incremented any visit counts. | 553 // This should not have incremented any visit counts. |
| 552 EXPECT_EQ(3, query_url_row_.visit_count()); | 554 EXPECT_EQ(3, query_url_row_.visit_count()); |
| 553 EXPECT_EQ(1, query_url_row_.typed_count()); | 555 EXPECT_EQ(1, query_url_row_.typed_count()); |
| 554 } | 556 } |
| 555 | 557 |
| 556 TEST_F(HistoryTest, SetTitle) { | 558 TEST_F(HistoryTest, SetTitle) { |
| 557 scoped_refptr<HistoryService> history(new HistoryService); | 559 scoped_refptr<HistoryService> history(new HistoryService); |
| 558 history_service_ = history; | 560 history_service_ = history; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 587 scoped_refptr<HistoryService> history(new HistoryService); | 589 scoped_refptr<HistoryService> history(new HistoryService); |
| 588 history_service_ = history; | 590 history_service_ = history; |
| 589 | 591 |
| 590 ASSERT_TRUE(history->Init(history_dir_, NULL)); | 592 ASSERT_TRUE(history->Init(history_dir_, NULL)); |
| 591 | 593 |
| 592 static const void* scope = static_cast<void*>(this); | 594 static const void* scope = static_cast<void*>(this); |
| 593 | 595 |
| 594 // Add a URL. | 596 // Add a URL. |
| 595 const GURL existing_url("http://www.google.com/"); | 597 const GURL existing_url("http://www.google.com/"); |
| 596 history->AddPage(existing_url, scope, 0, GURL(), | 598 history->AddPage(existing_url, scope, 0, GURL(), |
| 597 PageTransition::TYPED, HistoryService::RedirectList()); | 599 PageTransition::TYPED, HistoryService::RedirectList(), |
| 600 false); |
| 598 | 601 |
| 599 // Make sure a segment was created. | 602 // Make sure a segment was created. |
| 600 history->QuerySegmentUsageSince( | 603 history->QuerySegmentUsageSince( |
| 601 &consumer_, Time::Now() - TimeDelta::FromDays(1), 10, | 604 &consumer_, Time::Now() - TimeDelta::FromDays(1), 10, |
| 602 NewCallback(static_cast<HistoryTest*>(this), | 605 NewCallback(static_cast<HistoryTest*>(this), |
| 603 &HistoryTest::OnSegmentUsageAvailable)); | 606 &HistoryTest::OnSegmentUsageAvailable)); |
| 604 | 607 |
| 605 // Wait for processing. | 608 // Wait for processing. |
| 606 MessageLoop::current()->Run(); | 609 MessageLoop::current()->Run(); |
| 607 | 610 |
| 608 ASSERT_EQ(1U, page_usage_data_->size()); | 611 ASSERT_EQ(1U, page_usage_data_->size()); |
| 609 EXPECT_TRUE(page_usage_data_[0]->GetURL() == existing_url); | 612 EXPECT_TRUE(page_usage_data_[0]->GetURL() == existing_url); |
| 610 EXPECT_DOUBLE_EQ(3.0, page_usage_data_[0]->GetScore()); | 613 EXPECT_DOUBLE_EQ(3.0, page_usage_data_[0]->GetScore()); |
| 611 | 614 |
| 612 // Add a URL which doesn't create a segment. | 615 // Add a URL which doesn't create a segment. |
| 613 const GURL link_url("http://yahoo.com/"); | 616 const GURL link_url("http://yahoo.com/"); |
| 614 history->AddPage(link_url, scope, 0, GURL(), | 617 history->AddPage(link_url, scope, 0, GURL(), |
| 615 PageTransition::LINK, HistoryService::RedirectList()); | 618 PageTransition::LINK, HistoryService::RedirectList(), |
| 619 false); |
| 616 | 620 |
| 617 // Query again | 621 // Query again |
| 618 history->QuerySegmentUsageSince( | 622 history->QuerySegmentUsageSince( |
| 619 &consumer_, Time::Now() - TimeDelta::FromDays(1), 10, | 623 &consumer_, Time::Now() - TimeDelta::FromDays(1), 10, |
| 620 NewCallback(static_cast<HistoryTest*>(this), | 624 NewCallback(static_cast<HistoryTest*>(this), |
| 621 &HistoryTest::OnSegmentUsageAvailable)); | 625 &HistoryTest::OnSegmentUsageAvailable)); |
| 622 | 626 |
| 623 // Wait for processing. | 627 // Wait for processing. |
| 624 MessageLoop::current()->Run(); | 628 MessageLoop::current()->Run(); |
| 625 | 629 |
| 626 // Make sure we still have one segment. | 630 // Make sure we still have one segment. |
| 627 ASSERT_EQ(1U, page_usage_data_->size()); | 631 ASSERT_EQ(1U, page_usage_data_->size()); |
| 628 EXPECT_TRUE(page_usage_data_[0]->GetURL() == existing_url); | 632 EXPECT_TRUE(page_usage_data_[0]->GetURL() == existing_url); |
| 629 | 633 |
| 630 // Add a page linked from existing_url. | 634 // Add a page linked from existing_url. |
| 631 history->AddPage(GURL("http://www.google.com/foo"), scope, 3, existing_url, | 635 history->AddPage(GURL("http://www.google.com/foo"), scope, 3, existing_url, |
| 632 PageTransition::LINK, HistoryService::RedirectList()); | 636 PageTransition::LINK, HistoryService::RedirectList(), |
| 637 false); |
| 633 | 638 |
| 634 // Query again | 639 // Query again |
| 635 history->QuerySegmentUsageSince( | 640 history->QuerySegmentUsageSince( |
| 636 &consumer_, Time::Now() - TimeDelta::FromDays(1), 10, | 641 &consumer_, Time::Now() - TimeDelta::FromDays(1), 10, |
| 637 NewCallback(static_cast<HistoryTest*>(this), | 642 NewCallback(static_cast<HistoryTest*>(this), |
| 638 &HistoryTest::OnSegmentUsageAvailable)); | 643 &HistoryTest::OnSegmentUsageAvailable)); |
| 639 | 644 |
| 640 // Wait for processing. | 645 // Wait for processing. |
| 641 MessageLoop::current()->Run(); | 646 MessageLoop::current()->Run(); |
| 642 | 647 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 // with reasonable defaults and the given NULL-terminated URL string. The | 756 // with reasonable defaults and the given NULL-terminated URL string. The |
| 752 // returned object will NOT be add-ref'ed, which is the responsibility of the | 757 // returned object will NOT be add-ref'ed, which is the responsibility of the |
| 753 // caller. | 758 // caller. |
| 754 HistoryAddPageArgs* MakeAddArgs(const GURL& url) { | 759 HistoryAddPageArgs* MakeAddArgs(const GURL& url) { |
| 755 return new HistoryAddPageArgs(url, | 760 return new HistoryAddPageArgs(url, |
| 756 Time::Now(), | 761 Time::Now(), |
| 757 kAddArgsScope, | 762 kAddArgsScope, |
| 758 0, | 763 0, |
| 759 GURL(), | 764 GURL(), |
| 760 HistoryService::RedirectList(), | 765 HistoryService::RedirectList(), |
| 761 PageTransition::TYPED); | 766 PageTransition::TYPED, false); |
| 762 } | 767 } |
| 763 | 768 |
| 764 // Convenience version of the above to convert a char string. | 769 // Convenience version of the above to convert a char string. |
| 765 HistoryAddPageArgs* MakeAddArgs(const char* url) { | 770 HistoryAddPageArgs* MakeAddArgs(const char* url) { |
| 766 return MakeAddArgs(GURL(url)); | 771 return MakeAddArgs(GURL(url)); |
| 767 } | 772 } |
| 768 | 773 |
| 769 // A HistoryDBTask implementation. Each time RunOnDBThread is invoked | 774 // A HistoryDBTask implementation. Each time RunOnDBThread is invoked |
| 770 // invoke_count is increment. When invoked kWantInvokeCount times, true is | 775 // invoke_count is increment. When invoked kWantInvokeCount times, true is |
| 771 // returned from RunOnDBThread which should stop RunOnDBThread from being | 776 // returned from RunOnDBThread which should stop RunOnDBThread from being |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 history_service_ = history; | 830 history_service_ = history; |
| 826 history->ScheduleDBTask(task.get(), &request_consumer); | 831 history->ScheduleDBTask(task.get(), &request_consumer); |
| 827 request_consumer.CancelAllRequests(); | 832 request_consumer.CancelAllRequests(); |
| 828 CleanupHistoryService(); | 833 CleanupHistoryService(); |
| 829 // WARNING: history has now been deleted. | 834 // WARNING: history has now been deleted. |
| 830 history = NULL; | 835 history = NULL; |
| 831 ASSERT_FALSE(task->done_invoked); | 836 ASSERT_FALSE(task->done_invoked); |
| 832 } | 837 } |
| 833 | 838 |
| 834 } // namespace history | 839 } // namespace history |
| OLD | NEW |