summaryrefslogtreecommitdiff
path: root/src/activity_replay.cc
diff options
context:
space:
mode:
authorChung-yih Wang <cywang@chromium.org>2013-05-21 09:55:44 +0800
committerChromeBot <chrome-bot@google.com>2013-06-04 22:43:31 -0700
commit9130748c67baf3485c3cd1c1fd8225f434367ce4 (patch)
treefc6e96ed4f222f88a60eb58277a139c14bbecf5e /src/activity_replay.cc
parent65fe6e6856369c3017ea54db29584632f5d04370 (diff)
downloadlibchrome-gestures-9130748c67baf3485c3cd1c1fd8225f434367ce4.tar.gz
activity_replay: Make rel_ parsing optional for old logging data
BUG=none TEST=Given an old feedback url which does not have rel_x entries in its touchpad_activity_log.txt and create a test case with touchtests command touchtests platform/test_name -c feedback_url Find a gesture to shrink the log data, the utility will try to replay the gesture. With the patch, the test case should be created successfully. Change-Id: Iafd5af82bf2d93667e06817cbb04a481c83d9d12 Reviewed-on: https://gerrit.chromium.org/gerrit/56943 Reviewed-by: Tai-Hsu Lin <sheckylin@chromium.org> Tested-by: Chung-yih Wang <cywang@chromium.org> Commit-Queue: Chung-yih Wang <cywang@chromium.org>
Diffstat (limited to 'src/activity_replay.cc')
-rw-r--r--src/activity_replay.cc45
1 files changed, 23 insertions, 22 deletions
diff --git a/src/activity_replay.cc b/src/activity_replay.cc
index c863e0c..2ed8eda 100644
--- a/src/activity_replay.cc
+++ b/src/activity_replay.cc
@@ -193,7 +193,7 @@ bool ActivityReplay::ParseEntry(DictionaryValue* entry) {
}
bool ActivityReplay::ParseHardwareState(DictionaryValue* entry) {
- HardwareState hs;
+ HardwareState hs = HardwareState();
if (!entry->GetInteger(ActivityLog::kKeyHardwareStateButtonsDown,
&hs.buttons_down)) {
Err("Unable to parse hardware state buttons down");
@@ -236,28 +236,29 @@ bool ActivityReplay::ParseHardwareState(DictionaryValue* entry) {
double temp_double;
if (!entry->GetDouble(ActivityLog::kKeyHardwareStateRelX,
&temp_double)) {
- Err("Unable to parse hardware state rel_x");
- return false;
- }
- hs.rel_x = temp_double;
- if (!entry->GetDouble(ActivityLog::kKeyHardwareStateRelY,
- &temp_double)) {
- Err("Unable to parse hardware state rel_y");
- return false;
- }
- hs.rel_y = temp_double;
- if (!entry->GetDouble(ActivityLog::kKeyHardwareStateRelWheel,
- &temp_double)) {
- Err("Unable to parse hardware state rel_wheel");
- return false;
- }
- hs.rel_wheel = temp_double;
- if (!entry->GetDouble(ActivityLog::kKeyHardwareStateRelHWheel,
- &temp_double)) {
- Err("Unable to parse hardware state rel_hwheel");
- return false;
+ // There may not have rel_ entries for old logs
+ Log("Unable to parse hardware state rel_x");
+ } else {
+ hs.rel_x = temp_double;
+ if (!entry->GetDouble(ActivityLog::kKeyHardwareStateRelY,
+ &temp_double)) {
+ Err("Unable to parse hardware state rel_y");
+ return false;
+ }
+ hs.rel_y = temp_double;
+ if (!entry->GetDouble(ActivityLog::kKeyHardwareStateRelWheel,
+ &temp_double)) {
+ Err("Unable to parse hardware state rel_wheel");
+ return false;
+ }
+ hs.rel_wheel = temp_double;
+ if (!entry->GetDouble(ActivityLog::kKeyHardwareStateRelHWheel,
+ &temp_double)) {
+ Err("Unable to parse hardware state rel_hwheel");
+ return false;
+ }
+ hs.rel_hwheel = temp_double;
}
- hs.rel_hwheel = temp_double;
log_.LogHardwareState(hs);
return true;
}