| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "sync/sessions/sync_session.h" | 5 #include "sync/sessions/sync_session.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "sync/engine/syncer_types.h" | 11 #include "sync/engine/syncer_types.h" |
| 12 #include "sync/internal_api/public/base/model_type.h" | 12 #include "sync/internal_api/public/base/model_type.h" |
| 13 #include "sync/internal_api/public/base/model_type_invalidation_map_test_util.h" | |
| 14 #include "sync/sessions/status_controller.h" | 13 #include "sync/sessions/status_controller.h" |
| 15 #include "sync/syncable/syncable_id.h" | 14 #include "sync/syncable/syncable_id.h" |
| 16 #include "sync/syncable/syncable_write_transaction.h" | 15 #include "sync/syncable/syncable_write_transaction.h" |
| 17 #include "sync/test/engine/fake_model_worker.h" | 16 #include "sync/test/engine/fake_model_worker.h" |
| 18 #include "sync/test/engine/test_directory_setter_upper.h" | 17 #include "sync/test/engine/test_directory_setter_upper.h" |
| 19 #include "sync/util/extensions_activity.h" | 18 #include "sync/util/extensions_activity.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 21 | 20 |
| 22 namespace syncer { | 21 namespace syncer { |
| 23 | 22 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 TEST_F(SyncSessionTest, MoreToDownloadIfGotNoChangesRemaining) { | 173 TEST_F(SyncSessionTest, MoreToDownloadIfGotNoChangesRemaining) { |
| 175 status()->set_updates_request_types(ParamsMeaningAllEnabledTypes()); | 174 status()->set_updates_request_types(ParamsMeaningAllEnabledTypes()); |
| 176 | 175 |
| 177 status()->set_last_download_updates_result(SYNCER_OK); | 176 status()->set_last_download_updates_result(SYNCER_OK); |
| 178 status()->mutable_updates_response()->mutable_get_updates() | 177 status()->mutable_updates_response()->mutable_get_updates() |
| 179 ->set_changes_remaining(0); | 178 ->set_changes_remaining(0); |
| 180 EXPECT_TRUE(status()->ServerSaysNothingMoreToDownload()); | 179 EXPECT_TRUE(status()->ServerSaysNothingMoreToDownload()); |
| 181 EXPECT_TRUE(status()->download_updates_succeeded()); | 180 EXPECT_TRUE(status()->download_updates_succeeded()); |
| 182 } | 181 } |
| 183 | 182 |
| 184 TEST_F(SyncSessionTest, MakeTypeInvalidationMapFromBitSet) { | |
| 185 ModelTypeSet types; | |
| 186 std::string payload = "test"; | |
| 187 ModelTypeInvalidationMap invalidation_map = | |
| 188 ModelTypeSetToInvalidationMap(types, payload); | |
| 189 EXPECT_TRUE(invalidation_map.empty()); | |
| 190 | |
| 191 types.Put(BOOKMARKS); | |
| 192 types.Put(PASSWORDS); | |
| 193 types.Put(AUTOFILL); | |
| 194 payload = "test2"; | |
| 195 invalidation_map = ModelTypeSetToInvalidationMap(types, payload); | |
| 196 | |
| 197 ASSERT_EQ(3U, invalidation_map.size()); | |
| 198 EXPECT_EQ(invalidation_map[BOOKMARKS].payload, payload); | |
| 199 EXPECT_EQ(invalidation_map[PASSWORDS].payload, payload); | |
| 200 EXPECT_EQ(invalidation_map[AUTOFILL].payload, payload); | |
| 201 } | |
| 202 | |
| 203 } // namespace | 183 } // namespace |
| 204 } // namespace sessions | 184 } // namespace sessions |
| 205 } // namespace syncer | 185 } // namespace syncer |
| OLD | NEW |