Chromium Code Reviews| Index: sync/syncable/syncable_unittest.cc |
| diff --git a/sync/syncable/syncable_unittest.cc b/sync/syncable/syncable_unittest.cc |
| index f69347b75e7453b18879ac477e2130be19da82c5..3b03662aed1e60f64a5cc7449e154cd5d3ab5521 100644 |
| --- a/sync/syncable/syncable_unittest.cc |
| +++ b/sync/syncable/syncable_unittest.cc |
| @@ -35,6 +35,8 @@ |
| #include "sync/test/null_transaction_observer.h" |
| #include "sync/util/test_unrecoverable_error_handler.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| +#include "sync/internal_api/public/base/ordinal.h" |
|
rlarocque
2012/10/01 21:45:55
Fix include ordering.
vishwath
2012/10/02 01:06:33
Done.
|
| +#include "sync/internal_api/public/base/node_ordinal.h" |
| namespace syncer { |
| namespace syncable { |
| @@ -1366,6 +1368,38 @@ TEST_F(SyncableDirectoryTest, OldClientLeftUnsyncedDeletedLocalItem) { |
| } |
| } |
| +TEST_F(SyncableDirectoryTest, OrdinalHandlesNullValues) { |
| + TestIdFactory id_factory; |
| + Id null_child_id; |
| + int64 null_ord = NodeOrdinalToInt64( |
| + NodeOrdinal("Thisshould\0workfine")); |
|
rlarocque
2012/10/01 21:45:55
IIRC, only the first 8 bytes will be maintained af
vishwath
2012/10/02 01:06:33
Done.
|
| + |
| + { |
| + WriteTransaction trans(FROM_HERE, UNITTEST, dir_.get()); |
| + |
| + MutableEntry parent(&trans, CREATE, id_factory.root(), "parent"); |
| + parent.Put(IS_DIR, true); |
| + parent.Put(IS_UNSYNCED, true); |
| + |
| + MutableEntry child(&trans, CREATE, parent.Get(ID), "child"); |
| + child.Put(IS_UNSYNCED, true); |
| + child.Put(SERVER_POSITION_IN_PARENT, null_ord); |
| + |
| + null_child_id = child.Get(ID); |
| + } |
| + |
| + EXPECT_EQ(OPENED, SimulateSaveAndReloadDir()); |
| + |
| + { |
| + ReadTransaction trans(FROM_HERE, dir_.get()); |
| + |
| + Entry null_ordinal_child(&trans, GET_BY_ID, null_child_id); |
| + EXPECT_EQ(null_ord, |
| + null_ordinal_child.Get(SERVER_POSITION_IN_PARENT)); |
| + } |
| + |
| +} |
| + |
| // An OnDirectoryBackingStore that can be set to always fail SaveChanges. |
| class TestBackingStore : public OnDiskDirectoryBackingStore { |
| public: |