• pedrosimonetti's avatar
    [Contextual Search] Improve testing & add regressions tests · 7e0c3b88
    pedrosimonetti authored
    This CL adds tests for regressions that have been fixed
    recently, some of them involving ContentViewCore.
    
    In order to be able to properly instrument the ContentViewCore,
    changes in the testing framework have been made. There are now
    a couple of wrapper classes: OverlayPanelContentWrapper and
    ContentViewCoreWrapper, which allow us to test for example
    if the onShow() method was ever called, or if URLs have been
    properly removed from local history when not seen.
    
    This CL also introduces a few more helpers to simulate searches
    caused by gestures (long press and tap) in a way that it
    encapsulates the simulation logic and prevent flakiness. We
    were manually doing a search term resolution by calling a
    fakeResponse() method. Sometimes we are calling this when
    not necessary (on long press) and tests don't call it in the
    same order. We are also assuming it completed when the Bar
    peeks (which works but under the wrong assumption). There are
    now simulateLongPressSearch(id) and simulateTapSearch(id)
    methods that simulate the search and handle the resolution
    automatically when the system requests one.
    
    There are several helper methods in ContextualSearchManagerTest
    that are similar but do slightly different things, and some
    assumptions are not quite correct which can and may be causing
    falkiness in some tests. A couple of examples are: tests rely
    on the change of state of the Panel in order to determine that
    animations/actions are done. The closed state was being changed
    before destroying the Contents. This is now fixed.
    
    Another example is the tapBasePageToClosePanel() helper method
    that wasn't properly working when the Panel was peeking while
    a long press selection is present. I believe this is the cause
    of the flakiness of 3 of our tests.
    
    The new search simulation method should help making our tests
    more robust and a followup CL is required to change existing
    tests to use the new methods, once it has been confirmed that
    the new methods work properly on existing test bots.
    
    BUG=543319
    
    Review URL: https://codereview.chromium.org/1426683005
    
    Cr-Commit-Position: refs/heads/master@{#357143}
    7e0c3b88
tap_test.html 2.19 KB