| 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 from __future__ import print_function |
| 12 |
| 11 import TestGyp | 13 import TestGyp |
| 12 import TestMac | 14 import TestMac |
| 13 import subprocess | 15 import subprocess |
| 14 import sys | 16 import sys |
| 15 | 17 |
| 16 def CheckStrip(p, expected): | 18 def CheckStrip(p, expected): |
| 17 if expected not in subprocess.check_output(['nm','-gU', p]): | 19 if expected not in subprocess.check_output(['nm','-gU', p]): |
| 18 print expected + " shouldn't get stripped out." | 20 print(expected + " shouldn't get stripped out.") |
| 19 test.fail_test() | 21 test.fail_test() |
| 20 | 22 |
| 21 def CheckEntrypoint(p, expected): | 23 def CheckEntrypoint(p, expected): |
| 22 if expected not in subprocess.check_output(['nm', p]): | 24 if expected not in subprocess.check_output(['nm', p]): |
| 23 print expected + "not found." | 25 print(expected + "not found.") |
| 24 test.fail_test() | 26 test.fail_test() |
| 25 | 27 |
| 26 if sys.platform == 'darwin' and TestMac.Xcode.Version()>="0600": | 28 if sys.platform == 'darwin' and TestMac.Xcode.Version()>="0600": |
| 27 | 29 |
| 28 test = TestGyp.TestGyp(formats=['ninja', 'xcode']) | 30 test = TestGyp.TestGyp(formats=['ninja', 'xcode']) |
| 29 | 31 |
| 30 test.run_gyp('extension.gyp', chdir='extension') | 32 test.run_gyp('extension.gyp', chdir='extension') |
| 31 | 33 |
| 32 test.build('extension.gyp', 'ExtensionContainer', chdir='extension') | 34 test.build('extension.gyp', 'ExtensionContainer', chdir='extension') |
| 33 | 35 |
| 34 # Test that the extension is .appex | 36 # Test that the extension is .appex |
| 35 test.built_file_must_exist( | 37 test.built_file_must_exist( |
| 36 'ExtensionContainer.app/PlugIns/ActionExtension.appex', | 38 'ExtensionContainer.app/PlugIns/ActionExtension.appex', |
| 37 chdir='extension') | 39 chdir='extension') |
| 38 | 40 |
| 39 path = test.built_file_path( | 41 path = test.built_file_path( |
| 40 'ExtensionContainer.app/PlugIns/ActionExtension.appex/ActionExtension', | 42 'ExtensionContainer.app/PlugIns/ActionExtension.appex/ActionExtension', |
| 41 chdir='extension') | 43 chdir='extension') |
| 42 CheckStrip(path, "ActionViewController") | 44 CheckStrip(path, "ActionViewController") |
| 43 CheckEntrypoint(path, "_NSExtensionMain") | 45 CheckEntrypoint(path, "_NSExtensionMain") |
| 44 | 46 |
| 45 test.pass_test() | 47 test.pass_test() |
| 46 | 48 |
| OLD | NEW |