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
8This test suite contains various tests for the C++ -> Java Google API Keys
9generator.
10"""
11
12import unittest
13
14import java_google_api_keys
15
16
17class 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. All rights reserved.
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
31package org.chromium.chrome;
32
33public 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
41if __name__ == '__main__':
42  unittest.main()
43