| 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 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1546 TestChangeProcessor() {} | 1546 TestChangeProcessor() {} |
| 1547 virtual ~TestChangeProcessor() {} | 1547 virtual ~TestChangeProcessor() {} |
| 1548 | 1548 |
| 1549 virtual syncer::SyncError ProcessSyncChanges( | 1549 virtual syncer::SyncError ProcessSyncChanges( |
| 1550 const tracked_objects::Location& from_here, | 1550 const tracked_objects::Location& from_here, |
| 1551 const syncer::SyncChangeList& change_list) OVERRIDE { | 1551 const syncer::SyncChangeList& change_list) OVERRIDE { |
| 1552 changes_.insert(changes_.end(), change_list.begin(), change_list.end()); | 1552 changes_.insert(changes_.end(), change_list.begin(), change_list.end()); |
| 1553 return syncer::SyncError(); | 1553 return syncer::SyncError(); |
| 1554 } | 1554 } |
| 1555 | 1555 |
| 1556 virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const |
| 1557 OVERRIDE { |
| 1558 return syncer::SyncDataList(); |
| 1559 } |
| 1560 |
| 1556 const syncer::SyncChangeList& GetChanges() const { | 1561 const syncer::SyncChangeList& GetChanges() const { |
| 1557 return changes_; | 1562 return changes_; |
| 1558 } | 1563 } |
| 1559 | 1564 |
| 1560 private: | 1565 private: |
| 1561 syncer::SyncChangeList changes_; | 1566 syncer::SyncChangeList changes_; |
| 1562 | 1567 |
| 1563 DISALLOW_COPY_AND_ASSIGN(TestChangeProcessor); | 1568 DISALLOW_COPY_AND_ASSIGN(TestChangeProcessor); |
| 1564 }; | 1569 }; |
| 1565 | 1570 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1577 | 1582 |
| 1578 virtual ~SyncChangeProcessorDelegate() {} | 1583 virtual ~SyncChangeProcessorDelegate() {} |
| 1579 | 1584 |
| 1580 // syncer::SyncChangeProcessor implementation. | 1585 // syncer::SyncChangeProcessor implementation. |
| 1581 virtual syncer::SyncError ProcessSyncChanges( | 1586 virtual syncer::SyncError ProcessSyncChanges( |
| 1582 const tracked_objects::Location& from_here, | 1587 const tracked_objects::Location& from_here, |
| 1583 const syncer::SyncChangeList& change_list) OVERRIDE { | 1588 const syncer::SyncChangeList& change_list) OVERRIDE { |
| 1584 return recipient_->ProcessSyncChanges(from_here, change_list); | 1589 return recipient_->ProcessSyncChanges(from_here, change_list); |
| 1585 } | 1590 } |
| 1586 | 1591 |
| 1592 virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const |
| 1593 OVERRIDE { |
| 1594 return recipient_->GetAllSyncData(type); |
| 1595 } |
| 1596 |
| 1587 private: | 1597 private: |
| 1588 // The recipient of all sync changes. | 1598 // The recipient of all sync changes. |
| 1589 syncer::SyncChangeProcessor* const recipient_; | 1599 syncer::SyncChangeProcessor* const recipient_; |
| 1590 | 1600 |
| 1591 DISALLOW_COPY_AND_ASSIGN(SyncChangeProcessorDelegate); | 1601 DISALLOW_COPY_AND_ASSIGN(SyncChangeProcessorDelegate); |
| 1592 }; | 1602 }; |
| 1593 | 1603 |
| 1594 // Create a local delete directive and process it while sync is | 1604 // Create a local delete directive and process it while sync is |
| 1595 // online, and then when offline. The delete directive should be sent to sync, | 1605 // online, and then when offline. The delete directive should be sent to sync, |
| 1596 // no error should be returned for the first time, and an error should be | 1606 // no error should be returned for the first time, and an error should be |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1870 std::vector<PageUsageData*> results; | 1880 std::vector<PageUsageData*> results; |
| 1871 db_->QuerySegmentUsage(segment_time, 10, &results); | 1881 db_->QuerySegmentUsage(segment_time, 10, &results); |
| 1872 ASSERT_EQ(1u, results.size()); | 1882 ASSERT_EQ(1u, results.size()); |
| 1873 EXPECT_EQ(url, results[0]->GetURL()); | 1883 EXPECT_EQ(url, results[0]->GetURL()); |
| 1874 EXPECT_EQ(segment_id, results[0]->GetID()); | 1884 EXPECT_EQ(segment_id, results[0]->GetID()); |
| 1875 EXPECT_EQ(title, results[0]->GetTitle()); | 1885 EXPECT_EQ(title, results[0]->GetTitle()); |
| 1876 STLDeleteElements(&results); | 1886 STLDeleteElements(&results); |
| 1877 } | 1887 } |
| 1878 | 1888 |
| 1879 } // namespace history | 1889 } // namespace history |
| OLD | NEW |