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

Side by Side Diff: build/android/gyp/java_cpp_enum_tests.py

Issue 1932183002: Add IntDefs to generated Java enums. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update deps. Created 4 years, 4 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/android/gyp/java_cpp_enum.py ('k') | components/bookmarks/common/android/BUILD.gn » ('j') | 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/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Tests for enum_preprocess.py. 6 """Tests for enum_preprocess.py.
7 7
8 This test suite containss various tests for the C++ -> Java enum generator. 8 This test suite containss various tests for the C++ -> Java enum generator.
9 """ 9 """
10 10
(...skipping 22 matching lines...) Expand all
33 // Use of this source code is governed by a BSD-style license that can be 33 // Use of this source code is governed by a BSD-style license that can be
34 // found in the LICENSE file. 34 // found in the LICENSE file.
35 35
36 // This file is autogenerated by 36 // This file is autogenerated by
37 // %s 37 // %s
38 // From 38 // From
39 // path/to/file 39 // path/to/file
40 40
41 package some.package; 41 package some.package;
42 42
43 import android.support.annotation.IntDef;
44
45 import java.lang.annotation.Retention;
46 import java.lang.annotation.RetentionPolicy;
47
43 public class ClassName { 48 public class ClassName {
49 @IntDef({
50 E1, E2
51 })
52 @Retention(RetentionPolicy.SOURCE)
53 public @interface ClassNameEnum {}
44 public static final int E1 = 1; 54 public static final int E1 = 1;
45 public static final int E2 = 2 << 2; 55 public static final int E2 = 2 << 2;
46 } 56 }
47 """ 57 """
48 self.assertEqual(expected % (date.today().year, GetScriptName()), output) 58 self.assertEqual(expected % (date.today().year, GetScriptName()), output)
49 59
50 def testParseSimpleEnum(self): 60 def testParseSimpleEnum(self):
51 test_data = """ 61 test_data = """
52 // GENERATED_JAVA_ENUM_PACKAGE: test.namespace 62 // GENERATED_JAVA_ENUM_PACKAGE: test.namespace
53 enum EnumName { 63 enum EnumName {
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 options, _ = parser.parse_args(argv) 439 options, _ = parser.parse_args(argv)
430 440
431 suite = unittest.TestLoader().loadTestsFromTestCase(TestPreprocess) 441 suite = unittest.TestLoader().loadTestsFromTestCase(TestPreprocess)
432 unittest.TextTestRunner(verbosity=0).run(suite) 442 unittest.TextTestRunner(verbosity=0).run(suite)
433 443
434 if options.stamp: 444 if options.stamp:
435 build_utils.Touch(options.stamp) 445 build_utils.Touch(options.stamp)
436 446
437 if __name__ == '__main__': 447 if __name__ == '__main__':
438 main(sys.argv[1:]) 448 main(sys.argv[1:])
OLDNEW
« no previous file with comments | « build/android/gyp/java_cpp_enum.py ('k') | components/bookmarks/common/android/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698