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