java_google_api_keys_tests.py (1050B)
1 #!/usr/bin/env python3 2 # Copyright 2015 The Chromium Authors 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 unittest 13 14 import java_google_api_keys 15 16 17 class TestJavaGoogleAPIKeys(unittest.TestCase): 18 def testOutput(self): 19 definition = {'E1': 'abc', 'E2': 'defgh'} 20 output = java_google_api_keys.GenerateOutput(definition) 21 expected = """ 22 // Copyright 2015 The Chromium Authors 23 // Use of this source code is governed by a BSD-style license that can be 24 // found in the LICENSE file. 25 26 // This file is autogenerated by 27 // %s 28 // From 29 // google_api_keys/google_api_keys.h 30 31 package org.chromium.chrome; 32 33 public class GoogleAPIKeys { 34 public static final String E1 = "abc"; 35 public static final String E2 = "defgh"; 36 } 37 """ 38 self.assertEqual(expected % java_google_api_keys.GetScriptName(), output) 39 40 41 if __name__ == '__main__': 42 unittest.main()