| 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 | 5 |
| 6 #include "chrome/browser/sync/invalidations/invalidator_storage.h" | 6 #include "chrome/browser/sync/invalidations/invalidator_storage.h" |
| 7 | 7 |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "base/string_util.h" |
| 10 #include "chrome/test/base/testing_pref_service.h" | 11 #include "chrome/test/base/testing_pref_service.h" |
| 11 #include "sync/syncable/model_type.h" | 12 #include "sync/syncable/model_type.h" |
| 12 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 15 |
| 15 using sync_notifier::InvalidationVersionMap; | 16 using sync_notifier::InvalidationVersionMap; |
| 16 | 17 |
| 17 namespace browser_sync { | 18 namespace browser_sync { |
| 18 | 19 |
| 19 class InvalidatorStorageTest : public testing::Test { | 20 class InvalidatorStorageTest : public testing::Test { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 120 |
| 120 dict.SetString(base::IntToString(syncable::AUTOFILL), "10"); | 121 dict.SetString(base::IntToString(syncable::AUTOFILL), "10"); |
| 121 dict.SetString(base::IntToString(syncable::BOOKMARKS), "15"); | 122 dict.SetString(base::IntToString(syncable::BOOKMARKS), "15"); |
| 122 | 123 |
| 123 InvalidatorStorage::DeserializeMap(&dict, &map); | 124 InvalidatorStorage::DeserializeMap(&dict, &map); |
| 124 EXPECT_EQ(2U, map.size()); | 125 EXPECT_EQ(2U, map.size()); |
| 125 EXPECT_EQ(10, map[syncable::AUTOFILL]); | 126 EXPECT_EQ(10, map[syncable::AUTOFILL]); |
| 126 EXPECT_EQ(15, map[syncable::BOOKMARKS]); | 127 EXPECT_EQ(15, map[syncable::BOOKMARKS]); |
| 127 } | 128 } |
| 128 | 129 |
| 130 TEST_F(InvalidatorStorageTest, SetGetInvalidationState) { |
| 131 InvalidatorStorage storage(&pref_service_); |
| 132 const std::string mess("n\0tK\0\0l\344", 8); |
| 133 ASSERT_FALSE(IsStringUTF8(mess)); |
| 134 |
| 135 storage.SetInvalidationState(mess); |
| 136 EXPECT_EQ(mess, storage.GetInvalidationState()); |
| 137 } |
| 138 |
| 129 } // namespace browser_sync | 139 } // namespace browser_sync |
| OLD | NEW |