chromium/ui/events/ozone/evdev/touch_filter/palm_detection_filter_factory_unittest.cc

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ui/events/ozone/evdev/touch_filter/palm_detection_filter_factory.h"

#include <linux/input.h>

#include "base/command_line.h"
#include "base/test/gtest_util.h"
#include "base/test/scoped_chromeos_version_info.h"
#include "base/test/scoped_feature_list.h"
#include "build/chromeos_buildflags.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/events/ozone/evdev/event_device_info.h"
#include "ui/events/ozone/evdev/event_device_test_util.h"
#include "ui/events/ozone/evdev/touch_filter/heuristic_stylus_palm_detection_filter.h"
#include "ui/events/ozone/evdev/touch_filter/neural_stylus_palm_detection_filter.h"
#include "ui/events/ozone/evdev/touch_filter/open_palm_detection_filter.h"
#include "ui/events/ozone/evdev/touch_filter/palm_detection_filter.h"
#include "ui/events/ozone/evdev/touch_filter/shared_palm_detection_filter_state.h"
#include "ui/events/ozone/features.h"

namespace ui {

class PalmDetectionFilterFactoryTest : public testing::Test {};

class PalmDetectionFilterFactoryDeathTest
    : public PalmDetectionFilterFactoryTest {};

#if BUILDFLAG(IS_CHROMEOS_ASH)
TEST_F(PalmDetectionFilterFactoryTest, RadiusesFromLSBRelease) {
  {
    base::test::ScopedChromeOSVersionInfo version(
        "CHROMEOS_RELEASE_BOARD=hatch\n", base::Time());
    EXPECT_EQ("0.1010944, 3.51837568",
              internal::FetchNeuralPalmRadiusPolynomial(
                  kohaku_touchscreen_info_, ""));
  }
  {
    base::test::ScopedChromeOSVersionInfo version(
        "CHROMEOS_RELEASE_BOARD=reef\n", base::Time());
    EXPECT_EQ("0.17889799, 4.22584412",
              internal::FetchNeuralPalmRadiusPolynomial(
                  kohaku_touchscreen_info_, ""));
  }
  {
    base::test::ScopedChromeOSVersionInfo version(
        "CHROMEOS_RELEASE_BOARD=octopus\n", base::Time());
    EXPECT_EQ("", internal::FetchNeuralPalmRadiusPolynomial(
                      kohaku_touchscreen_info_, ""));
  }
}
#endif

TEST_F(PalmDetectionFilterFactoryTest, RadiusFromSwitch) {}

TEST_F(PalmDetectionFilterFactoryTest, AllDisabled) {}

TEST_F(PalmDetectionFilterFactoryTest, HeuristicEnabledForEve) {}

TEST_F(PalmDetectionFilterFactoryTest, HeuristicTimesSet) {}

TEST_F(PalmDetectionFilterFactoryTest, NeuralBeatsHeuristic) {}

TEST_F(PalmDetectionFilterFactoryTest, ParseTest) {}

TEST_F(PalmDetectionFilterFactoryDeathTest, BadParseRecovery) {}

TEST_F(PalmDetectionFilterFactoryDeathTest, BadNeuralParamParse) {}

}  // namespace ui