1 #!/usr/bin/env python 2 3 # Copyright (c) 2012 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 """ 8 Verifies the Info.plist preprocessor functionality. 9 """ 10 11 import TestGyp 12 13 import sys 14 15 if sys.platform == 'darwin': 16 test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) 17 18 CHDIR = 'infoplist-process' 19 INFO_PLIST_PATH = 'Test.app/Contents/Info.plist' 20 21 # First process both keys. 22 test.set_configuration('One') 23 test.run_gyp('test1.gyp', chdir=CHDIR) 24 test.build('test1.gyp', test.ALL, chdir=CHDIR) 25 info_plist = test.built_file_path(INFO_PLIST_PATH, chdir=CHDIR) 26 test.must_exist(info_plist) 27 test.must_contain(info_plist, 'Foo') 28 test.must_contain(info_plist, 'Bar') 29 30 # Then process a single key. 31 test.set_configuration('Two') 32 test.run_gyp('test2.gyp', chdir=CHDIR) 33 test.build('test2.gyp', chdir=CHDIR) 34 info_plist = test.built_file_path(INFO_PLIST_PATH, chdir=CHDIR) 35 test.must_exist(info_plist) 36 test.must_contain(info_plist, 'com.google.Test') # Normal expansion works. 37 test.must_contain(info_plist, 'Foo (Bar)') 38 test.must_contain(info_plist, 'PROCESSED_KEY2') 39 40 # Then turn off the processor. 41 test.set_configuration('Three') 42 test.run_gyp('test3.gyp', chdir=CHDIR) 43 test.build('test3.gyp', chdir=CHDIR) 44 info_plist = test.built_file_path('Test App.app/Contents/Info.plist', 45 chdir=CHDIR) 46 test.must_exist(info_plist) 47 test.must_contain(info_plist, 'com.google.Test') # Normal expansion works. 48 test.must_contain(info_plist, 'PROCESSED_KEY1') 49 test.must_contain(info_plist, 'PROCESSED_KEY2') 50 51 test.pass_test() 52