Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2860)

Unified Diff: base/test/test_support_ios.mm

Issue 2226623003: Adds support for running unittests using XCTest on iOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/test/test_support_ios.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b9bee484cb15c323eb413890f2f59d498caae45c 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,10 @@ void RunTestsFromIOSApp() {
}
}
+bool IsRunningWithXCTest() {
+ // Under Xcode 7.3 and 8.0, the "XCTestConfigurationFilePath" environment
+ // variable is set when running XCTests.
+ return getenv("XCTestConfigurationFilePath") != nullptr;
+}
+
} // namespace base
« no previous file with comments | « base/test/test_support_ios.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698