| 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 #include <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "sync/test/engine/test_id_factory.h" | 31 #include "sync/test/engine/test_id_factory.h" |
| 32 #include "sync/test/engine/test_syncable_utils.h" | 32 #include "sync/test/engine/test_syncable_utils.h" |
| 33 #include "sync/test/fake_encryptor.h" | 33 #include "sync/test/fake_encryptor.h" |
| 34 #include "sync/test/null_directory_change_delegate.h" | 34 #include "sync/test/null_directory_change_delegate.h" |
| 35 #include "sync/test/null_transaction_observer.h" | 35 #include "sync/test/null_transaction_observer.h" |
| 36 #include "sync/util/test_unrecoverable_error_handler.h" | 36 #include "sync/util/test_unrecoverable_error_handler.h" |
| 37 #include "testing/gtest/include/gtest/gtest.h" | 37 #include "testing/gtest/include/gtest/gtest.h" |
| 38 | 38 |
| 39 using base::ExpectDictBooleanValue; | 39 using base::ExpectDictBooleanValue; |
| 40 using base::ExpectDictStringValue; | 40 using base::ExpectDictStringValue; |
| 41 using csync::FakeEncryptor; | 41 using syncer::FakeEncryptor; |
| 42 using csync::TestIdFactory; | 42 using syncer::TestIdFactory; |
| 43 using csync::TestUnrecoverableErrorHandler; | 43 using syncer::TestUnrecoverableErrorHandler; |
| 44 | 44 |
| 45 namespace syncable { | 45 namespace syncable { |
| 46 | 46 |
| 47 class SyncableKernelTest : public testing::Test {}; | 47 class SyncableKernelTest : public testing::Test {}; |
| 48 | 48 |
| 49 // TODO(akalin): Add unit tests for EntryKernel::ContainsString(). | 49 // TODO(akalin): Add unit tests for EntryKernel::ContainsString(). |
| 50 | 50 |
| 51 TEST_F(SyncableKernelTest, ToValue) { | 51 TEST_F(SyncableKernelTest, ToValue) { |
| 52 EntryKernel kernel; | 52 EntryKernel kernel; |
| 53 scoped_ptr<DictionaryValue> value(kernel.ToValue()); | 53 scoped_ptr<DictionaryValue> value(kernel.ToValue()); |
| (...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1145 | 1145 |
| 1146 MutableEntry server_item(&trans, CREATE_NEW_UPDATE_ITEM, | 1146 MutableEntry server_item(&trans, CREATE_NEW_UPDATE_ITEM, |
| 1147 id_factory.NewServerId()); | 1147 id_factory.NewServerId()); |
| 1148 ASSERT_TRUE(server_item.good()); | 1148 ASSERT_TRUE(server_item.good()); |
| 1149 server_item.Put(SERVER_SPECIFICS, specifics); | 1149 server_item.Put(SERVER_SPECIFICS, specifics); |
| 1150 server_item.Put(BASE_VERSION, 1); | 1150 server_item.Put(BASE_VERSION, 1); |
| 1151 server_item.Put(SERVER_IS_DIR, false); | 1151 server_item.Put(SERVER_IS_DIR, false); |
| 1152 server_item.Put(SERVER_IS_DEL, false); | 1152 server_item.Put(SERVER_IS_DEL, false); |
| 1153 ASSERT_EQ(datatype, server_item.GetServerModelType()); | 1153 ASSERT_EQ(datatype, server_item.GetServerModelType()); |
| 1154 | 1154 |
| 1155 csync::SyncEntity folder_entity; | 1155 syncer::SyncEntity folder_entity; |
| 1156 folder_entity.set_id(id_factory.NewServerId()); | 1156 folder_entity.set_id(id_factory.NewServerId()); |
| 1157 folder_entity.set_deleted(false); | 1157 folder_entity.set_deleted(false); |
| 1158 folder_entity.set_folder(true); | 1158 folder_entity.set_folder(true); |
| 1159 folder_entity.mutable_specifics()->CopyFrom(specifics); | 1159 folder_entity.mutable_specifics()->CopyFrom(specifics); |
| 1160 ASSERT_EQ(datatype, folder_entity.GetModelType()); | 1160 ASSERT_EQ(datatype, folder_entity.GetModelType()); |
| 1161 | 1161 |
| 1162 csync::SyncEntity item_entity; | 1162 syncer::SyncEntity item_entity; |
| 1163 item_entity.set_id(id_factory.NewServerId()); | 1163 item_entity.set_id(id_factory.NewServerId()); |
| 1164 item_entity.set_deleted(false); | 1164 item_entity.set_deleted(false); |
| 1165 item_entity.set_folder(false); | 1165 item_entity.set_folder(false); |
| 1166 item_entity.mutable_specifics()->CopyFrom(specifics); | 1166 item_entity.mutable_specifics()->CopyFrom(specifics); |
| 1167 ASSERT_EQ(datatype, item_entity.GetModelType()); | 1167 ASSERT_EQ(datatype, item_entity.GetModelType()); |
| 1168 } | 1168 } |
| 1169 } | 1169 } |
| 1170 | 1170 |
| 1171 // A test that roughly mimics the directory interaction that occurs when a | 1171 // A test that roughly mimics the directory interaction that occurs when a |
| 1172 // bookmark folder and entry are created then synced for the first time. It is | 1172 // bookmark folder and entry are created then synced for the first time. It is |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1930 TEST_F(SyncableClientTagTest, TestClientTagIndexDuplicateServer) { | 1930 TEST_F(SyncableClientTagTest, TestClientTagIndexDuplicateServer) { |
| 1931 EXPECT_TRUE(CreateWithDefaultTag(factory_.NewServerId(), true)); | 1931 EXPECT_TRUE(CreateWithDefaultTag(factory_.NewServerId(), true)); |
| 1932 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), true)); | 1932 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), true)); |
| 1933 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), false)); | 1933 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), false)); |
| 1934 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), false)); | 1934 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), false)); |
| 1935 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), true)); | 1935 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), true)); |
| 1936 } | 1936 } |
| 1937 | 1937 |
| 1938 } // namespace | 1938 } // namespace |
| 1939 } // namespace syncable | 1939 } // namespace syncable |
| OLD | NEW |