• Rohit Rao's avatar
    [ios] Adds the ability to run unittests using XCTest. · b6c231b5
    Rohit Rao authored
    This new functionality is hidden behind both a GN arg
    (enable_run_ios_unittests_with_xctest) and a commandline switch
    (--enable-run-unittests-with-xctest), in order to default it to off
    until the bots are updated to properly run XCTest-based unittests.
    
    The iOS test runner is updated to run in one of two modes.  When
    --enable-run-unittests-with-xctest is false (the default), behavior is
    unchanged; TestSuite::Run() calls UIApplicationMain(), then the
    UIApplicationDelegate calls TestSuite::Run() again, which actually runs
    the tests when invoked the second time.  When the switch is set to true,
    the second invocation of TestSuite::Run() is made by our XCTestCase
    subclass rather than by the application delegate.
    
    Xcode provides the ability to run XCTests and XCUITests from the
    commandline, but does not provide any other way to install and run an
    app outside of this test-based workflow.  (We had an alternative that
    used third party libraries, but they no longer work on iOS 13.)  This
    makes it difficult to install and run GoogleTest-based tests on iOS
    devices, since they run as a single self-contained application, but it
    would not be practical to drop GoogleTest support on iOS.  Instead, we
    are exploring invoking these tests via XCTest, which would allow us to
    use Xcode's tooling but still run the same GoogleTest-based tests as on
    other platforms.
    
    BUG=635509
    
    Change-Id: I26c67d9c7e16a744f43a20f2d8c5839ca8b3c31a
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1787593Reviewed-by: default avatarDirk Pranke <dpranke@chromium.org>
    Reviewed-by: default avatarMark Mentovai <mark@chromium.org>
    Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
    Commit-Queue: Rohit Rao <rohitrao@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#694749}
    b6c231b5
test_support_ios.h 763 Bytes