• stanisc's avatar
    Sync: Handle empty (implicit) ParentId in GetPredecessorId and GetSuccessorId · 12cf7b56
    stanisc authored
    GetSuccessorId and GetPredecessorId access all children of the
    current node's parent in order to get to the next/previous node.
    With implicit parent ID these functions can't get to the parent.
    The reasons we didn't run into this problem before are
    a) The server feature that will stop setting parent ID isn't
       enabled yet so there wasn't a chance to expose this yet.
    b) There wasn't enough test coverage.
    
    The fix is to use the ParentChildIndex to resolve the implicit
    (unset) parent ID. Added a new method called GetSiblings at
    the Directory level that does just that. Also added some
    unit test coverage.
    
    BUG=438313
    
    Review URL: https://codereview.chromium.org/1008993004
    
    Cr-Commit-Position: refs/heads/master@{#320922}
    12cf7b56
parent_child_index.cc 5.5 KB