Chromium Code Reviews| Index: base/test/test_support_ios.mm |
| diff --git a/base/test/test_support_ios.mm b/base/test/test_support_ios.mm |
| index 2509fa0e7307b078d7df913351fea1ce1995faf2..0d86dc13cb08f40f3e252d4be8bd77c0e3aebf1a 100644 |
| --- a/base/test/test_support_ios.mm |
| +++ b/base/test/test_support_ios.mm |
| @@ -2,6 +2,8 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| +#include "base/test/test_support_ios.h" |
| + |
| #import <UIKit/UIKit.h> |
| #include "base/debug/debugger.h" |
| @@ -155,6 +157,12 @@ static char** g_argv; |
| - (void)runTests { |
| int exitStatus = g_test_suite->Run(); |
| + if (base::IsRunningWithXCTest()) { |
| + // Do not kill the app when running in XCTest mode. XCTest will shut down |
| + // the app itself. |
| + return; |
| + } |
| + |
| if ([self shouldRedirectOutputToFile]) |
| [self writeOutputToNSLog]; |
| @@ -217,4 +225,11 @@ void RunTestsFromIOSApp() { |
| } |
| } |
| +bool IsRunningWithXCTest() { |
| + // Under Xcode 7.3 and 8.0, the "XCTestConfigurationFilePath" environment |
| + // variable is set when running XCTests. |
| + NSDictionary* environment = [[NSProcessInfo processInfo] environment]; |
|
Mark Mentovai
2016/08/08 20:55:44
return getenv("XCTestConfigurationFilePath") != nu
rohitrao (ping after 24h)
2016/08/09 11:40:23
Done.
|
| + return environment[@"XCTestConfigurationFilePath"] != nil; |
| +} |
| + |
| } // namespace base |