Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Side by Side Diff: build/gyp_chromium_test.py

Issue 2355673003: Gut gyp_chromium, common.gypi. (Closed)
Patch Set: linting Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/gyp_chromium.py ('k') | docs/ccache_mac.md » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 import os
7 import sys
8 import unittest
9
10 SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__))
11 SRC_DIR = os.path.dirname(SCRIPT_DIR)
12
13 sys.path.append(os.path.join(SRC_DIR, 'third_party', 'pymock'))
14
15 import mock
16
17 import gyp_chromium
18
19
20 class TestGetOutputDirectory(unittest.TestCase):
21 @mock.patch('os.environ', {})
22 @mock.patch('sys.argv', [__file__])
23 def testDefaultValue(self):
24 self.assertEqual(gyp_chromium.GetOutputDirectory(), 'out')
25
26 @mock.patch('os.environ', {'GYP_GENERATOR_FLAGS': 'output_dir=envfoo'})
27 @mock.patch('sys.argv', [__file__])
28 def testEnvironment(self):
29 self.assertEqual(gyp_chromium.GetOutputDirectory(), 'envfoo')
30
31 @mock.patch('os.environ', {'GYP_GENERATOR_FLAGS': 'output_dir=envfoo'})
32 @mock.patch('sys.argv', [__file__, '-Goutput_dir=cmdfoo'])
33 def testGFlagOverridesEnv(self):
34 self.assertEqual(gyp_chromium.GetOutputDirectory(), 'cmdfoo')
35
36 @mock.patch('os.environ', {})
37 @mock.patch('sys.argv', [__file__, '-G', 'output_dir=foo'])
38 def testGFlagWithSpace(self):
39 self.assertEqual(gyp_chromium.GetOutputDirectory(), 'foo')
40
41
42 class TestGetGypVars(unittest.TestCase):
43 @mock.patch('os.environ', {})
44 def testDefault(self):
45 self.assertEqual(gyp_chromium.GetGypVars([]), {})
46
47 @mock.patch('os.environ', {})
48 @mock.patch('sys.argv', [__file__, '-D', 'foo=bar'])
49 def testDFlags(self):
50 self.assertEqual(gyp_chromium.GetGypVars([]), {'foo': 'bar'})
51
52 @mock.patch('os.environ', {})
53 @mock.patch('sys.argv', [__file__, '-D', 'foo'])
54 def testDFlagsNoValue(self):
55 self.assertEqual(gyp_chromium.GetGypVars([]), {'foo': '1'})
56
57 @mock.patch('os.environ', {})
58 @mock.patch('sys.argv', [__file__, '-D', 'foo=bar', '-Dbaz'])
59 def testDFlagMulti(self):
60 self.assertEqual(gyp_chromium.GetGypVars([]), {'foo': 'bar', 'baz': '1'})
61
62
63 if __name__ == '__main__':
64 unittest.main()
OLDNEW
« no previous file with comments | « build/gyp_chromium.py ('k') | docs/ccache_mac.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698