OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/sync/syncable/syncable.h" | 5 #include "chrome/browser/sync/syncable/syncable.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include <sys/types.h> | 9 #include <sys/types.h> |
10 | 10 |
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 // Combo test. | 1106 // Combo test. |
1107 EXPECT_TRUE(PathNameMatch(PSTR(" b;ob"), PSTR(" b;o*"))); | 1107 EXPECT_TRUE(PathNameMatch(PSTR(" b;ob"), PSTR(" b;o*"))); |
1108 EXPECT_TRUE(PathNameMatch(PSTR(" b;ob"), PSTR(" b;ob"))); | 1108 EXPECT_TRUE(PathNameMatch(PSTR(" b;ob"), PSTR(" b;ob"))); |
1109 EXPECT_FALSE(PathNameMatch(PSTR("b;ob"), PSTR(" b;ob"))); | 1109 EXPECT_FALSE(PathNameMatch(PSTR("b;ob"), PSTR(" b;ob"))); |
1110 EXPECT_FALSE(PathNameMatch(PSTR(" b;ob"), PSTR("b;ob"))); | 1110 EXPECT_FALSE(PathNameMatch(PSTR(" b;ob"), PSTR("b;ob"))); |
1111 // other whitespace should give no matches. | 1111 // other whitespace should give no matches. |
1112 EXPECT_FALSE(PathNameMatch(PSTR("bob"), PSTR("\tbob"))); | 1112 EXPECT_FALSE(PathNameMatch(PSTR("bob"), PSTR("\tbob"))); |
1113 } | 1113 } |
1114 #endif // OS_WIN | 1114 #endif // OS_WIN |
1115 | 1115 |
1116 } // namespace | |
1117 | |
1118 void FakeSync(MutableEntry* e, const char* fake_id) { | 1116 void FakeSync(MutableEntry* e, const char* fake_id) { |
1119 e->Put(IS_UNSYNCED, false); | 1117 e->Put(IS_UNSYNCED, false); |
1120 e->Put(BASE_VERSION, 2); | 1118 e->Put(BASE_VERSION, 2); |
1121 e->Put(ID, Id::CreateFromServerId(fake_id)); | 1119 e->Put(ID, Id::CreateFromServerId(fake_id)); |
1122 } | 1120 } |
1123 | 1121 |
1124 TEST_F(SyncableDirectoryTest, Bug1509232) { | 1122 TEST_F(SyncableDirectoryTest, Bug1509232) { |
1125 const PathString a = PSTR("alpha"); | 1123 const PathString a = PSTR("alpha"); |
1126 | 1124 |
1127 CreateEntry(a, dir_.get()->NextId()); | 1125 CreateEntry(a, dir_.get()->NextId()); |
1128 { | 1126 { |
1129 WriteTransaction trans(dir_.get(), UNITTEST, __FILE__, __LINE__); | 1127 WriteTransaction trans(dir_.get(), UNITTEST, __FILE__, __LINE__); |
1130 MutableEntry e(&trans, GET_BY_PATH, a); | 1128 MutableEntry e(&trans, GET_BY_PATH, a); |
1131 ASSERT_TRUE(e.good()); | 1129 ASSERT_TRUE(e.good()); |
1132 ExtendedAttributeKey key(e.Get(META_HANDLE), PSTR("resourcefork")); | 1130 ExtendedAttributeKey key(e.Get(META_HANDLE), PSTR("resourcefork")); |
1133 MutableExtendedAttribute ext(&trans, CREATE, key); | 1131 MutableExtendedAttribute ext(&trans, CREATE, key); |
1134 ASSERT_TRUE(ext.good()); | 1132 ASSERT_TRUE(ext.good()); |
1135 const char value[] = "stuff"; | 1133 const char value[] = "stuff"; |
1136 Blob value_blob(value, value + arraysize(value)); | 1134 Blob value_blob(value, value + arraysize(value)); |
1137 ext.mutable_value()->swap(value_blob); | 1135 ext.mutable_value()->swap(value_blob); |
1138 ext.delete_attribute(); | 1136 ext.delete_attribute(); |
1139 } | 1137 } |
1140 // This call to SaveChanges used to CHECK fail. | 1138 // This call to SaveChanges used to CHECK fail. |
1141 dir_.get()->SaveChanges(); | 1139 dir_.get()->SaveChanges(); |
1142 } | 1140 } |
1143 | 1141 |
| 1142 } // namespace |
1144 } // namespace syncable | 1143 } // namespace syncable |
OLD | NEW |