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

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

Issue 1411913005: Make Google API keys available for the Java codebase (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
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 """Tests for java_google_api_keys.py.
7
8 This test suite contains various tests for the C++ -> Java Google API Keys
9 generator.
10 """
11
12 import collections
13 import argparse
14 import os
15 import sys
16 import unittest
17
18 import java_google_api_keys
19 from java_google_api_keys import GenerateOutput, GetScriptName
agrieve 2015/11/03 20:27:35 don't import functions.
dvh 2015/11/04 00:08:43 Done.
20
21 sys.path.append(os.path.join(os.path.dirname(__file__), "gyp"))
22 from util import build_utils
23
agrieve 2015/11/03 20:27:35 2 blanks
dvh 2015/11/04 00:08:43 Done.
24 class TestJavaGoogleAPIKeys(unittest.TestCase):
25 def testOutput(self):
26 definition = {'E1': 'abc', 'E2': 'defgh'}
27 output = GenerateOutput(definition)
28 expected = """
29 // Copyright 2015 The Chromium Authors. All rights reserved.
30 // Use of this source code is governed by a BSD-style license that can be
31 // found in the LICENSE file.
32
33 // This file is autogenerated by
34 // %s
35 // From
36 // google_api_keys/google_api_keys.h
37
38 package org.chromium.chrome;
39
40 public class GoogleAPIKeys {
41 public static final String E1 = "abc";
42 public static final String E2 = "defgh";
43 }
44 """
45 self.assertEqual(expected % GetScriptName(), output)
46
agrieve 2015/11/03 20:27:35 2 blanks
dvh 2015/11/04 00:08:42 Done.
47 def main(argv):
48 parser = argparse.ArgumentParser()
49 parser.add_argument("--stamp", help="File to touch on success.")
50 options = parser.parse_args(argv)
51
52 suite = unittest.TestLoader().loadTestsFromTestCase(TestJavaGoogleAPIKeys)
53 unittest.TextTestRunner(verbosity=0).run(suite)
54
55 if options.stamp:
56 build_utils.Touch(options.stamp)
57
58 if __name__ == '__main__':
59 main(sys.argv[1:])
60
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698