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

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
« no previous file with comments | « build/android/gyp/java_google_api_keys.py ('k') | build/android/java_google_api_keys.gyp » ('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 """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
20 sys.path.append(os.path.join(os.path.dirname(__file__), "gyp"))
21 from util import build_utils
22
23
24 class TestJavaGoogleAPIKeys(unittest.TestCase):
25 def testOutput(self):
26 definition = {'E1': 'abc', 'E2': 'defgh'}
27 output = java_google_api_keys.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 % java_google_api_keys.GetScriptName(), output)
46
47
48 def main(argv):
49 parser = argparse.ArgumentParser()
50 parser.add_argument("--stamp", help="File to touch on success.")
51 options = parser.parse_args(argv)
52
53 suite = unittest.TestLoader().loadTestsFromTestCase(TestJavaGoogleAPIKeys)
54 unittest.TextTestRunner(verbosity=0).run(suite)
55
56 if options.stamp:
57 build_utils.Touch(options.stamp)
58
59 if __name__ == '__main__':
60 main(sys.argv[1:])
61
OLDNEW
« no previous file with comments | « build/android/gyp/java_google_api_keys.py ('k') | build/android/java_google_api_keys.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698