| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 16 matching lines...) Expand all Loading... |
| 27 #include "base/bind_helpers.h" | 27 #include "base/bind_helpers.h" |
| 28 #include "base/callback.h" | 28 #include "base/callback.h" |
| 29 #include "base/command_line.h" | 29 #include "base/command_line.h" |
| 30 #include "base/file_path.h" | 30 #include "base/file_path.h" |
| 31 #include "base/file_util.h" | 31 #include "base/file_util.h" |
| 32 #include "base/memory/scoped_vector.h" | 32 #include "base/memory/scoped_vector.h" |
| 33 #include "base/message_loop.h" | 33 #include "base/message_loop.h" |
| 34 #include "base/path_service.h" | 34 #include "base/path_service.h" |
| 35 #include "base/scoped_temp_dir.h" | 35 #include "base/scoped_temp_dir.h" |
| 36 #include "base/string_util.h" | 36 #include "base/string_util.h" |
| 37 #include "base/time.h" |
| 37 #include "base/utf_string_conversions.h" | 38 #include "base/utf_string_conversions.h" |
| 38 #include "chrome/browser/history/history.h" | 39 #include "chrome/browser/history/history.h" |
| 39 #include "chrome/browser/history/history_backend.h" | 40 #include "chrome/browser/history/history_backend.h" |
| 40 #include "chrome/browser/history/history_database.h" | 41 #include "chrome/browser/history/history_database.h" |
| 41 #include "chrome/browser/history/history_notifications.h" | 42 #include "chrome/browser/history/history_notifications.h" |
| 42 #include "chrome/browser/history/in_memory_database.h" | 43 #include "chrome/browser/history/in_memory_database.h" |
| 43 #include "chrome/browser/history/in_memory_history_backend.h" | 44 #include "chrome/browser/history/in_memory_history_backend.h" |
| 44 #include "chrome/browser/history/page_usage_data.h" | 45 #include "chrome/browser/history/page_usage_data.h" |
| 45 #include "chrome/common/chrome_constants.h" | 46 #include "chrome/common/chrome_constants.h" |
| 46 #include "chrome/common/chrome_paths.h" | 47 #include "chrome/common/chrome_paths.h" |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 } | 470 } |
| 470 } | 471 } |
| 471 | 472 |
| 472 TEST_F(HistoryTest, AddPage) { | 473 TEST_F(HistoryTest, AddPage) { |
| 473 scoped_refptr<HistoryService> history(new HistoryService); | 474 scoped_refptr<HistoryService> history(new HistoryService); |
| 474 history_service_ = history; | 475 history_service_ = history; |
| 475 ASSERT_TRUE(history->Init(history_dir_, NULL)); | 476 ASSERT_TRUE(history->Init(history_dir_, NULL)); |
| 476 | 477 |
| 477 // Add the page once from a child frame. | 478 // Add the page once from a child frame. |
| 478 const GURL test_url("http://www.google.com/"); | 479 const GURL test_url("http://www.google.com/"); |
| 479 history->AddPage(test_url, NULL, 0, GURL(), | 480 history->AddPage(test_url, base::Time::Now(), NULL, 0, GURL(), |
| 481 history::RedirectList(), |
| 480 content::PAGE_TRANSITION_MANUAL_SUBFRAME, | 482 content::PAGE_TRANSITION_MANUAL_SUBFRAME, |
| 481 history::RedirectList(), | |
| 482 history::SOURCE_BROWSED, false); | 483 history::SOURCE_BROWSED, false); |
| 483 EXPECT_TRUE(QueryURL(history, test_url)); | 484 EXPECT_TRUE(QueryURL(history, test_url)); |
| 484 EXPECT_EQ(1, query_url_row_.visit_count()); | 485 EXPECT_EQ(1, query_url_row_.visit_count()); |
| 485 EXPECT_EQ(0, query_url_row_.typed_count()); | 486 EXPECT_EQ(0, query_url_row_.typed_count()); |
| 486 EXPECT_TRUE(query_url_row_.hidden()); // Hidden because of child frame. | 487 EXPECT_TRUE(query_url_row_.hidden()); // Hidden because of child frame. |
| 487 | 488 |
| 488 // Add the page once from the main frame (should unhide it). | 489 // Add the page once from the main frame (should unhide it). |
| 489 history->AddPage(test_url, NULL, 0, GURL(), content::PAGE_TRANSITION_LINK, | 490 history->AddPage(test_url, base::Time::Now(), NULL, 0, GURL(), |
| 490 history::RedirectList(), | 491 history::RedirectList(), content::PAGE_TRANSITION_LINK, |
| 491 history::SOURCE_BROWSED, false); | 492 history::SOURCE_BROWSED, false); |
| 492 EXPECT_TRUE(QueryURL(history, test_url)); | 493 EXPECT_TRUE(QueryURL(history, test_url)); |
| 493 EXPECT_EQ(2, query_url_row_.visit_count()); // Added twice. | 494 EXPECT_EQ(2, query_url_row_.visit_count()); // Added twice. |
| 494 EXPECT_EQ(0, query_url_row_.typed_count()); // Never typed. | 495 EXPECT_EQ(0, query_url_row_.typed_count()); // Never typed. |
| 495 EXPECT_FALSE(query_url_row_.hidden()); // Because loaded in main frame. | 496 EXPECT_FALSE(query_url_row_.hidden()); // Because loaded in main frame. |
| 496 } | 497 } |
| 497 | 498 |
| 498 TEST_F(HistoryTest, AddPageSameTimes) { | 499 TEST_F(HistoryTest, AddPageSameTimes) { |
| 499 scoped_refptr<HistoryService> history(new HistoryService); | 500 scoped_refptr<HistoryService> history(new HistoryService); |
| 500 history_service_ = history; | 501 history_service_ = history; |
| 501 ASSERT_TRUE(history->Init(history_dir_, NULL)); | 502 ASSERT_TRUE(history->Init(history_dir_, NULL)); |
| 502 | 503 |
| 503 Time now = Time::Now(); | 504 Time now = Time::Now(); |
| 504 const GURL test_urls[] = { | 505 const GURL test_urls[] = { |
| 505 GURL("http://timer.first.page/"), | 506 GURL("http://timer.first.page/"), |
| 506 GURL("http://timer.second.page/"), | 507 GURL("http://timer.second.page/"), |
| 507 GURL("http://timer.third.page/"), | 508 GURL("http://timer.third.page/"), |
| 508 }; | 509 }; |
| 509 | 510 |
| 510 // Make sure that two pages added at the same time with no intervening | 511 // Make sure that two pages added at the same time with no intervening |
| 511 // additions have different timestamps. | 512 // additions have different timestamps. |
| 512 history->AddPage(test_urls[0], now, NULL, 0, GURL(), | 513 history->AddPage(test_urls[0], now, NULL, 0, GURL(), |
| 513 content::PAGE_TRANSITION_LINK, | 514 history::RedirectList(), content::PAGE_TRANSITION_LINK, |
| 514 history::RedirectList(), | |
| 515 history::SOURCE_BROWSED, false); | 515 history::SOURCE_BROWSED, false); |
| 516 EXPECT_TRUE(QueryURL(history, test_urls[0])); | 516 EXPECT_TRUE(QueryURL(history, test_urls[0])); |
| 517 EXPECT_EQ(1, query_url_row_.visit_count()); | 517 EXPECT_EQ(1, query_url_row_.visit_count()); |
| 518 EXPECT_TRUE(now == query_url_row_.last_visit()); // gtest doesn't like Time | 518 EXPECT_TRUE(now == query_url_row_.last_visit()); // gtest doesn't like Time |
| 519 | 519 |
| 520 history->AddPage(test_urls[1], now, NULL, 0, GURL(), | 520 history->AddPage(test_urls[1], now, NULL, 0, GURL(), |
| 521 content::PAGE_TRANSITION_LINK, | 521 history::RedirectList(), content::PAGE_TRANSITION_LINK, |
| 522 history::RedirectList(), | |
| 523 history::SOURCE_BROWSED, false); | 522 history::SOURCE_BROWSED, false); |
| 524 EXPECT_TRUE(QueryURL(history, test_urls[1])); | 523 EXPECT_TRUE(QueryURL(history, test_urls[1])); |
| 525 EXPECT_EQ(1, query_url_row_.visit_count()); | 524 EXPECT_EQ(1, query_url_row_.visit_count()); |
| 526 EXPECT_TRUE(now + TimeDelta::FromMicroseconds(1) == | 525 EXPECT_TRUE(now + TimeDelta::FromMicroseconds(1) == |
| 527 query_url_row_.last_visit()); | 526 query_url_row_.last_visit()); |
| 528 | 527 |
| 529 // Make sure the next page, at a different time, is also correct. | 528 // Make sure the next page, at a different time, is also correct. |
| 530 history->AddPage(test_urls[2], now + TimeDelta::FromMinutes(1), | 529 history->AddPage(test_urls[2], now + TimeDelta::FromMinutes(1), |
| 531 NULL, 0, GURL(), | 530 NULL, 0, GURL(), history::RedirectList(), |
| 532 content::PAGE_TRANSITION_LINK, | 531 content::PAGE_TRANSITION_LINK, history::SOURCE_BROWSED, |
| 533 history::RedirectList(), | 532 false); |
| 534 history::SOURCE_BROWSED, false); | |
| 535 EXPECT_TRUE(QueryURL(history, test_urls[2])); | 533 EXPECT_TRUE(QueryURL(history, test_urls[2])); |
| 536 EXPECT_EQ(1, query_url_row_.visit_count()); | 534 EXPECT_EQ(1, query_url_row_.visit_count()); |
| 537 EXPECT_TRUE(now + TimeDelta::FromMinutes(1) == | 535 EXPECT_TRUE(now + TimeDelta::FromMinutes(1) == |
| 538 query_url_row_.last_visit()); | 536 query_url_row_.last_visit()); |
| 539 } | 537 } |
| 540 | 538 |
| 541 TEST_F(HistoryTest, AddRedirect) { | 539 TEST_F(HistoryTest, AddRedirect) { |
| 542 scoped_refptr<HistoryService> history(new HistoryService); | 540 scoped_refptr<HistoryService> history(new HistoryService); |
| 543 history_service_ = history; | 541 history_service_ = history; |
| 544 ASSERT_TRUE(history->Init(history_dir_, NULL)); | 542 ASSERT_TRUE(history->Init(history_dir_, NULL)); |
| 545 | 543 |
| 546 const char* first_sequence[] = { | 544 const char* first_sequence[] = { |
| 547 "http://first.page.com/", | 545 "http://first.page.com/", |
| 548 "http://second.page.com/"}; | 546 "http://second.page.com/"}; |
| 549 int first_count = arraysize(first_sequence); | 547 int first_count = arraysize(first_sequence); |
| 550 history::RedirectList first_redirects; | 548 history::RedirectList first_redirects; |
| 551 for (int i = 0; i < first_count; i++) | 549 for (int i = 0; i < first_count; i++) |
| 552 first_redirects.push_back(GURL(first_sequence[i])); | 550 first_redirects.push_back(GURL(first_sequence[i])); |
| 553 | 551 |
| 554 // Add the sequence of pages as a server with no referrer. Note that we need | 552 // Add the sequence of pages as a server with no referrer. Note that we need |
| 555 // to have a non-NULL page ID scope. | 553 // to have a non-NULL page ID scope. |
| 556 history->AddPage(first_redirects.back(), MakeFakeHost(1), 0, GURL(), | 554 history->AddPage(first_redirects.back(), base::Time::Now(), MakeFakeHost(1), |
| 557 content::PAGE_TRANSITION_LINK, first_redirects, | 555 0, GURL(), first_redirects, content::PAGE_TRANSITION_LINK, |
| 558 history::SOURCE_BROWSED, true); | 556 history::SOURCE_BROWSED, true); |
| 559 | 557 |
| 560 // The first page should be added once with a link visit type (because we set | 558 // The first page should be added once with a link visit type (because we set |
| 561 // LINK when we added the original URL, and a referrer of nowhere (0). | 559 // LINK when we added the original URL, and a referrer of nowhere (0). |
| 562 EXPECT_TRUE(QueryURL(history, first_redirects[0])); | 560 EXPECT_TRUE(QueryURL(history, first_redirects[0])); |
| 563 EXPECT_EQ(1, query_url_row_.visit_count()); | 561 EXPECT_EQ(1, query_url_row_.visit_count()); |
| 564 ASSERT_EQ(1U, query_url_visits_.size()); | 562 ASSERT_EQ(1U, query_url_visits_.size()); |
| 565 int64 first_visit = query_url_visits_[0].visit_id; | 563 int64 first_visit = query_url_visits_[0].visit_id; |
| 566 EXPECT_EQ(content::PAGE_TRANSITION_LINK | | 564 EXPECT_EQ(content::PAGE_TRANSITION_LINK | |
| 567 content::PAGE_TRANSITION_CHAIN_START, | 565 content::PAGE_TRANSITION_CHAIN_START, |
| 568 query_url_visits_[0].transition); | 566 query_url_visits_[0].transition); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 584 QueryRedirectsFrom(history, first_redirects[0]); | 582 QueryRedirectsFrom(history, first_redirects[0]); |
| 585 ASSERT_EQ(1U, saved_redirects_.size()); | 583 ASSERT_EQ(1U, saved_redirects_.size()); |
| 586 EXPECT_EQ(first_redirects[1], saved_redirects_[0]); | 584 EXPECT_EQ(first_redirects[1], saved_redirects_[0]); |
| 587 | 585 |
| 588 // Now add a client redirect from that second visit to a third, client | 586 // Now add a client redirect from that second visit to a third, client |
| 589 // redirects are tracked by the RenderView prior to updating history, | 587 // redirects are tracked by the RenderView prior to updating history, |
| 590 // so we pass in a CLIENT_REDIRECT qualifier to mock that behavior. | 588 // so we pass in a CLIENT_REDIRECT qualifier to mock that behavior. |
| 591 history::RedirectList second_redirects; | 589 history::RedirectList second_redirects; |
| 592 second_redirects.push_back(first_redirects[1]); | 590 second_redirects.push_back(first_redirects[1]); |
| 593 second_redirects.push_back(GURL("http://last.page.com/")); | 591 second_redirects.push_back(GURL("http://last.page.com/")); |
| 594 history->AddPage(second_redirects[1], MakeFakeHost(1), 1, | 592 history->AddPage(second_redirects[1], base::Time::Now(), |
| 595 second_redirects[0], | 593 MakeFakeHost(1), 1, second_redirects[0], second_redirects, |
| 596 static_cast<content::PageTransition>( | 594 static_cast<content::PageTransition>( |
| 597 content::PAGE_TRANSITION_LINK | | 595 content::PAGE_TRANSITION_LINK | |
| 598 content::PAGE_TRANSITION_CLIENT_REDIRECT), | 596 content::PAGE_TRANSITION_CLIENT_REDIRECT), |
| 599 second_redirects, history::SOURCE_BROWSED, true); | 597 history::SOURCE_BROWSED, true); |
| 600 | 598 |
| 601 // The last page (source of the client redirect) should NOT have an | 599 // The last page (source of the client redirect) should NOT have an |
| 602 // additional visit added, because it was a client redirect (normally it | 600 // additional visit added, because it was a client redirect (normally it |
| 603 // would). We should only have 1 left over from the first sequence. | 601 // would). We should only have 1 left over from the first sequence. |
| 604 EXPECT_TRUE(QueryURL(history, second_redirects[0])); | 602 EXPECT_TRUE(QueryURL(history, second_redirects[0])); |
| 605 EXPECT_EQ(1, query_url_row_.visit_count()); | 603 EXPECT_EQ(1, query_url_row_.visit_count()); |
| 606 | 604 |
| 607 // The final page should be set as a client redirect from the previous visit. | 605 // The final page should be set as a client redirect from the previous visit. |
| 608 EXPECT_TRUE(QueryURL(history, second_redirects[1])); | 606 EXPECT_TRUE(QueryURL(history, second_redirects[1])); |
| 609 EXPECT_EQ(1, query_url_row_.visit_count()); | 607 EXPECT_EQ(1, query_url_row_.visit_count()); |
| 610 ASSERT_EQ(1U, query_url_visits_.size()); | 608 ASSERT_EQ(1U, query_url_visits_.size()); |
| 611 EXPECT_EQ(content::PAGE_TRANSITION_CLIENT_REDIRECT | | 609 EXPECT_EQ(content::PAGE_TRANSITION_CLIENT_REDIRECT | |
| 612 content::PAGE_TRANSITION_CHAIN_END, | 610 content::PAGE_TRANSITION_CHAIN_END, |
| 613 query_url_visits_[0].transition); | 611 query_url_visits_[0].transition); |
| 614 EXPECT_EQ(second_visit, query_url_visits_[0].referring_visit); | 612 EXPECT_EQ(second_visit, query_url_visits_[0].referring_visit); |
| 615 } | 613 } |
| 616 | 614 |
| 617 TEST_F(HistoryTest, MakeIntranetURLsTyped) { | 615 TEST_F(HistoryTest, MakeIntranetURLsTyped) { |
| 618 scoped_refptr<HistoryService> history(new HistoryService); | 616 scoped_refptr<HistoryService> history(new HistoryService); |
| 619 history_service_ = history; | 617 history_service_ = history; |
| 620 ASSERT_TRUE(history->Init(history_dir_, NULL)); | 618 ASSERT_TRUE(history->Init(history_dir_, NULL)); |
| 621 | 619 |
| 622 // Add a non-typed visit to an intranet URL on an unvisited host. This should | 620 // Add a non-typed visit to an intranet URL on an unvisited host. This should |
| 623 // get promoted to a typed visit. | 621 // get promoted to a typed visit. |
| 624 const GURL test_url("http://intranet_host/path"); | 622 const GURL test_url("http://intranet_host/path"); |
| 625 history->AddPage(test_url, NULL, 0, GURL(), content::PAGE_TRANSITION_LINK, | 623 history->AddPage(test_url, base::Time::Now(), NULL, 0, GURL(), |
| 626 history::RedirectList(), history::SOURCE_BROWSED, false); | 624 history::RedirectList(), content::PAGE_TRANSITION_LINK, |
| 625 history::SOURCE_BROWSED, false); |
| 627 EXPECT_TRUE(QueryURL(history, test_url)); | 626 EXPECT_TRUE(QueryURL(history, test_url)); |
| 628 EXPECT_EQ(1, query_url_row_.visit_count()); | 627 EXPECT_EQ(1, query_url_row_.visit_count()); |
| 629 EXPECT_EQ(1, query_url_row_.typed_count()); | 628 EXPECT_EQ(1, query_url_row_.typed_count()); |
| 630 ASSERT_EQ(1U, query_url_visits_.size()); | 629 ASSERT_EQ(1U, query_url_visits_.size()); |
| 631 EXPECT_EQ(content::PAGE_TRANSITION_TYPED, | 630 EXPECT_EQ(content::PAGE_TRANSITION_TYPED, |
| 632 content::PageTransitionStripQualifier(query_url_visits_[0].transition)); | 631 content::PageTransitionStripQualifier(query_url_visits_[0].transition)); |
| 633 | 632 |
| 634 // Add more visits on the same host. None of these should be promoted since | 633 // Add more visits on the same host. None of these should be promoted since |
| 635 // there is already a typed visit. | 634 // there is already a typed visit. |
| 636 | 635 |
| 637 // Different path. | 636 // Different path. |
| 638 const GURL test_url2("http://intranet_host/different_path"); | 637 const GURL test_url2("http://intranet_host/different_path"); |
| 639 history->AddPage(test_url2, NULL, 0, GURL(), content::PAGE_TRANSITION_LINK, | 638 history->AddPage(test_url2, base::Time::Now(), NULL, 0, GURL(), |
| 640 history::RedirectList(), history::SOURCE_BROWSED, false); | 639 history::RedirectList(), content::PAGE_TRANSITION_LINK, |
| 640 history::SOURCE_BROWSED, false); |
| 641 EXPECT_TRUE(QueryURL(history, test_url2)); | 641 EXPECT_TRUE(QueryURL(history, test_url2)); |
| 642 EXPECT_EQ(1, query_url_row_.visit_count()); | 642 EXPECT_EQ(1, query_url_row_.visit_count()); |
| 643 EXPECT_EQ(0, query_url_row_.typed_count()); | 643 EXPECT_EQ(0, query_url_row_.typed_count()); |
| 644 ASSERT_EQ(1U, query_url_visits_.size()); | 644 ASSERT_EQ(1U, query_url_visits_.size()); |
| 645 EXPECT_EQ(content::PAGE_TRANSITION_LINK, | 645 EXPECT_EQ(content::PAGE_TRANSITION_LINK, |
| 646 content::PageTransitionStripQualifier(query_url_visits_[0].transition)); | 646 content::PageTransitionStripQualifier(query_url_visits_[0].transition)); |
| 647 | 647 |
| 648 // No path. | 648 // No path. |
| 649 const GURL test_url3("http://intranet_host/"); | 649 const GURL test_url3("http://intranet_host/"); |
| 650 history->AddPage(test_url3, NULL, 0, GURL(), content::PAGE_TRANSITION_LINK, | 650 history->AddPage(test_url3, base::Time::Now(), NULL, 0, GURL(), |
| 651 history::RedirectList(), history::SOURCE_BROWSED, false); | 651 history::RedirectList(), content::PAGE_TRANSITION_LINK, |
| 652 history::SOURCE_BROWSED, false); |
| 652 EXPECT_TRUE(QueryURL(history, test_url3)); | 653 EXPECT_TRUE(QueryURL(history, test_url3)); |
| 653 EXPECT_EQ(1, query_url_row_.visit_count()); | 654 EXPECT_EQ(1, query_url_row_.visit_count()); |
| 654 EXPECT_EQ(0, query_url_row_.typed_count()); | 655 EXPECT_EQ(0, query_url_row_.typed_count()); |
| 655 ASSERT_EQ(1U, query_url_visits_.size()); | 656 ASSERT_EQ(1U, query_url_visits_.size()); |
| 656 EXPECT_EQ(content::PAGE_TRANSITION_LINK, | 657 EXPECT_EQ(content::PAGE_TRANSITION_LINK, |
| 657 content::PageTransitionStripQualifier(query_url_visits_[0].transition)); | 658 content::PageTransitionStripQualifier(query_url_visits_[0].transition)); |
| 658 | 659 |
| 659 // Different scheme. | 660 // Different scheme. |
| 660 const GURL test_url4("https://intranet_host/"); | 661 const GURL test_url4("https://intranet_host/"); |
| 661 history->AddPage(test_url4, NULL, 0, GURL(), content::PAGE_TRANSITION_LINK, | 662 history->AddPage(test_url4, base::Time::Now(), NULL, 0, GURL(), |
| 662 history::RedirectList(), history::SOURCE_BROWSED, false); | 663 history::RedirectList(), content::PAGE_TRANSITION_LINK, |
| 664 history::SOURCE_BROWSED, false); |
| 663 EXPECT_TRUE(QueryURL(history, test_url4)); | 665 EXPECT_TRUE(QueryURL(history, test_url4)); |
| 664 EXPECT_EQ(1, query_url_row_.visit_count()); | 666 EXPECT_EQ(1, query_url_row_.visit_count()); |
| 665 EXPECT_EQ(0, query_url_row_.typed_count()); | 667 EXPECT_EQ(0, query_url_row_.typed_count()); |
| 666 ASSERT_EQ(1U, query_url_visits_.size()); | 668 ASSERT_EQ(1U, query_url_visits_.size()); |
| 667 EXPECT_EQ(content::PAGE_TRANSITION_LINK, | 669 EXPECT_EQ(content::PAGE_TRANSITION_LINK, |
| 668 content::PageTransitionStripQualifier(query_url_visits_[0].transition)); | 670 content::PageTransitionStripQualifier(query_url_visits_[0].transition)); |
| 669 | 671 |
| 670 // Different transition. | 672 // Different transition. |
| 671 const GURL test_url5("http://intranet_host/another_path"); | 673 const GURL test_url5("http://intranet_host/another_path"); |
| 672 history->AddPage(test_url5, NULL, 0, GURL(), | 674 history->AddPage(test_url5, base::Time::Now(), NULL, 0, GURL(), |
| 675 history::RedirectList(), |
| 673 content::PAGE_TRANSITION_AUTO_BOOKMARK, | 676 content::PAGE_TRANSITION_AUTO_BOOKMARK, |
| 674 history::RedirectList(), history::SOURCE_BROWSED, false); | 677 history::SOURCE_BROWSED, false); |
| 675 EXPECT_TRUE(QueryURL(history, test_url5)); | 678 EXPECT_TRUE(QueryURL(history, test_url5)); |
| 676 EXPECT_EQ(1, query_url_row_.visit_count()); | 679 EXPECT_EQ(1, query_url_row_.visit_count()); |
| 677 EXPECT_EQ(0, query_url_row_.typed_count()); | 680 EXPECT_EQ(0, query_url_row_.typed_count()); |
| 678 ASSERT_EQ(1U, query_url_visits_.size()); | 681 ASSERT_EQ(1U, query_url_visits_.size()); |
| 679 EXPECT_EQ(content::PAGE_TRANSITION_AUTO_BOOKMARK, | 682 EXPECT_EQ(content::PAGE_TRANSITION_AUTO_BOOKMARK, |
| 680 content::PageTransitionStripQualifier(query_url_visits_[0].transition)); | 683 content::PageTransitionStripQualifier(query_url_visits_[0].transition)); |
| 681 | 684 |
| 682 // Original URL. | 685 // Original URL. |
| 683 history->AddPage(test_url, NULL, 0, GURL(), content::PAGE_TRANSITION_LINK, | 686 history->AddPage(test_url, base::Time::Now(), NULL, 0, GURL(), |
| 684 history::RedirectList(), history::SOURCE_BROWSED, false); | 687 history::RedirectList(), content::PAGE_TRANSITION_LINK, |
| 688 history::SOURCE_BROWSED, false); |
| 685 EXPECT_TRUE(QueryURL(history, test_url)); | 689 EXPECT_TRUE(QueryURL(history, test_url)); |
| 686 EXPECT_EQ(2, query_url_row_.visit_count()); | 690 EXPECT_EQ(2, query_url_row_.visit_count()); |
| 687 EXPECT_EQ(1, query_url_row_.typed_count()); | 691 EXPECT_EQ(1, query_url_row_.typed_count()); |
| 688 ASSERT_EQ(2U, query_url_visits_.size()); | 692 ASSERT_EQ(2U, query_url_visits_.size()); |
| 689 EXPECT_EQ(content::PAGE_TRANSITION_LINK, | 693 EXPECT_EQ(content::PAGE_TRANSITION_LINK, |
| 690 content::PageTransitionStripQualifier(query_url_visits_[1].transition)); | 694 content::PageTransitionStripQualifier(query_url_visits_[1].transition)); |
| 691 } | 695 } |
| 692 | 696 |
| 693 TEST_F(HistoryTest, Typed) { | 697 TEST_F(HistoryTest, Typed) { |
| 694 scoped_refptr<HistoryService> history(new HistoryService); | 698 scoped_refptr<HistoryService> history(new HistoryService); |
| 695 history_service_ = history; | 699 history_service_ = history; |
| 696 ASSERT_TRUE(history->Init(history_dir_, NULL)); | 700 ASSERT_TRUE(history->Init(history_dir_, NULL)); |
| 697 | 701 |
| 698 // Add the page once as typed. | 702 // Add the page once as typed. |
| 699 const GURL test_url("http://www.google.com/"); | 703 const GURL test_url("http://www.google.com/"); |
| 700 history->AddPage(test_url, NULL, 0, GURL(), content::PAGE_TRANSITION_TYPED, | 704 history->AddPage(test_url, base::Time::Now(), NULL, 0, GURL(), |
| 701 history::RedirectList(), | 705 history::RedirectList(), content::PAGE_TRANSITION_TYPED, |
| 702 history::SOURCE_BROWSED, false); | 706 history::SOURCE_BROWSED, false); |
| 703 EXPECT_TRUE(QueryURL(history, test_url)); | 707 EXPECT_TRUE(QueryURL(history, test_url)); |
| 704 | 708 |
| 705 // We should have the same typed & visit count. | 709 // We should have the same typed & visit count. |
| 706 EXPECT_EQ(1, query_url_row_.visit_count()); | 710 EXPECT_EQ(1, query_url_row_.visit_count()); |
| 707 EXPECT_EQ(1, query_url_row_.typed_count()); | 711 EXPECT_EQ(1, query_url_row_.typed_count()); |
| 708 | 712 |
| 709 // Add the page again not typed. | 713 // Add the page again not typed. |
| 710 history->AddPage(test_url, NULL, 0, GURL(), content::PAGE_TRANSITION_LINK, | 714 history->AddPage(test_url, base::Time::Now(), NULL, 0, GURL(), |
| 711 history::RedirectList(), | 715 history::RedirectList(), content::PAGE_TRANSITION_LINK, |
| 712 history::SOURCE_BROWSED, false); | 716 history::SOURCE_BROWSED, false); |
| 713 EXPECT_TRUE(QueryURL(history, test_url)); | 717 EXPECT_TRUE(QueryURL(history, test_url)); |
| 714 | 718 |
| 715 // The second time should not have updated the typed count. | 719 // The second time should not have updated the typed count. |
| 716 EXPECT_EQ(2, query_url_row_.visit_count()); | 720 EXPECT_EQ(2, query_url_row_.visit_count()); |
| 717 EXPECT_EQ(1, query_url_row_.typed_count()); | 721 EXPECT_EQ(1, query_url_row_.typed_count()); |
| 718 | 722 |
| 719 // Add the page again as a generated URL. | 723 // Add the page again as a generated URL. |
| 720 history->AddPage(test_url, NULL, 0, GURL(), | 724 history->AddPage(test_url, base::Time::Now(), NULL, 0, GURL(), |
| 721 content::PAGE_TRANSITION_GENERATED, history::RedirectList(), | 725 history::RedirectList(), content::PAGE_TRANSITION_GENERATED, |
| 722 history::SOURCE_BROWSED, false); | 726 history::SOURCE_BROWSED, false); |
| 723 EXPECT_TRUE(QueryURL(history, test_url)); | 727 EXPECT_TRUE(QueryURL(history, test_url)); |
| 724 | 728 |
| 725 // This should have worked like a link click. | 729 // This should have worked like a link click. |
| 726 EXPECT_EQ(3, query_url_row_.visit_count()); | 730 EXPECT_EQ(3, query_url_row_.visit_count()); |
| 727 EXPECT_EQ(1, query_url_row_.typed_count()); | 731 EXPECT_EQ(1, query_url_row_.typed_count()); |
| 728 | 732 |
| 729 // Add the page again as a reload. | 733 // Add the page again as a reload. |
| 730 history->AddPage(test_url, NULL, 0, GURL(), | 734 history->AddPage(test_url, base::Time::Now(), NULL, 0, GURL(), |
| 731 content::PAGE_TRANSITION_RELOAD, history::RedirectList(), | 735 history::RedirectList(), content::PAGE_TRANSITION_RELOAD, |
| 732 history::SOURCE_BROWSED, false); | 736 history::SOURCE_BROWSED, false); |
| 733 EXPECT_TRUE(QueryURL(history, test_url)); | 737 EXPECT_TRUE(QueryURL(history, test_url)); |
| 734 | 738 |
| 735 // This should not have incremented any visit counts. | 739 // This should not have incremented any visit counts. |
| 736 EXPECT_EQ(3, query_url_row_.visit_count()); | 740 EXPECT_EQ(3, query_url_row_.visit_count()); |
| 737 EXPECT_EQ(1, query_url_row_.typed_count()); | 741 EXPECT_EQ(1, query_url_row_.typed_count()); |
| 738 } | 742 } |
| 739 | 743 |
| 740 TEST_F(HistoryTest, SetTitle) { | 744 TEST_F(HistoryTest, SetTitle) { |
| 741 scoped_refptr<HistoryService> history(new HistoryService); | 745 scoped_refptr<HistoryService> history(new HistoryService); |
| 742 history_service_ = history; | 746 history_service_ = history; |
| 743 ASSERT_TRUE(history->Init(history_dir_, NULL)); | 747 ASSERT_TRUE(history->Init(history_dir_, NULL)); |
| 744 | 748 |
| 745 // Add a URL. | 749 // Add a URL. |
| 746 const GURL existing_url("http://www.google.com/"); | 750 const GURL existing_url("http://www.google.com/"); |
| 747 history->AddPage(existing_url, history::SOURCE_BROWSED); | 751 history->AddPage(existing_url, base::Time::Now(), history::SOURCE_BROWSED); |
| 748 | 752 |
| 749 // Set some title. | 753 // Set some title. |
| 750 const string16 existing_title = UTF8ToUTF16("Google"); | 754 const string16 existing_title = UTF8ToUTF16("Google"); |
| 751 history->SetPageTitle(existing_url, existing_title); | 755 history->SetPageTitle(existing_url, existing_title); |
| 752 | 756 |
| 753 // Make sure the title got set. | 757 // Make sure the title got set. |
| 754 EXPECT_TRUE(QueryURL(history, existing_url)); | 758 EXPECT_TRUE(QueryURL(history, existing_url)); |
| 755 EXPECT_EQ(existing_title, query_url_row_.title()); | 759 EXPECT_EQ(existing_title, query_url_row_.title()); |
| 756 | 760 |
| 757 // set a title on a nonexistent page | 761 // set a title on a nonexistent page |
| (...skipping 12 matching lines...) Expand all Loading... |
| 770 TEST_F(HistoryTest, Segments) { | 774 TEST_F(HistoryTest, Segments) { |
| 771 scoped_refptr<HistoryService> history(new HistoryService); | 775 scoped_refptr<HistoryService> history(new HistoryService); |
| 772 history_service_ = history; | 776 history_service_ = history; |
| 773 | 777 |
| 774 ASSERT_TRUE(history->Init(history_dir_, NULL)); | 778 ASSERT_TRUE(history->Init(history_dir_, NULL)); |
| 775 | 779 |
| 776 static const void* scope = static_cast<void*>(this); | 780 static const void* scope = static_cast<void*>(this); |
| 777 | 781 |
| 778 // Add a URL. | 782 // Add a URL. |
| 779 const GURL existing_url("http://www.google.com/"); | 783 const GURL existing_url("http://www.google.com/"); |
| 780 history->AddPage(existing_url, scope, 0, GURL(), | 784 history->AddPage(existing_url, base::Time::Now(), scope, 0, GURL(), |
| 781 content::PAGE_TRANSITION_TYPED, history::RedirectList(), | 785 history::RedirectList(), content::PAGE_TRANSITION_TYPED, |
| 782 history::SOURCE_BROWSED, false); | 786 history::SOURCE_BROWSED, false); |
| 783 | 787 |
| 784 // Make sure a segment was created. | 788 // Make sure a segment was created. |
| 785 history->QuerySegmentUsageSince( | 789 history->QuerySegmentUsageSince( |
| 786 &consumer_, Time::Now() - TimeDelta::FromDays(1), 10, | 790 &consumer_, Time::Now() - TimeDelta::FromDays(1), 10, |
| 787 base::Bind(&HistoryTest::OnSegmentUsageAvailable, | 791 base::Bind(&HistoryTest::OnSegmentUsageAvailable, |
| 788 base::Unretained(this))); | 792 base::Unretained(this))); |
| 789 | 793 |
| 790 // Wait for processing. | 794 // Wait for processing. |
| 791 MessageLoop::current()->Run(); | 795 MessageLoop::current()->Run(); |
| 792 | 796 |
| 793 ASSERT_EQ(1U, page_usage_data_.size()); | 797 ASSERT_EQ(1U, page_usage_data_.size()); |
| 794 EXPECT_TRUE(page_usage_data_[0]->GetURL() == existing_url); | 798 EXPECT_TRUE(page_usage_data_[0]->GetURL() == existing_url); |
| 795 EXPECT_DOUBLE_EQ(3.0, page_usage_data_[0]->GetScore()); | 799 EXPECT_DOUBLE_EQ(3.0, page_usage_data_[0]->GetScore()); |
| 796 | 800 |
| 797 // Add a URL which doesn't create a segment. | 801 // Add a URL which doesn't create a segment. |
| 798 const GURL link_url("http://yahoo.com/"); | 802 const GURL link_url("http://yahoo.com/"); |
| 799 history->AddPage(link_url, scope, 0, GURL(), | 803 history->AddPage(link_url, base::Time::Now(), scope, 0, GURL(), |
| 800 content::PAGE_TRANSITION_LINK, history::RedirectList(), | 804 history::RedirectList(), content::PAGE_TRANSITION_LINK, |
| 801 history::SOURCE_BROWSED, false); | 805 history::SOURCE_BROWSED, false); |
| 802 | 806 |
| 803 // Query again | 807 // Query again |
| 804 history->QuerySegmentUsageSince( | 808 history->QuerySegmentUsageSince( |
| 805 &consumer_, Time::Now() - TimeDelta::FromDays(1), 10, | 809 &consumer_, Time::Now() - TimeDelta::FromDays(1), 10, |
| 806 base::Bind(&HistoryTest::OnSegmentUsageAvailable, | 810 base::Bind(&HistoryTest::OnSegmentUsageAvailable, |
| 807 base::Unretained(this))); | 811 base::Unretained(this))); |
| 808 | 812 |
| 809 // Wait for processing. | 813 // Wait for processing. |
| 810 MessageLoop::current()->Run(); | 814 MessageLoop::current()->Run(); |
| 811 | 815 |
| 812 // Make sure we still have one segment. | 816 // Make sure we still have one segment. |
| 813 ASSERT_EQ(1U, page_usage_data_.size()); | 817 ASSERT_EQ(1U, page_usage_data_.size()); |
| 814 EXPECT_TRUE(page_usage_data_[0]->GetURL() == existing_url); | 818 EXPECT_TRUE(page_usage_data_[0]->GetURL() == existing_url); |
| 815 | 819 |
| 816 // Add a page linked from existing_url. | 820 // Add a page linked from existing_url. |
| 817 history->AddPage(GURL("http://www.google.com/foo"), scope, 3, existing_url, | 821 history->AddPage(GURL("http://www.google.com/foo"), base::Time::Now(), |
| 818 content::PAGE_TRANSITION_LINK, history::RedirectList(), | 822 scope, 3, existing_url, history::RedirectList(), |
| 819 history::SOURCE_BROWSED, false); | 823 content::PAGE_TRANSITION_LINK, history::SOURCE_BROWSED, |
| 824 false); |
| 820 | 825 |
| 821 // Query again | 826 // Query again |
| 822 history->QuerySegmentUsageSince( | 827 history->QuerySegmentUsageSince( |
| 823 &consumer_, Time::Now() - TimeDelta::FromDays(1), 10, | 828 &consumer_, Time::Now() - TimeDelta::FromDays(1), 10, |
| 824 base::Bind(&HistoryTest::OnSegmentUsageAvailable, | 829 base::Bind(&HistoryTest::OnSegmentUsageAvailable, |
| 825 base::Unretained(this))); | 830 base::Unretained(this))); |
| 826 | 831 |
| 827 // Wait for processing. | 832 // Wait for processing. |
| 828 MessageLoop::current()->Run(); | 833 MessageLoop::current()->Run(); |
| 829 | 834 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 842 | 847 |
| 843 const GURL url0("http://www.google.com/url0/"); | 848 const GURL url0("http://www.google.com/url0/"); |
| 844 const GURL url1("http://www.google.com/url1/"); | 849 const GURL url1("http://www.google.com/url1/"); |
| 845 const GURL url2("http://www.google.com/url2/"); | 850 const GURL url2("http://www.google.com/url2/"); |
| 846 const GURL url3("http://www.google.com/url3/"); | 851 const GURL url3("http://www.google.com/url3/"); |
| 847 const GURL url4("http://www.google.com/url4/"); | 852 const GURL url4("http://www.google.com/url4/"); |
| 848 | 853 |
| 849 static const void* scope = static_cast<void*>(this); | 854 static const void* scope = static_cast<void*>(this); |
| 850 | 855 |
| 851 // Add two pages. | 856 // Add two pages. |
| 852 history->AddPage(url0, scope, 0, GURL(), | 857 history->AddPage(url0, base::Time::Now(), scope, 0, GURL(), |
| 853 content::PAGE_TRANSITION_TYPED, history::RedirectList(), | 858 history::RedirectList(), content::PAGE_TRANSITION_TYPED, |
| 854 history::SOURCE_BROWSED, false); | 859 history::SOURCE_BROWSED, false); |
| 855 history->AddPage(url1, scope, 0, GURL(), | 860 history->AddPage(url1, base::Time::Now(), scope, 0, GURL(), |
| 856 content::PAGE_TRANSITION_TYPED, history::RedirectList(), | 861 history::RedirectList(), content::PAGE_TRANSITION_TYPED, |
| 857 history::SOURCE_BROWSED, false); | 862 history::SOURCE_BROWSED, false); |
| 858 history->QueryMostVisitedURLs(20, 90, &consumer_, | 863 history->QueryMostVisitedURLs(20, 90, &consumer_, |
| 859 base::Bind( | 864 base::Bind( |
| 860 &HistoryTest::OnMostVisitedURLsAvailable, | 865 &HistoryTest::OnMostVisitedURLsAvailable, |
| 861 base::Unretained(this))); | 866 base::Unretained(this))); |
| 862 MessageLoop::current()->Run(); | 867 MessageLoop::current()->Run(); |
| 863 | 868 |
| 864 EXPECT_EQ(2U, most_visited_urls_.size()); | 869 EXPECT_EQ(2U, most_visited_urls_.size()); |
| 865 EXPECT_EQ(url0, most_visited_urls_[0].url); | 870 EXPECT_EQ(url0, most_visited_urls_[0].url); |
| 866 EXPECT_EQ(url1, most_visited_urls_[1].url); | 871 EXPECT_EQ(url1, most_visited_urls_[1].url); |
| 867 | 872 |
| 868 // Add another page. | 873 // Add another page. |
| 869 history->AddPage(url2, scope, 0, GURL(), | 874 history->AddPage(url2, base::Time::Now(), scope, 0, GURL(), |
| 870 content::PAGE_TRANSITION_TYPED, history::RedirectList(), | 875 history::RedirectList(), content::PAGE_TRANSITION_TYPED, |
| 871 history::SOURCE_BROWSED, false); | 876 history::SOURCE_BROWSED, false); |
| 872 history->QueryMostVisitedURLs(20, 90, &consumer_, | 877 history->QueryMostVisitedURLs(20, 90, &consumer_, |
| 873 base::Bind( | 878 base::Bind( |
| 874 &HistoryTest::OnMostVisitedURLsAvailable, | 879 &HistoryTest::OnMostVisitedURLsAvailable, |
| 875 base::Unretained(this))); | 880 base::Unretained(this))); |
| 876 MessageLoop::current()->Run(); | 881 MessageLoop::current()->Run(); |
| 877 | 882 |
| 878 EXPECT_EQ(3U, most_visited_urls_.size()); | 883 EXPECT_EQ(3U, most_visited_urls_.size()); |
| 879 EXPECT_EQ(url0, most_visited_urls_[0].url); | 884 EXPECT_EQ(url0, most_visited_urls_[0].url); |
| 880 EXPECT_EQ(url1, most_visited_urls_[1].url); | 885 EXPECT_EQ(url1, most_visited_urls_[1].url); |
| 881 EXPECT_EQ(url2, most_visited_urls_[2].url); | 886 EXPECT_EQ(url2, most_visited_urls_[2].url); |
| 882 | 887 |
| 883 // Revisit url2, making it the top URL. | 888 // Revisit url2, making it the top URL. |
| 884 history->AddPage(url2, scope, 0, GURL(), | 889 history->AddPage(url2, base::Time::Now(), scope, 0, GURL(), |
| 885 content::PAGE_TRANSITION_TYPED, history::RedirectList(), | 890 history::RedirectList(), content::PAGE_TRANSITION_TYPED, |
| 886 history::SOURCE_BROWSED, false); | 891 history::SOURCE_BROWSED, false); |
| 887 history->QueryMostVisitedURLs(20, 90, &consumer_, | 892 history->QueryMostVisitedURLs(20, 90, &consumer_, |
| 888 base::Bind( | 893 base::Bind( |
| 889 &HistoryTest::OnMostVisitedURLsAvailable, | 894 &HistoryTest::OnMostVisitedURLsAvailable, |
| 890 base::Unretained(this))); | 895 base::Unretained(this))); |
| 891 MessageLoop::current()->Run(); | 896 MessageLoop::current()->Run(); |
| 892 | 897 |
| 893 EXPECT_EQ(3U, most_visited_urls_.size()); | 898 EXPECT_EQ(3U, most_visited_urls_.size()); |
| 894 EXPECT_EQ(url2, most_visited_urls_[0].url); | 899 EXPECT_EQ(url2, most_visited_urls_[0].url); |
| 895 EXPECT_EQ(url0, most_visited_urls_[1].url); | 900 EXPECT_EQ(url0, most_visited_urls_[1].url); |
| 896 EXPECT_EQ(url1, most_visited_urls_[2].url); | 901 EXPECT_EQ(url1, most_visited_urls_[2].url); |
| 897 | 902 |
| 898 // Revisit url1, making it the top URL. | 903 // Revisit url1, making it the top URL. |
| 899 history->AddPage(url1, scope, 0, GURL(), | 904 history->AddPage(url1, base::Time::Now(), scope, 0, GURL(), |
| 900 content::PAGE_TRANSITION_TYPED, history::RedirectList(), | 905 history::RedirectList(), content::PAGE_TRANSITION_TYPED, |
| 901 history::SOURCE_BROWSED, false); | 906 history::SOURCE_BROWSED, false); |
| 902 history->QueryMostVisitedURLs(20, 90, &consumer_, | 907 history->QueryMostVisitedURLs(20, 90, &consumer_, |
| 903 base::Bind( | 908 base::Bind( |
| 904 &HistoryTest::OnMostVisitedURLsAvailable, | 909 &HistoryTest::OnMostVisitedURLsAvailable, |
| 905 base::Unretained(this))); | 910 base::Unretained(this))); |
| 906 MessageLoop::current()->Run(); | 911 MessageLoop::current()->Run(); |
| 907 | 912 |
| 908 EXPECT_EQ(3U, most_visited_urls_.size()); | 913 EXPECT_EQ(3U, most_visited_urls_.size()); |
| 909 EXPECT_EQ(url1, most_visited_urls_[0].url); | 914 EXPECT_EQ(url1, most_visited_urls_[0].url); |
| 910 EXPECT_EQ(url2, most_visited_urls_[1].url); | 915 EXPECT_EQ(url2, most_visited_urls_[1].url); |
| 911 EXPECT_EQ(url0, most_visited_urls_[2].url); | 916 EXPECT_EQ(url0, most_visited_urls_[2].url); |
| 912 | 917 |
| 913 // Redirects | 918 // Redirects |
| 914 history::RedirectList redirects; | 919 history::RedirectList redirects; |
| 915 redirects.push_back(url3); | 920 redirects.push_back(url3); |
| 916 redirects.push_back(url4); | 921 redirects.push_back(url4); |
| 917 | 922 |
| 918 // Visit url4 using redirects. | 923 // Visit url4 using redirects. |
| 919 history->AddPage(url4, scope, 0, GURL(), | 924 history->AddPage(url4, base::Time::Now(), scope, 0, GURL(), |
| 920 content::PAGE_TRANSITION_TYPED, redirects, | 925 redirects, content::PAGE_TRANSITION_TYPED, |
| 921 history::SOURCE_BROWSED, false); | 926 history::SOURCE_BROWSED, false); |
| 922 history->QueryMostVisitedURLs(20, 90, &consumer_, | 927 history->QueryMostVisitedURLs(20, 90, &consumer_, |
| 923 base::Bind( | 928 base::Bind( |
| 924 &HistoryTest::OnMostVisitedURLsAvailable, | 929 &HistoryTest::OnMostVisitedURLsAvailable, |
| 925 base::Unretained(this))); | 930 base::Unretained(this))); |
| 926 MessageLoop::current()->Run(); | 931 MessageLoop::current()->Run(); |
| 927 | 932 |
| 928 EXPECT_EQ(4U, most_visited_urls_.size()); | 933 EXPECT_EQ(4U, most_visited_urls_.size()); |
| 929 EXPECT_EQ(url1, most_visited_urls_[0].url); | 934 EXPECT_EQ(url1, most_visited_urls_[0].url); |
| 930 EXPECT_EQ(url2, most_visited_urls_[1].url); | 935 EXPECT_EQ(url2, most_visited_urls_[1].url); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1023 history_service_ = history; | 1028 history_service_ = history; |
| 1024 history->ScheduleDBTask(task.get(), &request_consumer); | 1029 history->ScheduleDBTask(task.get(), &request_consumer); |
| 1025 request_consumer.CancelAllRequests(); | 1030 request_consumer.CancelAllRequests(); |
| 1026 CleanupHistoryService(); | 1031 CleanupHistoryService(); |
| 1027 // WARNING: history has now been deleted. | 1032 // WARNING: history has now been deleted. |
| 1028 history = NULL; | 1033 history = NULL; |
| 1029 ASSERT_FALSE(task->done_invoked); | 1034 ASSERT_FALSE(task->done_invoked); |
| 1030 } | 1035 } |
| 1031 | 1036 |
| 1032 } // namespace history | 1037 } // namespace history |
| OLD | NEW |