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