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

Side by Side Diff: platform_tools/android/tests/generate_user_config_tests.py

Issue 388693003: Alphabetize defines in generated SkUserConfig. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 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 | « platform_tools/android/tests/expectations/missing-filename.xxx ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 # Copyright 2014 Google Inc. 3 # Copyright 2014 Google Inc.
4 # 4 #
5 # Use of this source code is governed by a BSD-style license that can be 5 # Use of this source code is governed by a BSD-style license that can be
6 # found in the LICENSE file. 6 # found in the LICENSE file.
7 7
8 """ 8 """
9 Test generate_user_config.py. 9 Test generate_user_config.py.
10 """ 10 """
(...skipping 23 matching lines...) Expand all
34 def generate_dummy_user_config(original_sk_user_config, 34 def generate_dummy_user_config(original_sk_user_config,
35 require_sk_user_config, target_dir): 35 require_sk_user_config, target_dir):
36 # Add an arbitrary set of defines 36 # Add an arbitrary set of defines
37 defines = [ 'SK_BUILD_FOR_ANDROID', 37 defines = [ 'SK_BUILD_FOR_ANDROID',
38 'SK_BUILD_FOR_ANDROID_FRAMEWORK', 38 'SK_BUILD_FOR_ANDROID_FRAMEWORK',
39 'SK_SCALAR_IS_FLOAT', 39 'SK_SCALAR_IS_FLOAT',
40 'foo', 40 'foo',
41 'bar' ] 41 'bar' ]
42 gen_config(original_sk_user_config=original_sk_user_config, 42 gen_config(original_sk_user_config=original_sk_user_config,
43 require_sk_user_config=require_sk_user_config, 43 require_sk_user_config=require_sk_user_config,
44 target_dir=target_dir, ordered_set=defines) 44 target_dir=target_dir, defines=defines)
45 45
46 46
47 class GenUserConfigTest(unittest.TestCase): 47 class GenUserConfigTest(unittest.TestCase):
48 48
49 def test_missing_sk_user_config(self): 49 def test_missing_sk_user_config(self):
50 tmp = tempfile.mkdtemp() 50 tmp = tempfile.mkdtemp()
51 original = os.path.join(tmp, MISSING_FILENAME) 51 original = os.path.join(tmp, MISSING_FILENAME)
52 assert not os.path.exists(original) 52 assert not os.path.exists(original)
53 53
54 54
55 # With require_sk_user_config set to True, an AssertionError will be 55 # With require_sk_user_config set to True, an AssertionError will be
56 # thrown when original_sk_user_config is missing. 56 # thrown when original_sk_user_config is missing.
57 with self.assertRaises(AssertionError): 57 with self.assertRaises(AssertionError):
58 ordered_set = [ 'define' ] 58 ordered_set = [ 'define' ]
mtklein 2014/07/14 16:29:22 -> defines?
scroggo 2014/07/14 17:06:52 Done.
59 gen_config(original_sk_user_config=original, 59 gen_config(original_sk_user_config=original,
60 require_sk_user_config=True, 60 require_sk_user_config=True,
61 target_dir=tmp, ordered_set=ordered_set) 61 target_dir=tmp, defines=ordered_set)
62 62
63 # With require_sk_user_config set to False, it is okay for 63 # With require_sk_user_config set to False, it is okay for
64 # original_sk_user_config to be missing. 64 # original_sk_user_config to be missing.
65 generate_dummy_user_config(original_sk_user_config=original, 65 generate_dummy_user_config(original_sk_user_config=original,
66 require_sk_user_config=False, target_dir=tmp) 66 require_sk_user_config=False, target_dir=tmp)
67 actual_name = os.path.join(tmp, MISSING_FILENAME) 67 actual_name = os.path.join(tmp, MISSING_FILENAME)
68 utils.compare_to_expectation(actual_name=actual_name, 68 utils.compare_to_expectation(actual_name=actual_name,
69 expectation_name=MISSING_FILENAME, 69 expectation_name=MISSING_FILENAME,
70 assert_true=self.assertTrue, 70 assert_true=self.assertTrue,
71 msg=REBASELINE_MSG) 71 msg=REBASELINE_MSG)
(...skipping 27 matching lines...) Expand all
99 parser = argparse.ArgumentParser() 99 parser = argparse.ArgumentParser()
100 parser.add_argument('-r', '--rebaseline', help='Rebaseline expectations.', 100 parser.add_argument('-r', '--rebaseline', help='Rebaseline expectations.',
101 action='store_true') 101 action='store_true')
102 args = parser.parse_args() 102 args = parser.parse_args()
103 103
104 if args.rebaseline: 104 if args.rebaseline:
105 rebaseline() 105 rebaseline()
106 else: 106 else:
107 main() 107 main()
108 108
OLDNEW
« no previous file with comments | « platform_tools/android/tests/expectations/missing-filename.xxx ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698