Make all gtest targets into bundles on iOS

The raw 'executable' type maps to the .tool Apple product-type, which doesn't exist on iOS. Make each unit test a bundle instead.

BUG=None
TEST=None


Review URL: https://chromiumcodereview.appspot.com/10704121

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145671 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/testing/gtest.gyp b/testing/gtest.gyp
index 78b3ce23..b01c694 100644
--- a/testing/gtest.gyp
+++ b/testing/gtest.gyp
@@ -1,4 +1,4 @@
-# Copyright (c) 2011 The Chromium Authors. All rights reserved.
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
@@ -51,7 +51,7 @@
         'gtest_prod',
       ],
       'conditions': [
-        ['OS == "mac"', {
+        ['OS == "mac" or OS == "ios"', {
           'sources': [
             'gtest_mac.h',
             'gtest_mac.mm',
@@ -63,6 +63,34 @@
             ],
           },
         }],
+        ['OS == "ios"', {
+          'direct_dependent_settings': {
+            'target_conditions': [
+              # Turn all tests into bundles on iOS because that's the only
+              # type of executable supported for iOS.
+              ['_type=="executable"', {
+                'variables': {
+                  # Use a variable so the path gets fixed up so it is always
+                  # correct when INFOPLIST_FILE finally gets set.
+                  'ios_unittest_info_plist_path':
+                    '<(DEPTH)/testing/gtest_ios/unittest-Info.plist',
+                },
+                'mac_bundle': 1,
+                'xcode_settings': {
+                  'BUNDLE_ID_TEST_NAME':
+                    '>!(echo ">(_target_name)" | sed -e "s/_//g")',
+                  'INFOPLIST_FILE': '>(ios_unittest_info_plist_path)',
+                },
+                'mac_bundle_resources': [
+                  '<(ios_unittest_info_plist_path)',
+                ],
+                'mac_bundle_resources!': [
+                  '<(ios_unittest_info_plist_path)',
+                ],
+              }],
+            ],
+          },
+        }],
         ['os_posix == 1', {
           'defines': [
             # gtest isn't able to figure out when RTTI is disabled for gcc
@@ -111,6 +139,17 @@
                   'action????': ['${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}'],
                 },
               }],
+              ['OS=="ios"', {
+                'variables': {
+                  # Use a variable so the path gets fixed up so it is always
+                  # correct when the action finally gets used.
+                  'ios_run_unittest_script_path':
+                    '<(DEPTH)/testing/gtest_ios/RunUnittest.sh',
+                },
+                'run_as': {
+                  'action????': ['>(ios_run_unittest_script_path)'],
+                },
+              }],
               ['OS=="win"', {
                 'run_as': {
                   'action????': ['$(TargetPath)', '--gtest_print_time'],