| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/sync/engine_impl/uss_migrator.h" | 5 #include "components/sync/engine_impl/uss_migrator.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "components/sync/base/hash_util.h" |
| 14 #include "components/sync/engine_impl/cycle/non_blocking_type_debug_info_emitter
.h" | 15 #include "components/sync/engine_impl/cycle/non_blocking_type_debug_info_emitter
.h" |
| 15 #include "components/sync/engine_impl/model_type_worker.h" | 16 #include "components/sync/engine_impl/model_type_worker.h" |
| 16 #include "components/sync/engine_impl/test_entry_factory.h" | 17 #include "components/sync/engine_impl/test_entry_factory.h" |
| 17 #include "components/sync/protocol/model_type_state.pb.h" | 18 #include "components/sync/protocol/model_type_state.pb.h" |
| 18 #include "components/sync/syncable/directory.h" | 19 #include "components/sync/syncable/directory.h" |
| 19 #include "components/sync/syncable/read_node.h" | 20 #include "components/sync/syncable/read_node.h" |
| 20 #include "components/sync/syncable/read_transaction.h" | 21 #include "components/sync/syncable/read_transaction.h" |
| 21 #include "components/sync/syncable/syncable_util.h" | |
| 22 #include "components/sync/syncable/test_user_share.h" | 22 #include "components/sync/syncable/test_user_share.h" |
| 23 #include "components/sync/test/engine/mock_model_type_processor.h" | 23 #include "components/sync/test/engine/mock_model_type_processor.h" |
| 24 #include "components/sync/test/engine/mock_nudge_handler.h" | 24 #include "components/sync/test/engine/mock_nudge_handler.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
| 26 | 26 |
| 27 namespace syncer { | 27 namespace syncer { |
| 28 | 28 |
| 29 namespace { | 29 namespace { |
| 30 | 30 |
| 31 const ModelType kModelType = PREFERENCES; | 31 const ModelType kModelType = PREFERENCES; |
| 32 | 32 |
| 33 std::string GenerateTagHash(const std::string& tag) { | 33 std::string GenerateTagHash(const std::string& tag) { |
| 34 return syncable::GenerateSyncableHash(kModelType, tag); | 34 return GenerateSyncableHash(kModelType, tag); |
| 35 } | 35 } |
| 36 | 36 |
| 37 const char kToken1[] = "token1"; | 37 const char kToken1[] = "token1"; |
| 38 const char kTag1[] = "tag1"; | 38 const char kTag1[] = "tag1"; |
| 39 const char kTag2[] = "tag2"; | 39 const char kTag2[] = "tag2"; |
| 40 const char kTag3[] = "tag3"; | 40 const char kTag3[] = "tag3"; |
| 41 const char kValue1[] = "value1"; | 41 const char kValue1[] = "value1"; |
| 42 const char kValue2[] = "value2"; | 42 const char kValue2[] = "value2"; |
| 43 const char kValue3[] = "value3"; | 43 const char kValue3[] = "value3"; |
| 44 const std::string kHash1(GenerateTagHash(kTag1)); | 44 const std::string kHash1(GenerateTagHash(kTag1)); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 } | 187 } |
| 188 | 188 |
| 189 TEST_F(UssMigratorTest, MissingTypeRoot) { | 189 TEST_F(UssMigratorTest, MissingTypeRoot) { |
| 190 EXPECT_EQ(0, nudge_handler()->GetNumInitialDownloadNudges()); | 190 EXPECT_EQ(0, nudge_handler()->GetNumInitialDownloadNudges()); |
| 191 ASSERT_FALSE(MigrateDirectoryData(kModelType, user_share(), worker())); | 191 ASSERT_FALSE(MigrateDirectoryData(kModelType, user_share(), worker())); |
| 192 EXPECT_EQ(1, nudge_handler()->GetNumInitialDownloadNudges()); | 192 EXPECT_EQ(1, nudge_handler()->GetNumInitialDownloadNudges()); |
| 193 EXPECT_EQ(0U, processor()->GetNumUpdateResponses()); | 193 EXPECT_EQ(0U, processor()->GetNumUpdateResponses()); |
| 194 } | 194 } |
| 195 | 195 |
| 196 } // namespace syncer | 196 } // namespace syncer |
| OLD | NEW |