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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 #include "chrome/browser/history/page_usage_data.h" | 53 #include "chrome/browser/history/page_usage_data.h" |
54 #include "chrome/common/chrome_constants.h" | 54 #include "chrome/common/chrome_constants.h" |
55 #include "chrome/common/chrome_paths.h" | 55 #include "chrome/common/chrome_paths.h" |
56 #include "chrome/common/thumbnail_score.h" | 56 #include "chrome/common/thumbnail_score.h" |
57 #include "chrome/tools/profiles/thumbnail-inl.h" | 57 #include "chrome/tools/profiles/thumbnail-inl.h" |
58 #include "content/public/browser/download_item.h" | 58 #include "content/public/browser/download_item.h" |
59 #include "content/public/browser/notification_details.h" | 59 #include "content/public/browser/notification_details.h" |
60 #include "content/public/browser/notification_source.h" | 60 #include "content/public/browser/notification_source.h" |
61 #include "sql/connection.h" | 61 #include "sql/connection.h" |
62 #include "sql/statement.h" | 62 #include "sql/statement.h" |
| 63 #include "sync/api/fake_sync_change_processor.h" |
63 #include "sync/api/sync_change.h" | 64 #include "sync/api/sync_change.h" |
64 #include "sync/api/sync_change_processor.h" | 65 #include "sync/api/sync_change_processor.h" |
| 66 #include "sync/api/sync_change_processor_wrapper_for_test.h" |
65 #include "sync/api/sync_error.h" | 67 #include "sync/api/sync_error.h" |
66 #include "sync/api/sync_error_factory.h" | 68 #include "sync/api/sync_error_factory.h" |
67 #include "sync/api/sync_merge_result.h" | 69 #include "sync/api/sync_merge_result.h" |
68 #include "sync/protocol/history_delete_directive_specifics.pb.h" | 70 #include "sync/protocol/history_delete_directive_specifics.pb.h" |
69 #include "sync/protocol/sync.pb.h" | 71 #include "sync/protocol/sync.pb.h" |
70 #include "testing/gtest/include/gtest/gtest.h" | 72 #include "testing/gtest/include/gtest/gtest.h" |
71 #include "third_party/skia/include/core/SkBitmap.h" | 73 #include "third_party/skia/include/core/SkBitmap.h" |
72 #include "ui/gfx/codec/jpeg_codec.h" | 74 #include "ui/gfx/codec/jpeg_codec.h" |
73 | 75 |
74 using base::Time; | 76 using base::Time; |
(...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1530 CancelableRequestConsumerT<int, 0> request_consumer; | 1532 CancelableRequestConsumerT<int, 0> request_consumer; |
1531 scoped_refptr<HistoryDBTaskImpl> task(new HistoryDBTaskImpl()); | 1533 scoped_refptr<HistoryDBTaskImpl> task(new HistoryDBTaskImpl()); |
1532 history_service_->ScheduleDBTask(task.get(), &request_consumer); | 1534 history_service_->ScheduleDBTask(task.get(), &request_consumer); |
1533 request_consumer.CancelAllRequests(); | 1535 request_consumer.CancelAllRequests(); |
1534 CleanupHistoryService(); | 1536 CleanupHistoryService(); |
1535 // WARNING: history has now been deleted. | 1537 // WARNING: history has now been deleted. |
1536 history_service_.reset(); | 1538 history_service_.reset(); |
1537 ASSERT_FALSE(task->done_invoked); | 1539 ASSERT_FALSE(task->done_invoked); |
1538 } | 1540 } |
1539 | 1541 |
1540 // Dummy SyncChangeProcessor used to help review what SyncChanges are pushed | |
1541 // back up to Sync. | |
1542 // | |
1543 // TODO(akalin): Unify all the various test implementations of | |
1544 // syncer::SyncChangeProcessor. | |
1545 class TestChangeProcessor : public syncer::SyncChangeProcessor { | |
1546 public: | |
1547 TestChangeProcessor() {} | |
1548 virtual ~TestChangeProcessor() {} | |
1549 | |
1550 virtual syncer::SyncError ProcessSyncChanges( | |
1551 const tracked_objects::Location& from_here, | |
1552 const syncer::SyncChangeList& change_list) OVERRIDE { | |
1553 changes_.insert(changes_.end(), change_list.begin(), change_list.end()); | |
1554 return syncer::SyncError(); | |
1555 } | |
1556 | |
1557 virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const | |
1558 OVERRIDE { | |
1559 return syncer::SyncDataList(); | |
1560 } | |
1561 | |
1562 const syncer::SyncChangeList& GetChanges() const { | |
1563 return changes_; | |
1564 } | |
1565 | |
1566 private: | |
1567 syncer::SyncChangeList changes_; | |
1568 | |
1569 DISALLOW_COPY_AND_ASSIGN(TestChangeProcessor); | |
1570 }; | |
1571 | |
1572 // SyncChangeProcessor implementation that delegates to another one. | |
1573 // This is necessary since most things expect a | |
1574 // scoped_ptr<SyncChangeProcessor>. | |
1575 // | |
1576 // TODO(akalin): Unify this too. | |
1577 class SyncChangeProcessorDelegate : public syncer::SyncChangeProcessor { | |
1578 public: | |
1579 explicit SyncChangeProcessorDelegate(syncer::SyncChangeProcessor* recipient) | |
1580 : recipient_(recipient) { | |
1581 DCHECK(recipient_); | |
1582 } | |
1583 | |
1584 virtual ~SyncChangeProcessorDelegate() {} | |
1585 | |
1586 // syncer::SyncChangeProcessor implementation. | |
1587 virtual syncer::SyncError ProcessSyncChanges( | |
1588 const tracked_objects::Location& from_here, | |
1589 const syncer::SyncChangeList& change_list) OVERRIDE { | |
1590 return recipient_->ProcessSyncChanges(from_here, change_list); | |
1591 } | |
1592 | |
1593 virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const | |
1594 OVERRIDE { | |
1595 return recipient_->GetAllSyncData(type); | |
1596 } | |
1597 | |
1598 private: | |
1599 // The recipient of all sync changes. | |
1600 syncer::SyncChangeProcessor* const recipient_; | |
1601 | |
1602 DISALLOW_COPY_AND_ASSIGN(SyncChangeProcessorDelegate); | |
1603 }; | |
1604 | |
1605 // Create a local delete directive and process it while sync is | 1542 // Create a local delete directive and process it while sync is |
1606 // online, and then when offline. The delete directive should be sent to sync, | 1543 // online, and then when offline. The delete directive should be sent to sync, |
1607 // no error should be returned for the first time, and an error should be | 1544 // no error should be returned for the first time, and an error should be |
1608 // returned for the second time. | 1545 // returned for the second time. |
1609 TEST_F(HistoryTest, ProcessLocalDeleteDirectiveSyncOnline) { | 1546 TEST_F(HistoryTest, ProcessLocalDeleteDirectiveSyncOnline) { |
1610 ASSERT_TRUE(history_service_.get()); | 1547 ASSERT_TRUE(history_service_.get()); |
1611 | 1548 |
1612 const GURL test_url("http://www.google.com/"); | 1549 const GURL test_url("http://www.google.com/"); |
1613 for (int64 i = 1; i <= 10; ++i) { | 1550 for (int64 i = 1; i <= 10; ++i) { |
1614 base::Time t = | 1551 base::Time t = |
1615 base::Time::UnixEpoch() + base::TimeDelta::FromMicroseconds(i); | 1552 base::Time::UnixEpoch() + base::TimeDelta::FromMicroseconds(i); |
1616 history_service_->AddPage(test_url, t, NULL, 0, GURL(), | 1553 history_service_->AddPage(test_url, t, NULL, 0, GURL(), |
1617 history::RedirectList(), | 1554 history::RedirectList(), |
1618 content::PAGE_TRANSITION_LINK, | 1555 content::PAGE_TRANSITION_LINK, |
1619 history::SOURCE_BROWSED, false); | 1556 history::SOURCE_BROWSED, false); |
1620 } | 1557 } |
1621 | 1558 |
1622 sync_pb::HistoryDeleteDirectiveSpecifics delete_directive; | 1559 sync_pb::HistoryDeleteDirectiveSpecifics delete_directive; |
1623 sync_pb::GlobalIdDirective* global_id_directive = | 1560 sync_pb::GlobalIdDirective* global_id_directive = |
1624 delete_directive.mutable_global_id_directive(); | 1561 delete_directive.mutable_global_id_directive(); |
1625 global_id_directive->add_global_id( | 1562 global_id_directive->add_global_id( |
1626 (base::Time::UnixEpoch() + base::TimeDelta::FromMicroseconds(1)) | 1563 (base::Time::UnixEpoch() + base::TimeDelta::FromMicroseconds(1)) |
1627 .ToInternalValue()); | 1564 .ToInternalValue()); |
1628 | 1565 |
1629 TestChangeProcessor change_processor; | 1566 syncer::FakeSyncChangeProcessor change_processor; |
1630 | 1567 |
1631 EXPECT_FALSE( | 1568 EXPECT_FALSE( |
1632 history_service_->MergeDataAndStartSyncing( | 1569 history_service_->MergeDataAndStartSyncing( |
1633 syncer::HISTORY_DELETE_DIRECTIVES, | 1570 syncer::HISTORY_DELETE_DIRECTIVES, |
1634 syncer::SyncDataList(), | 1571 syncer::SyncDataList(), |
1635 scoped_ptr<syncer::SyncChangeProcessor>( | 1572 scoped_ptr<syncer::SyncChangeProcessor>( |
1636 new SyncChangeProcessorDelegate(&change_processor)), | 1573 new syncer::SyncChangeProcessorWrapperForTest( |
1637 scoped_ptr<syncer::SyncErrorFactory>()).error().IsSet()); | 1574 &change_processor)), |
| 1575 scoped_ptr<syncer::SyncErrorFactory>()) |
| 1576 .error() |
| 1577 .IsSet()); |
1638 | 1578 |
1639 syncer::SyncError err = | 1579 syncer::SyncError err = |
1640 history_service_->ProcessLocalDeleteDirective(delete_directive); | 1580 history_service_->ProcessLocalDeleteDirective(delete_directive); |
1641 EXPECT_FALSE(err.IsSet()); | 1581 EXPECT_FALSE(err.IsSet()); |
1642 EXPECT_EQ(1u, change_processor.GetChanges().size()); | 1582 EXPECT_EQ(1u, change_processor.changes().size()); |
1643 | 1583 |
1644 history_service_->StopSyncing(syncer::HISTORY_DELETE_DIRECTIVES); | 1584 history_service_->StopSyncing(syncer::HISTORY_DELETE_DIRECTIVES); |
1645 err = history_service_->ProcessLocalDeleteDirective(delete_directive); | 1585 err = history_service_->ProcessLocalDeleteDirective(delete_directive); |
1646 EXPECT_TRUE(err.IsSet()); | 1586 EXPECT_TRUE(err.IsSet()); |
1647 EXPECT_EQ(1u, change_processor.GetChanges().size()); | 1587 EXPECT_EQ(1u, change_processor.changes().size()); |
1648 } | 1588 } |
1649 | 1589 |
1650 // Closure function that runs periodically to check result of delete directive | 1590 // Closure function that runs periodically to check result of delete directive |
1651 // processing. Stop when timeout or processing ends indicated by the creation | 1591 // processing. Stop when timeout or processing ends indicated by the creation |
1652 // of sync changes. | 1592 // of sync changes. |
1653 void CheckDirectiveProcessingResult( | 1593 void CheckDirectiveProcessingResult( |
1654 Time timeout, const TestChangeProcessor* change_processor, | 1594 Time timeout, |
| 1595 const syncer::FakeSyncChangeProcessor* change_processor, |
1655 uint32 num_changes) { | 1596 uint32 num_changes) { |
1656 if (base::Time::Now() > timeout || | 1597 if (base::Time::Now() > timeout || |
1657 change_processor->GetChanges().size() >= num_changes) { | 1598 change_processor->changes().size() >= num_changes) { |
1658 return; | 1599 return; |
1659 } | 1600 } |
1660 | 1601 |
1661 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100)); | 1602 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100)); |
1662 base::MessageLoop::current()->PostTask( | 1603 base::MessageLoop::current()->PostTask( |
1663 FROM_HERE, | 1604 FROM_HERE, |
1664 base::Bind(&CheckDirectiveProcessingResult, timeout, | 1605 base::Bind(&CheckDirectiveProcessingResult, timeout, |
1665 change_processor, num_changes)); | 1606 change_processor, num_changes)); |
1666 } | 1607 } |
1667 | 1608 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1700 // 2nd directive. | 1641 // 2nd directive. |
1701 global_id_directive->Clear(); | 1642 global_id_directive->Clear(); |
1702 global_id_directive->add_global_id( | 1643 global_id_directive->add_global_id( |
1703 (base::Time::UnixEpoch() + base::TimeDelta::FromMicroseconds(17)) | 1644 (base::Time::UnixEpoch() + base::TimeDelta::FromMicroseconds(17)) |
1704 .ToInternalValue()); | 1645 .ToInternalValue()); |
1705 global_id_directive->set_start_time_usec(13); | 1646 global_id_directive->set_start_time_usec(13); |
1706 global_id_directive->set_end_time_usec(19); | 1647 global_id_directive->set_end_time_usec(19); |
1707 directives.push_back( | 1648 directives.push_back( |
1708 syncer::SyncData::CreateRemoteData(2, entity_specs, base::Time())); | 1649 syncer::SyncData::CreateRemoteData(2, entity_specs, base::Time())); |
1709 | 1650 |
1710 TestChangeProcessor change_processor; | 1651 syncer::FakeSyncChangeProcessor change_processor; |
1711 EXPECT_FALSE( | 1652 EXPECT_FALSE( |
1712 history_service_->MergeDataAndStartSyncing( | 1653 history_service_->MergeDataAndStartSyncing( |
1713 syncer::HISTORY_DELETE_DIRECTIVES, | 1654 syncer::HISTORY_DELETE_DIRECTIVES, |
1714 directives, | 1655 directives, |
1715 scoped_ptr<syncer::SyncChangeProcessor>( | 1656 scoped_ptr<syncer::SyncChangeProcessor>( |
1716 new SyncChangeProcessorDelegate(&change_processor)), | 1657 new syncer::SyncChangeProcessorWrapperForTest( |
1717 scoped_ptr<syncer::SyncErrorFactory>()).error().IsSet()); | 1658 &change_processor)), |
| 1659 scoped_ptr<syncer::SyncErrorFactory>()) |
| 1660 .error() |
| 1661 .IsSet()); |
1718 | 1662 |
1719 // Inject a task to check status and keep message loop filled before directive | 1663 // Inject a task to check status and keep message loop filled before directive |
1720 // processing finishes. | 1664 // processing finishes. |
1721 base::MessageLoop::current()->PostTask( | 1665 base::MessageLoop::current()->PostTask( |
1722 FROM_HERE, | 1666 FROM_HERE, |
1723 base::Bind(&CheckDirectiveProcessingResult, | 1667 base::Bind(&CheckDirectiveProcessingResult, |
1724 base::Time::Now() + base::TimeDelta::FromSeconds(10), | 1668 base::Time::Now() + base::TimeDelta::FromSeconds(10), |
1725 &change_processor, 2)); | 1669 &change_processor, 2)); |
1726 base::MessageLoop::current()->RunUntilIdle(); | 1670 base::MessageLoop::current()->RunUntilIdle(); |
1727 EXPECT_TRUE(QueryURL(history_service_.get(), test_url)); | 1671 EXPECT_TRUE(QueryURL(history_service_.get(), test_url)); |
1728 ASSERT_EQ(5, query_url_row_.visit_count()); | 1672 ASSERT_EQ(5, query_url_row_.visit_count()); |
1729 EXPECT_EQ(base::Time::UnixEpoch() + base::TimeDelta::FromMicroseconds(1), | 1673 EXPECT_EQ(base::Time::UnixEpoch() + base::TimeDelta::FromMicroseconds(1), |
1730 query_url_visits_[0].visit_time); | 1674 query_url_visits_[0].visit_time); |
1731 EXPECT_EQ(base::Time::UnixEpoch() + base::TimeDelta::FromMicroseconds(2), | 1675 EXPECT_EQ(base::Time::UnixEpoch() + base::TimeDelta::FromMicroseconds(2), |
1732 query_url_visits_[1].visit_time); | 1676 query_url_visits_[1].visit_time); |
1733 EXPECT_EQ(base::Time::UnixEpoch() + base::TimeDelta::FromMicroseconds(11), | 1677 EXPECT_EQ(base::Time::UnixEpoch() + base::TimeDelta::FromMicroseconds(11), |
1734 query_url_visits_[2].visit_time); | 1678 query_url_visits_[2].visit_time); |
1735 EXPECT_EQ(base::Time::UnixEpoch() + base::TimeDelta::FromMicroseconds(12), | 1679 EXPECT_EQ(base::Time::UnixEpoch() + base::TimeDelta::FromMicroseconds(12), |
1736 query_url_visits_[3].visit_time); | 1680 query_url_visits_[3].visit_time); |
1737 EXPECT_EQ(base::Time::UnixEpoch() + base::TimeDelta::FromMicroseconds(20), | 1681 EXPECT_EQ(base::Time::UnixEpoch() + base::TimeDelta::FromMicroseconds(20), |
1738 query_url_visits_[4].visit_time); | 1682 query_url_visits_[4].visit_time); |
1739 | 1683 |
1740 // Expect two sync changes for deleting processed directives. | 1684 // Expect two sync changes for deleting processed directives. |
1741 const syncer::SyncChangeList& sync_changes = change_processor.GetChanges(); | 1685 const syncer::SyncChangeList& sync_changes = change_processor.changes(); |
1742 ASSERT_EQ(2u, sync_changes.size()); | 1686 ASSERT_EQ(2u, sync_changes.size()); |
1743 EXPECT_EQ(syncer::SyncChange::ACTION_DELETE, sync_changes[0].change_type()); | 1687 EXPECT_EQ(syncer::SyncChange::ACTION_DELETE, sync_changes[0].change_type()); |
1744 EXPECT_EQ(1, sync_changes[0].sync_data().GetRemoteId()); | 1688 EXPECT_EQ(1, sync_changes[0].sync_data().GetRemoteId()); |
1745 EXPECT_EQ(syncer::SyncChange::ACTION_DELETE, sync_changes[1].change_type()); | 1689 EXPECT_EQ(syncer::SyncChange::ACTION_DELETE, sync_changes[1].change_type()); |
1746 EXPECT_EQ(2, sync_changes[1].sync_data().GetRemoteId()); | 1690 EXPECT_EQ(2, sync_changes[1].sync_data().GetRemoteId()); |
1747 } | 1691 } |
1748 | 1692 |
1749 // Create delete directives for time ranges. The expected entries should be | 1693 // Create delete directives for time ranges. The expected entries should be |
1750 // deleted. | 1694 // deleted. |
1751 TEST_F(HistoryTest, ProcessTimeRangeDeleteDirective) { | 1695 TEST_F(HistoryTest, ProcessTimeRangeDeleteDirective) { |
(...skipping 24 matching lines...) Expand all Loading... |
1776 base::Time())); | 1720 base::Time())); |
1777 | 1721 |
1778 // 2nd directive. | 1722 // 2nd directive. |
1779 time_range_directive->Clear(); | 1723 time_range_directive->Clear(); |
1780 time_range_directive->set_start_time_usec(8); | 1724 time_range_directive->set_start_time_usec(8); |
1781 time_range_directive->set_end_time_usec(10); | 1725 time_range_directive->set_end_time_usec(10); |
1782 directives.push_back(syncer::SyncData::CreateRemoteData(2, | 1726 directives.push_back(syncer::SyncData::CreateRemoteData(2, |
1783 entity_specs, | 1727 entity_specs, |
1784 base::Time())); | 1728 base::Time())); |
1785 | 1729 |
1786 TestChangeProcessor change_processor; | 1730 syncer::FakeSyncChangeProcessor change_processor; |
1787 EXPECT_FALSE( | 1731 EXPECT_FALSE( |
1788 history_service_->MergeDataAndStartSyncing( | 1732 history_service_->MergeDataAndStartSyncing( |
1789 syncer::HISTORY_DELETE_DIRECTIVES, | 1733 syncer::HISTORY_DELETE_DIRECTIVES, |
1790 directives, | 1734 directives, |
1791 scoped_ptr<syncer::SyncChangeProcessor>( | 1735 scoped_ptr<syncer::SyncChangeProcessor>( |
1792 new SyncChangeProcessorDelegate(&change_processor)), | 1736 new syncer::SyncChangeProcessorWrapperForTest( |
1793 scoped_ptr<syncer::SyncErrorFactory>()).error().IsSet()); | 1737 &change_processor)), |
| 1738 scoped_ptr<syncer::SyncErrorFactory>()) |
| 1739 .error() |
| 1740 .IsSet()); |
1794 | 1741 |
1795 // Inject a task to check status and keep message loop filled before | 1742 // Inject a task to check status and keep message loop filled before |
1796 // directive processing finishes. | 1743 // directive processing finishes. |
1797 base::MessageLoop::current()->PostTask( | 1744 base::MessageLoop::current()->PostTask( |
1798 FROM_HERE, | 1745 FROM_HERE, |
1799 base::Bind(&CheckDirectiveProcessingResult, | 1746 base::Bind(&CheckDirectiveProcessingResult, |
1800 base::Time::Now() + base::TimeDelta::FromSeconds(10), | 1747 base::Time::Now() + base::TimeDelta::FromSeconds(10), |
1801 &change_processor, 2)); | 1748 &change_processor, 2)); |
1802 base::MessageLoop::current()->RunUntilIdle(); | 1749 base::MessageLoop::current()->RunUntilIdle(); |
1803 EXPECT_TRUE(QueryURL(history_service_.get(), test_url)); | 1750 EXPECT_TRUE(QueryURL(history_service_.get(), test_url)); |
1804 ASSERT_EQ(3, query_url_row_.visit_count()); | 1751 ASSERT_EQ(3, query_url_row_.visit_count()); |
1805 EXPECT_EQ(base::Time::UnixEpoch() + base::TimeDelta::FromMicroseconds(1), | 1752 EXPECT_EQ(base::Time::UnixEpoch() + base::TimeDelta::FromMicroseconds(1), |
1806 query_url_visits_[0].visit_time); | 1753 query_url_visits_[0].visit_time); |
1807 EXPECT_EQ(base::Time::UnixEpoch() + base::TimeDelta::FromMicroseconds(6), | 1754 EXPECT_EQ(base::Time::UnixEpoch() + base::TimeDelta::FromMicroseconds(6), |
1808 query_url_visits_[1].visit_time); | 1755 query_url_visits_[1].visit_time); |
1809 EXPECT_EQ(base::Time::UnixEpoch() + base::TimeDelta::FromMicroseconds(7), | 1756 EXPECT_EQ(base::Time::UnixEpoch() + base::TimeDelta::FromMicroseconds(7), |
1810 query_url_visits_[2].visit_time); | 1757 query_url_visits_[2].visit_time); |
1811 | 1758 |
1812 // Expect two sync changes for deleting processed directives. | 1759 // Expect two sync changes for deleting processed directives. |
1813 const syncer::SyncChangeList& sync_changes = change_processor.GetChanges(); | 1760 const syncer::SyncChangeList& sync_changes = change_processor.changes(); |
1814 ASSERT_EQ(2u, sync_changes.size()); | 1761 ASSERT_EQ(2u, sync_changes.size()); |
1815 EXPECT_EQ(syncer::SyncChange::ACTION_DELETE, sync_changes[0].change_type()); | 1762 EXPECT_EQ(syncer::SyncChange::ACTION_DELETE, sync_changes[0].change_type()); |
1816 EXPECT_EQ(1, sync_changes[0].sync_data().GetRemoteId()); | 1763 EXPECT_EQ(1, sync_changes[0].sync_data().GetRemoteId()); |
1817 EXPECT_EQ(syncer::SyncChange::ACTION_DELETE, sync_changes[1].change_type()); | 1764 EXPECT_EQ(syncer::SyncChange::ACTION_DELETE, sync_changes[1].change_type()); |
1818 EXPECT_EQ(2, sync_changes[1].sync_data().GetRemoteId()); | 1765 EXPECT_EQ(2, sync_changes[1].sync_data().GetRemoteId()); |
1819 } | 1766 } |
1820 | 1767 |
1821 TEST_F(HistoryBackendDBTest, MigratePresentations) { | 1768 TEST_F(HistoryBackendDBTest, MigratePresentations) { |
1822 // Create the db we want. Use 22 since segments didn't change in that time | 1769 // Create the db we want. Use 22 since segments didn't change in that time |
1823 // frame. | 1770 // frame. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1881 std::vector<PageUsageData*> results; | 1828 std::vector<PageUsageData*> results; |
1882 db_->QuerySegmentUsage(segment_time, 10, &results); | 1829 db_->QuerySegmentUsage(segment_time, 10, &results); |
1883 ASSERT_EQ(1u, results.size()); | 1830 ASSERT_EQ(1u, results.size()); |
1884 EXPECT_EQ(url, results[0]->GetURL()); | 1831 EXPECT_EQ(url, results[0]->GetURL()); |
1885 EXPECT_EQ(segment_id, results[0]->GetID()); | 1832 EXPECT_EQ(segment_id, results[0]->GetID()); |
1886 EXPECT_EQ(title, results[0]->GetTitle()); | 1833 EXPECT_EQ(title, results[0]->GetTitle()); |
1887 STLDeleteElements(&results); | 1834 STLDeleteElements(&results); |
1888 } | 1835 } |
1889 | 1836 |
1890 } // namespace history | 1837 } // namespace history |
OLD | NEW |