• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2
3# Copyright (c) 2014 Google Inc. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7"""
8Verifies that ios app extensions are built correctly.
9"""
10
11import TestGyp
12import TestMac
13import subprocess
14import sys
15
16def CheckStrip(p, expected):
17  if expected not in subprocess.check_output(['nm','-gU', p]):
18    print expected + " shouldn't get stripped out."
19    test.fail_test()
20
21def CheckEntrypoint(p, expected):
22  if expected not in subprocess.check_output(['nm', p]):
23    print expected + "not found."
24    test.fail_test()
25
26if sys.platform == 'darwin' and TestMac.Xcode.Version()>="0600":
27
28  test = TestGyp.TestGyp(formats=['ninja', 'xcode'])
29
30  test.run_gyp('extension.gyp', chdir='extension')
31
32  test.build('extension.gyp', 'ExtensionContainer', chdir='extension')
33
34  # Test that the extension is .appex
35  test.built_file_must_exist(
36      'ExtensionContainer.app/PlugIns/ActionExtension.appex',
37      chdir='extension')
38
39  path = test.built_file_path(
40      'ExtensionContainer.app/PlugIns/ActionExtension.appex/ActionExtension',
41      chdir='extension')
42  CheckStrip(path, "ActionViewController")
43  CheckEntrypoint(path, "_NSExtensionMain")
44
45  test.pass_test()
46
47