| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "chrome/browser/sync/glue/favicon_cache.h" | 5 #include "chrome/browser/sync/glue/favicon_cache.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // Maximum number of favicons to sync. | 31 // Maximum number of favicons to sync. |
| 32 const int kMaxSyncFavicons = kFaviconBatchSize*2; | 32 const int kMaxSyncFavicons = kFaviconBatchSize*2; |
| 33 | 33 |
| 34 // TestChangeProcessor -------------------------------------------------------- | 34 // TestChangeProcessor -------------------------------------------------------- |
| 35 | 35 |
| 36 // Dummy SyncChangeProcessor used to help review what SyncChanges are pushed | 36 // Dummy SyncChangeProcessor used to help review what SyncChanges are pushed |
| 37 // back up to Sync. | 37 // back up to Sync. |
| 38 class TestChangeProcessor : public syncer::SyncChangeProcessor { | 38 class TestChangeProcessor : public syncer::SyncChangeProcessor { |
| 39 public: | 39 public: |
| 40 TestChangeProcessor(); | 40 TestChangeProcessor(); |
| 41 virtual ~TestChangeProcessor(); | 41 ~TestChangeProcessor() override; |
| 42 | 42 |
| 43 // Store a copy of all the changes passed in so we can examine them later. | 43 // Store a copy of all the changes passed in so we can examine them later. |
| 44 virtual syncer::SyncError ProcessSyncChanges( | 44 syncer::SyncError ProcessSyncChanges( |
| 45 const tracked_objects::Location& from_here, | 45 const tracked_objects::Location& from_here, |
| 46 const syncer::SyncChangeList& change_list) override; | 46 const syncer::SyncChangeList& change_list) override; |
| 47 | 47 |
| 48 virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const | 48 syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const override { |
| 49 override { | |
| 50 return syncer::SyncDataList(); | 49 return syncer::SyncDataList(); |
| 51 } | 50 } |
| 52 | 51 |
| 53 bool contains_guid(const std::string& guid) const { | 52 bool contains_guid(const std::string& guid) const { |
| 54 return change_map_.count(guid) != 0; | 53 return change_map_.count(guid) != 0; |
| 55 } | 54 } |
| 56 | 55 |
| 57 syncer::SyncChange change_for_guid(const std::string& guid) const { | 56 syncer::SyncChange change_for_guid(const std::string& guid) const { |
| 58 DCHECK(contains_guid(guid)); | 57 DCHECK(contains_guid(guid)); |
| 59 return change_map_.find(guid)->second; | 58 return change_map_.find(guid)->second; |
| (...skipping 1872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1932 EXPECT_EQ(changes[4].change_type(), syncer::SyncChange::ACTION_ADD); | 1931 EXPECT_EQ(changes[4].change_type(), syncer::SyncChange::ACTION_ADD); |
| 1933 EXPECT_EQ(changes[4].sync_data().GetDataType(), syncer::FAVICON_TRACKING); | 1932 EXPECT_EQ(changes[4].sync_data().GetDataType(), syncer::FAVICON_TRACKING); |
| 1934 EXPECT_EQ(kMaxSyncFavicons, GetFaviconId(changes[4])); | 1933 EXPECT_EQ(kMaxSyncFavicons, GetFaviconId(changes[4])); |
| 1935 // Expire tracking for favicon[0]. | 1934 // Expire tracking for favicon[0]. |
| 1936 EXPECT_EQ(changes[5].change_type(), syncer::SyncChange::ACTION_DELETE); | 1935 EXPECT_EQ(changes[5].change_type(), syncer::SyncChange::ACTION_DELETE); |
| 1937 EXPECT_EQ(changes[5].sync_data().GetDataType(), syncer::FAVICON_TRACKING); | 1936 EXPECT_EQ(changes[5].sync_data().GetDataType(), syncer::FAVICON_TRACKING); |
| 1938 EXPECT_EQ(0, GetFaviconId(changes[5])); | 1937 EXPECT_EQ(0, GetFaviconId(changes[5])); |
| 1939 } | 1938 } |
| 1940 | 1939 |
| 1941 } // namespace browser_sync | 1940 } // namespace browser_sync |
| OLD | NEW |