Roll src/third_party/WebKit a3b4a2e:7441784 (svn 202551:202552)
[chromium-blink-merge.git] / build / android / pylib / utils / proguard_test.py
blobe5d5e0130e9aea35d02e3c48c8e7dcff453d3d48
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import unittest
7 from pylib.utils import proguard
9 class TestParse(unittest.TestCase):
11 def testClass(self):
12 actual = proguard.Parse(
13 ['- Program class: org/example/Test',
14 ' Superclass: java/lang/Object'])
15 expected = {
16 'classes': [
18 'class': 'org.example.Test',
19 'superclass': 'java.lang.Object',
20 'annotations': {},
21 'methods': []
25 self.assertEquals(expected, actual)
27 def testMethod(self):
28 actual = proguard.Parse(
29 ['- Program class: org/example/Test',
30 'Methods (count = 1):',
31 '- Method: <init>()V'])
32 expected = {
33 'classes': [
35 'class': 'org.example.Test',
36 'superclass': '',
37 'annotations': {},
38 'methods': [
40 'method': '<init>',
41 'annotations': {}
47 self.assertEquals(expected, actual)
49 def testClassAnnotation(self):
50 actual = proguard.Parse(
51 ['- Program class: org/example/Test',
52 ' - Annotation [Lorg/example/Annotation;]:',
53 ' - Annotation [Lorg/example/AnnotationWithValue;]:',
54 ' - Constant element value [attr \'13\']',
55 ' - Utf8 [val]'])
56 expected = {
57 'classes': [
59 'class': 'org.example.Test',
60 'superclass': '',
61 'annotations': {
62 'Annotation': None,
63 'AnnotationWithValue': 'val'
65 'methods': []
69 self.assertEquals(expected, actual)
71 def testMethodAnnotation(self):
72 actual = proguard.Parse(
73 ['- Program class: org/example/Test',
74 'Methods (count = 1):',
75 '- Method: Test()V',
76 ' - Annotation [Lorg/example/Annotation;]:',
77 ' - Annotation [Lorg/example/AnnotationWithValue;]:',
78 ' - Constant element value [attr \'13\']',
79 ' - Utf8 [val]'])
80 expected = {
81 'classes': [
83 'class': 'org.example.Test',
84 'superclass': '',
85 'annotations': {},
86 'methods': [
88 'method': 'Test',
89 'annotations': {
90 'Annotation': None,
91 'AnnotationWithValue': 'val'
98 self.assertEquals(expected, actual)