| 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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 3154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3165 ASSERT_TRUE(++it != index.end()); | 3165 ASSERT_TRUE(++it != index.end()); |
| 3166 ASSERT_EQ(14, (*it)->ref(META_HANDLE)); | 3166 ASSERT_EQ(14, (*it)->ref(META_HANDLE)); |
| 3167 | 3167 |
| 3168 ASSERT_TRUE(++it == index.end()); | 3168 ASSERT_TRUE(++it == index.end()); |
| 3169 } | 3169 } |
| 3170 | 3170 |
| 3171 INSTANTIATE_TEST_CASE_P(DirectoryBackingStore, MigrationTest, | 3171 INSTANTIATE_TEST_CASE_P(DirectoryBackingStore, MigrationTest, |
| 3172 testing::Range(67, kCurrentDBVersion)); | 3172 testing::Range(67, kCurrentDBVersion)); |
| 3173 | 3173 |
| 3174 TEST_F(DirectoryBackingStoreTest, ModelTypeIds) { | 3174 TEST_F(DirectoryBackingStoreTest, ModelTypeIds) { |
| 3175 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { | 3175 ModelTypeSet protocol_types = ProtocolTypes(); |
| 3176 for (ModelTypeSet::Iterator iter = protocol_types.First(); iter.Good(); |
| 3177 iter.Inc()) { |
| 3176 std::string model_id = | 3178 std::string model_id = |
| 3177 TestDirectoryBackingStore::ModelTypeEnumToModelId(ModelTypeFromInt(i)); | 3179 TestDirectoryBackingStore::ModelTypeEnumToModelId(iter.Get()); |
| 3178 EXPECT_EQ(i, | 3180 EXPECT_EQ(iter.Get(), |
| 3179 TestDirectoryBackingStore::ModelIdToModelTypeEnum(model_id.data(), | 3181 TestDirectoryBackingStore::ModelIdToModelTypeEnum(model_id.data(), |
| 3180 model_id.size())); | 3182 model_id.size())); |
| 3181 } | 3183 } |
| 3182 } | 3184 } |
| 3183 | 3185 |
| 3184 namespace { | 3186 namespace { |
| 3185 | 3187 |
| 3186 class OnDiskDirectoryBackingStoreForTest : public OnDiskDirectoryBackingStore { | 3188 class OnDiskDirectoryBackingStoreForTest : public OnDiskDirectoryBackingStore { |
| 3187 public: | 3189 public: |
| 3188 OnDiskDirectoryBackingStoreForTest(const std::string& dir_name, | 3190 OnDiskDirectoryBackingStoreForTest(const std::string& dir_name, |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3301 const std::string& guid2 = TestDirectoryBackingStore::GenerateCacheGUID(); | 3303 const std::string& guid2 = TestDirectoryBackingStore::GenerateCacheGUID(); |
| 3302 EXPECT_EQ(24U, guid1.size()); | 3304 EXPECT_EQ(24U, guid1.size()); |
| 3303 EXPECT_EQ(24U, guid2.size()); | 3305 EXPECT_EQ(24U, guid2.size()); |
| 3304 // In theory this test can fail, but it won't before the universe | 3306 // In theory this test can fail, but it won't before the universe |
| 3305 // dies of heat death. | 3307 // dies of heat death. |
| 3306 EXPECT_NE(guid1, guid2); | 3308 EXPECT_NE(guid1, guid2); |
| 3307 } | 3309 } |
| 3308 | 3310 |
| 3309 } // namespace syncable | 3311 } // namespace syncable |
| 3310 } // namespace syncer | 3312 } // namespace syncer |
| OLD | NEW |