• Mark Cogan's avatar
    [iOS] Add TabModel unit tests. · 465a0eb0
    Mark Cogan authored
    Per comments on the CL to change the ownership of WebStateLists
    (crrev.com/c/1796358), there are a couple of nuances to behavior
    in TabModel that aren't currently covered by unit tests.
    
    First, multiple calls to -browserStateDestroyed must be safe. Since
    possible failure modes are DCHECKS or outright segfaults, the test just
    creates and populates a tab model, then calls -browserStateDestroyed
    twice.
    
    Second, empty sessions should be saved (meaning that when the user has
    no open tabs, restoring the session should not show any of the previously
    open tabs). The test here is also straightforward: force-save a non-empty
    session, close all of the tabs, force-save again, restore, and verify
    that there are no open tabs.
    
    Change-Id: I3b40d8fc6f60ca51bfaebeb704324a04d60bd7d7
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1819239Reviewed-by: default avatarMohammad Refaat <mrefaat@chromium.org>
    Commit-Queue: Mark Cogan <marq@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#699238}
    465a0eb0
tab_model_unittest.mm 30.1 KB