• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2015 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.android.loganalysis.parser;
17 
18 import com.android.loganalysis.item.DumpsysProcStatsItem;
19 
20 import junit.framework.TestCase;
21 
22 import java.util.Arrays;
23 import java.util.List;
24 
25 /**
26  * Unit tests for {@link DumpsysProcStatsParser}
27  */
28 public class DumpsysProcStatsParserTest extends TestCase {
29 
30     /**
31      * Test that normal input is parsed.
32      */
testDumpsysProcStatsParser()33     public void testDumpsysProcStatsParser() {
34         List<String> inputBlock = Arrays.asList(
35                 "COMMITTED STATS FROM 2015-03-20-02-01-02 (checked in):",
36                 "  * com.android.systemui / u0a22 / v22:",
37                 "           TOTAL: 100% (159MB-160MB-161MB/153MB-153MB-154MB over 13)",
38                 "      Persistent: 100% (159MB-160MB-161MB/153MB-153MB-154MB over 13)",
39                 "  * com.google.process.gapps / u0a9 / v22:",
40                 "           TOTAL: 100% (22MB-24MB-25MB/18MB-19MB-20MB over 13)",
41                 "          Imp Fg: 100% (22MB-24MB-25MB/18MB-19MB-20MB over 13)");
42 
43         DumpsysProcStatsItem procstats = new DumpsysProcStatsParser().parse(inputBlock);
44         assertEquals("com.android.systemui", procstats.get("u0a22"));
45         assertEquals("com.google.process.gapps", procstats.get("u0a9"));
46     }
47 }
48 
49