Disable zero-finger click and add box filter on by default.

Also, remove an outdated test from Cr-48 that is no longer
applicable. For the Tap To Click state machine test, it doesn't call
into the rest of immediate interpreter to know if the user is
physically clicking the button when zero-finger taps are
disabled. This is a failure in the test, not the production code, and
it's not trivial to fix. To remedy the test, I enable zero-finger
clicks for that test.

BUG=b:176752176
TEST=touchtests shows no serious regressions

Change-Id: I6b7fa523fa9f0c1e666f67b5ec90b08fe96f791f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/gestures/+/2610170
Tested-by: Andrew de los Reyes <adlr@chromium.org>
Reviewed-by: Sean O'Brien <seobrien@chromium.org>
Commit-Queue: Andrew de los Reyes <adlr@chromium.org>
diff --git a/src/box_filter_interpreter.cc b/src/box_filter_interpreter.cc
index 8f91376..155ca55 100644
--- a/src/box_filter_interpreter.cc
+++ b/src/box_filter_interpreter.cc
@@ -14,8 +14,8 @@
                                            Interpreter* next,
                                            Tracer* tracer)
     : FilterInterpreter(NULL, next, tracer, false),
-      box_width_(prop_reg, "Box Width", 0.0),
-      box_height_(prop_reg, "Box Height", 0.0) {
+      box_width_(prop_reg, "Box Width", 1.0),
+      box_height_(prop_reg, "Box Height", 1.0) {
   InitName();
 }
 
diff --git a/src/immediate_interpreter.cc b/src/immediate_interpreter.cc
index 959f605..817cb32 100644
--- a/src/immediate_interpreter.cc
+++ b/src/immediate_interpreter.cc
@@ -1018,7 +1018,7 @@
       tap_max_movement_(prop_reg, "Tap Maximum Movement", 0.0001),
       tap_max_finger_age_(prop_reg, "Tap Maximum Finger Age", 1.2),
       three_finger_click_enable_(prop_reg, "Three Finger Click Enable", 1),
-      zero_finger_click_enable_(prop_reg, "Zero Finger Click Enable", 1),
+      zero_finger_click_enable_(prop_reg, "Zero Finger Click Enable", 0),
       t5r2_three_finger_click_enable_(prop_reg,
                                       "T5R2 Three Finger Click Enable",
                                       0),
diff --git a/src/immediate_interpreter_unittest.cc b/src/immediate_interpreter_unittest.cc
index d687b33..12086c8 100644
--- a/src/immediate_interpreter_unittest.cc
+++ b/src/immediate_interpreter_unittest.cc
@@ -2102,6 +2102,7 @@
       ii->tap_timeout_.val_ = ii->inter_tap_timeout_.val_ = 0.05;
       ii->three_finger_click_enable_.val_ = 1;
       ii->t5r2_three_finger_click_enable_.val_ = 1;
+      ii->zero_finger_click_enable_.val_ = 1;
       // For the slow tap case, we need to make tap_timeout_ bigger
       if (hwsgs_full[i].line_number_and_flags & HWStateFlagStartDoubleTap)
         ii->tap_timeout_.val_ = 0.11;
@@ -3515,68 +3516,4 @@
   }
 }
 
-TEST(ImmediateInterpreterTest, BasicButtonTest) {
-  ImmediateInterpreter ii(NULL, NULL);
-
-  HardwareProperties hwprops = {
-    0,  // left edge
-    0,  // top edge
-    96.085106,  // right edge
-    57.492310,  // bottom edge
-    1,  // pixels/TP width
-    1,  // pixels/TP height
-    25.4,  // screen DPI x
-    25.4,  // screen DPI y
-    -1,  // orientation minimum
-    2,   // orientation maximum
-    2,  // max fingers
-    3,  // max touch
-    0,  // t5r2
-    1,  // semi-mt
-    1,  // is button pad
-    0,  // has_wheel
-    0,  // wheel_is_hi_res
-  };
-
-  HardwareState hardware_states[] = {
-    // time, buttons down, finger count, touch count, finger states pointer
-    make_hwstate(0.1, 0, 0, 0, NULL),
-    make_hwstate(0.3, GESTURES_BUTTON_LEFT, 0, 0, NULL),   // delay left
-    // button down
-    make_hwstate(0.5, GESTURES_BUTTON_LEFT, 0, 0, NULL),
-    make_hwstate(0.9, 0, 0, 0, NULL),                      // left up
-    make_hwstate(1.1, GESTURES_BUTTON_RIGHT, 0, 0, NULL),  // delay right
-    // button down
-    make_hwstate(1.3, GESTURES_BUTTON_RIGHT, 0, 0, NULL),
-    make_hwstate(1.5, 0, 0, 0, NULL),                      // right up
-    make_hwstate(1.6, GESTURES_BUTTON_LEFT, 0, 0, NULL),   // left down
-    make_hwstate(1.7, 0, 0, 0, NULL),  // short left button up (<.3s)
-  };
-
-  TestInterpreterWrapper wrapper(&ii, &hwprops);
-
-  for (size_t idx = 0; idx < arraysize(hardware_states); ++idx) {
-    Gesture* gs = wrapper.SyncInterpret(&hardware_states[idx], NULL);
-    if (idx < 2 || idx == 4 || idx == 7) {
-      EXPECT_EQ(NULL, gs);
-    } else {
-      EXPECT_TRUE(gs != NULL);
-      if (gs == NULL)  /* Avoid SEGV on test failure */
-        continue;
-      EXPECT_EQ(kGestureTypeButtonsChange, gs->type);
-      if (idx == 2)
-        EXPECT_EQ(GESTURES_BUTTON_LEFT, gs->details.buttons.down);
-      else if (idx == 3)
-        EXPECT_EQ(GESTURES_BUTTON_LEFT, gs->details.buttons.up);
-      else if (idx == 5)
-        EXPECT_EQ(GESTURES_BUTTON_RIGHT, gs->details.buttons.down);
-      else if (idx == 6)
-        EXPECT_EQ(GESTURES_BUTTON_RIGHT, gs->details.buttons.up);
-      else if (idx == 8) {
-        EXPECT_EQ(GESTURES_BUTTON_LEFT, gs->details.buttons.up);
-        EXPECT_EQ(GESTURES_BUTTON_LEFT, gs->details.buttons.down);
-      }
-    }
-  }
-}
 }  // namespace gestures