• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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"""
8Verifies that bundles that have no 'sources' (pure resource containers) work.
9"""
10
11import TestGyp
12
13import sys
14
15if sys.platform == 'darwin':
16  print "This test is currently disabled: https://crbug.com/483696."
17  sys.exit(0)
18
19  test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'])
20
21  test.run_gyp('test.gyp', chdir='sourceless-module')
22
23  # Just needs to build without errors.
24  test.build('test.gyp', 'empty_bundle', chdir='sourceless-module')
25  test.built_file_must_not_exist(
26      'empty_bundle.bundle', chdir='sourceless-module')
27
28  # Needs to build, and contain a resource.
29  test.build('test.gyp', 'resource_bundle', chdir='sourceless-module')
30
31  test.built_file_must_exist(
32      'resource_bundle.bundle/Contents/Resources/foo.manifest',
33      chdir='sourceless-module')
34  test.built_file_must_not_exist(
35      'resource_bundle.bundle/Contents/MacOS/resource_bundle',
36      chdir='sourceless-module')
37
38  # Build an app containing an actionless bundle.
39  test.build(
40      'test.gyp',
41      'bundle_dependent_on_resource_bundle_no_actions',
42      chdir='sourceless-module')
43
44  test.built_file_must_exist(
45      'bundle_dependent_on_resource_bundle_no_actions.app/Contents/Resources/'
46          'mac_resource_bundle_no_actions.bundle/Contents/Resources/empty.txt',
47      chdir='sourceless-module')
48
49  # Needs to build and cause the bundle to be built.
50  test.build(
51      'test.gyp', 'dependent_on_resource_bundle', chdir='sourceless-module')
52
53  test.built_file_must_exist(
54      'resource_bundle.bundle/Contents/Resources/foo.manifest',
55      chdir='sourceless-module')
56  test.built_file_must_not_exist(
57      'resource_bundle.bundle/Contents/MacOS/resource_bundle',
58      chdir='sourceless-module')
59
60  # TODO(thakis): shared_libraries that have no sources but depend on static
61  # libraries currently only work with the ninja generator.  This is used by
62  # chrome/mac's components build.
63  if test.format == 'ninja':
64    # Check that an executable depending on a resource framework links fine too.
65    test.build(
66       'test.gyp', 'dependent_on_resource_framework', chdir='sourceless-module')
67
68    test.built_file_must_exist(
69        'resource_framework.framework/Resources/foo.manifest',
70        chdir='sourceless-module')
71    test.built_file_must_exist(
72        'resource_framework.framework/resource_framework',
73        chdir='sourceless-module')
74
75  test.pass_test()
76