• Bence Béky's avatar
    Do not check if callback is null in test Socket classes. · 96ef0672
    Bence Béky authored
    Do not check if callback is null in test-only AsyncSocket subclasses in
    RunCallback().  If the method was supposed to handle the case of null
    callback, it should be called MaybeRunCallback() instead.
    
    Add DCHECKs on callback at call sites to document expectations.
    
    Also, avoid double move when unnecessary.
    
    Also, fix GCMConnectionHandlerImplTests.  Calling
    MockTCPClientSocket::Connect() with null callback on ASYNC mock data
    is not consistent with the async idiom used in //net.  Sure it didn't
    use to blow up, because MockClientSocket::RunCallback() special-cased
    null callbacks.  :(
    
    Also, use make_unique instead of new throughout
    google_apis/gcm/engine/connection_handler_impl_unittest.cc.
    
    Bug: 807724
    
    Change-Id: I3adb8d2a09c87fa004b1b4e7a8cf6f0edff064a6
    Reviewed-on: https://chromium-review.googlesource.com/1064193
    Commit-Queue: Bence Béky <bnc@chromium.org>
    Reviewed-by: default avatarEric Roman <eroman@chromium.org>
    Reviewed-by: default avatarNicolas Zea <zea@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#561528}
    96ef0672
socket_test_util.cc 71.1 KB