summaryrefslogtreecommitdiff
path: root/tests/src/com/android/loganalysis/parser/EventsLogParserTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/com/android/loganalysis/parser/EventsLogParserTest.java')
-rw-r--r--tests/src/com/android/loganalysis/parser/EventsLogParserTest.java109
1 files changed, 32 insertions, 77 deletions
diff --git a/tests/src/com/android/loganalysis/parser/EventsLogParserTest.java b/tests/src/com/android/loganalysis/parser/EventsLogParserTest.java
index a3dc283..b568e57 100644
--- a/tests/src/com/android/loganalysis/parser/EventsLogParserTest.java
+++ b/tests/src/com/android/loganalysis/parser/EventsLogParserTest.java
@@ -73,45 +73,23 @@ public class EventsLogParserTest extends TestCase {
/**
* Test for Cold launch transition delay info
*/
- public void testColdLaunchTransitionDelay() throws IOException {
+ public void testValidTransitionDelay() throws IOException {
List<String> lines = Arrays
- .asList("08-25 13:01:19.412 1152 9031 I am_restart_activity: [0,85290699,38,com.google.android.gm/.ConversationListActivityGmail]",
- "08-25 13:01:19.437 1152 1226 I sysui_action: [321,85]",
- "08-25 13:01:19.437 1152 1226 I sysui_action: [320,1]",
- "08-25 13:01:19.437 1152 1226 I sysui_action: [319,85]");
+ .asList("01-02 08:12:10.849 934 986 I sysui_multi_action: [319,42,321,59,322,208,325,84100,757,761,758,9,759,4,806,com.google.android.apps.maps,871,com.google.android.maps.MapsActivity,905,0]",
+ "01-02 08:12:16.895 1446 1446 I sysui_multi_action: [757,803,799,overview_trigger_nav_btn,802,1]",
+ "01-02 08:12:16.895 1446 1446 I sysui_multi_action: [757,803,799,overview_source_app,802,1]",
+ "01-02 08:12:16.895 1446 1446 I sysui_multi_action: [757,804,799,overview_source_app_index,801,8,802,1]");
List<TransitionDelayItem> transitionItems = (new EventsLogParser()).
parseTransitionDelayInfo(readInputBuffer(getTempFile(lines)));
assertEquals("Transition Delay items list should have one item", 1,
transitionItems.size());
assertEquals("Component name not parsed correctly",
- "com.google.android.gm/.ConversationListActivityGmail",
+ "com.google.android.apps.maps/com.google.android.maps.MapsActivity",
transitionItems.get(0).getComponentName());
- assertEquals("Cold launch info is not set correctly", 85,
- transitionItems.get(0).getStartingWindowDelay());
- assertEquals("Hot launch info is set which is not expected", -1,
+ assertEquals("Transition delay is not parsed correctly", 42,
transitionItems.get(0).getTransitionDelay());
- }
-
- /**
- * Test for Hot launch transition delay
- */
- public void testHotLaunchTransitionDelay() throws IOException {
- List<String> lines = Arrays
- .asList("08-25 13:02:04.740 1152 2715 I am_resume_activity: [0,85290699,38,com.google.android.gm/.ConversationListActivityGmail]",
- "08-25 13:02:04.754 1152 1180 I sysui_count: [window_time_0,23]",
- "08-25 13:02:04.755 1152 1226 I sysui_action: [320,0]",
- "08-25 13:02:04.755 1152 1226 I sysui_action: [319,37]");
- List<TransitionDelayItem> transitionItems = (new EventsLogParser()).
- parseTransitionDelayInfo(readInputBuffer(getTempFile(lines)));
- assertEquals("Transition Delay items list shopuld have one item", 1,
- transitionItems.size());
- assertEquals("Component name not parsed correctly",
- "com.google.android.gm/.ConversationListActivityGmail",
- transitionItems.get(0).getComponentName());
- assertEquals("Cold launch info is set which is not expected", -1,
+ assertEquals("Starting window delay is not parsed correctly", 59,
transitionItems.get(0).getStartingWindowDelay());
- assertEquals("Hot launch info is not set correctly", 37,
- transitionItems.get(0).getTransitionDelay());
}
/**
@@ -119,26 +97,19 @@ public class EventsLogParserTest extends TestCase {
*/
public void testTransitionDelayOrder() throws IOException {
List<String> lines = Arrays
- .asList("08-25 13:01:19.412 1152 9031 I am_restart_activity: [0,85290699,38,com.google.android.gm/.ConversationListActivityGmail]",
- "08-25 13:01:19.437 1152 1226 I sysui_action: [321,85]",
- "08-25 13:01:19.437 1152 1226 I sysui_action: [320,1]",
- "08-25 13:01:19.437 1152 1226 I sysui_action: [319,85]",
- "08-25 12:56:15.850 1152 8968 I am_focused_stack: [0,0,1,appDied setFocusedActivity]",
- "08-25 12:56:15.850 1152 8968 I wm_task_moved: [6,1,1]",
- "08-25 12:56:15.852 1152 8968 I am_focused_activity: [0,com.google.android.apps.nexuslauncher/.NexusLauncherActivity,appDied]",
- "08-25 12:56:15.852 1152 8968 I wm_task_removed: [27,removeTask]",
- "08-25 12:56:15.852 1152 8968 I wm_stack_removed: 1",
- "08-25 13:02:04.740 1152 2715 I am_resume_activity: [0,85290699,38,com.google.android.gm/.ConversationListActivityGmail]",
- "08-25 13:02:04.754 1152 1180 I sysui_count: [window_time_0,23]",
- "08-25 13:02:04.755 1152 1226 I sysui_action: [320,0]",
- "08-25 13:02:04.755 1152 1226 I sysui_action: [319,37]");
+ .asList("01-02 08:12:10.849 934 986 I sysui_multi_action: [319,42,321,59,322,208,325,84100,757,761,758,9,759,4,806,com.google.android.apps.maps,871,com.google.android.maps.MapsActivity,905,0]",
+ "01-02 08:12:16.895 1446 1446 I sysui_multi_action: [757,803,799,overview_trigger_nav_btn,802,1]",
+ "01-02 08:12:16.895 1446 1446 I sysui_multi_action: [757,803,799,overview_source_app,802,1]",
+ "01-02 08:12:16.895 1446 1446 I sysui_multi_action: [757,804,799,overview_source_app_index,801,8,802,1]",
+ "01-02 08:12:42.187 934 986 I sysui_multi_action: [319,61,321,46,322,159,325,84131,757,761,758,9,759,4,806,com.google.android.apps.maps,871,com.google.android.maps.MapsActivity,905,0]",
+ "01-02 08:12:42.450 1446 1446 I sysui_multi_action: [757,224,758,2]");
List<TransitionDelayItem> transitionItems = (new EventsLogParser()).
parseTransitionDelayInfo(readInputBuffer(getTempFile(lines)));
assertEquals("Transition Delay items list should have two items", 2,
transitionItems.size());
- assertEquals("Cold launch transition delay is not the first item", 85,
- transitionItems.get(0).getStartingWindowDelay());
- assertEquals("Hot launch transition delay is not the second item", 37,
+ assertEquals("Transition delay for the first item is not set correct", 42,
+ transitionItems.get(0).getTransitionDelay());
+ assertEquals("Transition delay for the second item is not set correct", 61,
transitionItems.get(1).getTransitionDelay());
}
@@ -147,27 +118,18 @@ public class EventsLogParserTest extends TestCase {
*/
public void testDifferentAppTransitionDelay() throws IOException {
List<String> lines = Arrays
- .asList("08-25 13:01:19.412 1152 9031 I am_restart_activity: [0,85290699,38,com.google.android.gm/.ConversationListActivityGmail]",
- "08-25 13:01:19.437 1152 1226 I sysui_action: [321,85]",
- "08-25 13:01:19.437 1152 1226 I sysui_action: [320,1]",
- "08-25 13:01:19.437 1152 1226 I sysui_action: [319,85]",
- "08-25 12:56:15.850 1152 8968 I am_focused_stack: [0,0,1,appDied setFocusedActivity]",
- "08-25 12:56:15.850 1152 8968 I wm_task_moved: [6,1,1]",
- "08-25 12:56:15.852 1152 8968 I am_focused_activity: [0,com.google.android.apps.nexuslauncher/.NexusLauncherActivity,appDied]",
- "08-25 12:56:15.852 1152 8968 I wm_task_removed: [27,removeTask]",
- "08-25 12:56:15.852 1152 8968 I wm_stack_removed: 1",
- "08-25 13:03:35.528 1152 2715 I am_restart_activity: [0,32358360,39,com.google.android.apps.maps/com.google.android.maps.MapsActivity]",
- "08-25 13:03:35.540 1152 1179 I am_pss : [7727,10032,com.google.android.apps.nexuslauncher,50991104,45486080,0]",
- "08-25 13:03:35.566 1152 1179 I am_pss : [9207,10045,com.google.android.googlequicksearchbox:search,111955968,102227968,0]",
- "08-25 13:03:35.569 1152 1226 I sysui_action: [321,92]",
- "08-25 13:03:35.569 1152 1226 I sysui_action: [320,1]",
- "08-25 13:03:35.569 1152 1226 I sysui_action: [319,92]");
+ .asList("01-02 08:11:58.691 934 986 I sysui_multi_action: [319,48,321,37,322,82,325,84088,757,761,758,9,759,4,806,com.google.android.calculator,871,com.android.calculator2.Calculator,905,0]",
+ "01-02 08:12:03.639 934 970 I sysui_multi_action: [757,803,799,window_time_0,802,5]",
+ "01-02 08:12:10.849 934 986 I sysui_multi_action: [319,42,321,59,322,208,325,84100,757,761,758,9,759,4,806,com.google.android.apps.maps,871,com.google.android.maps.MapsActivity,905,0]",
+ "01-02 08:12:16.895 1446 1446 I sysui_multi_action: [757,803,799,overview_trigger_nav_btn,802,1]",
+ "01-02 08:12:16.895 1446 1446 I sysui_multi_action: [757,803,799,overview_source_app,802,1]",
+ "01-02 08:12:16.895 1446 1446 I sysui_multi_action: [757,804,799,overview_source_app_index,801,8,802,1]");
List<TransitionDelayItem> transitionItems = (new EventsLogParser()).
parseTransitionDelayInfo(readInputBuffer(getTempFile(lines)));
assertEquals("Transition Delay items list should have two items", 2,
transitionItems.size());
- assertEquals("Gmail is not the first transition delay item",
- "com.google.android.gm/.ConversationListActivityGmail",
+ assertEquals("Calculator is not the first transition delay item",
+ "com.google.android.calculator/com.android.calculator2.Calculator",
transitionItems.get(0).getComponentName());
assertEquals("Maps is not the second transition delay item",
"com.google.android.apps.maps/com.google.android.maps.MapsActivity",
@@ -175,23 +137,16 @@ public class EventsLogParserTest extends TestCase {
}
/**
- * Test for invalid transition delay items pattern
+ * Test for invalid transition delay items pattern having different code.
*/
public void testInvalidTransitionPattern() throws IOException {
List<String> lines = Arrays
- .asList("08-25 13:01:19.412 1152 9031 I am_restart_activity: [com.google.android.gm/.ConversationListActivityGmail,0,85290699,38]",
- "08-25 13:01:19.437 1152 1226 I sysui_action: [321,85]",
- "08-25 13:01:19.437 1152 1226 I sysui_action: [320,1]",
- "08-25 13:01:19.437 1152 1226 I sysui_action: [319,85]",
- "08-25 12:56:15.850 1152 8968 I am_focused_stack: [0,0,1,appDied setFocusedActivity]",
- "08-25 12:56:15.850 1152 8968 I wm_task_moved: [6,1,1]",
- "08-25 12:56:15.852 1152 8968 I am_focused_activity: [0,com.google.android.apps.nexuslauncher/.NexusLauncherActivity,appDied]",
- "08-25 12:56:15.852 1152 8968 I wm_task_removed: [27,removeTask]",
- "08-25 12:56:15.852 1152 8968 I wm_stack_removed: 1",
- "08-25 13:02:04.740 1152 2715 I am_res_activity: [0,85290699,38,com.google.android.gm/.ConversationListActivityGmail]",
- "08-25 13:02:04.754 1152 1180 I sysui_count: [window_time_0,23]",
- "08-25 13:02:04.755 1152 1226 I sysui_action: [320,0]",
- "08-25 13:02:04.755 1152 1226 I sysui_action: [319,37]");
+ .asList("01-02 08:11:58.691 934 986 I sysui_multi_action: [319,48,328,37,322,82,325,84088,757,761,758,9,759,4,806,com.google.android.calculator,871,com.android.calculator2.Calculator,905,0]",
+ "01-02 08:12:03.639 934 970 I sysui_multi_action: [757,803,799,window_time_0,802,5]",
+ "01-02 08:12:10.849 934 986 I sysui_multi_action: 319,42,321,59,322,208,325,84100,757,761,758,9,759,4,806,com.google.android.apps.maps,871,com.google.android.maps.MapsActivity,905,0]",
+ "01-02 08:12:16.895 1446 1446 I sysui_multi_action: [757,803,799,overview_trigger_nav_btn,802,1]",
+ "01-02 08:12:16.895 1446 1446 I sysui_multi_action: [757,803,799,overview_source_app,802,1]",
+ "01-02 08:12:16.895 1446 1446 I sysui_multi_action: [757,804,799,overview_source_app_index,801,8,802,1]");
List<TransitionDelayItem> transitionItems = (new EventsLogParser()).
parseTransitionDelayInfo(readInputBuffer(getTempFile(lines)));
assertEquals("Transition Delay items list should be empty", 0,