summaryrefslogtreecommitdiffstats
path: root/ui/chromeos
diff options
context:
space:
mode:
authorgab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-17 17:53:44 +0000
committergab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-17 17:53:44 +0000
commit4f1ded83dfdbeaf2748d82addf647442fcbb3d3c (patch)
tree8d13e30c9e21a6fc0ed0d69a2d5371b88b91b4e4 /ui/chromeos
parentc8f29c25e718ca60f4ff4837d99a0f75ac8977de (diff)
downloadchromium_src-4f1ded83dfdbeaf2748d82addf647442fcbb3d3c.zip
chromium_src-4f1ded83dfdbeaf2748d82addf647442fcbb3d3c.tar.gz
chromium_src-4f1ded83dfdbeaf2748d82addf647442fcbb3d3c.tar.bz2
Revert of Added wrapper test class for touch_exploration_controller. (https://codereview.chromium.org/386043002/)
Reason for revert: Causes LSAN errors on CrOS: http://build.chromium.org/p/chromium.memory/builders/Linux%20Chromium%20OS%20ASan%20LSan%20Tests%20%283%29/builds/2299/steps/ui_unittests/logs/DoubleTap e.g. Indirect leak of 2904 byte(s) in 1 object(s) allocated from: #0 0x44edfb in operator new(unsigned long) /usr/local/google/work/chromium/src/third_party/llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:55 #1 0x9fbc47 in CreateStrategy ui/events/gesture_detection/velocity_tracker.cc:201 #2 0x9fbc47 in ui::VelocityTracker::VelocityTracker(ui::VelocityTracker::Strategy) ui/events/gesture_detection/velocity_tracker.cc:234 #3 0x9fa322 in ui::VelocityTrackerState::VelocityTrackerState() ui/events/gesture_detection/velocity_tracker_state.cc:18 #4 0x9f5d64 in ui::GestureDetector::GestureDetector(ui::GestureDetector::Config const&, ui::GestureDetector::GestureListener*, ui::GestureDetector::DoubleTapListener*) ui/events/gesture_detection/gesture_detector.cc:191 #5 0x1431ddf in GestureListenerImpl ui/events/gesture_detection/gesture_provider.cc:296 #6 0x1431ddf in ui::GestureProvider::InitGestureDetectors(ui::GestureProvider::Config const&) ui/events/gesture_detection/gesture_provider.cc:629 #7 0x142ebdd in ui::FilteredGestureProvider::FilteredGestureProvider(ui::GestureProvider::Config const&, ui::GestureProviderClient*) ui/events/gesture_detection/filtered_gesture_provider.cc:19 #8 0x1410cd3 in ui::GestureProviderAura::GestureProviderAura(ui::GestureProviderAuraClient*) ui/events/gestures/gesture_provider_aura.cc:19 #9 0x9e9bcd in ui::TouchExplorationController::TouchExplorationController(aura::Window*) ui/chromeos/touch_exploration_controller.cc:33 #10 0x663c47 in ui::TouchExplorationTest::SwitchTouchExplorationMode(bool) ui/chromeos/touch_exploration_controller_unittest.cc:214 #11 0x674532 in ui::TouchExplorationTest_DoubleTap_Test::TestBody() ui/chromeos/touch_exploration_controller_unittest.cc:563 #12 0x7babc8 in HandleExceptionsInMethodIfSupported\u003Ctesting::Test, void> testing/gtest/src/gtest.cc:2045 #13 0x7babc8 in testing::Test::Run() testing/gtest/src/gtest.cc:2061 #14 0x7bcd08 in testing::TestInfo::Run() testing/gtest/src/gtest.cc:2237 #15 0x7bda46 in testing::TestCase::Run() testing/gtest/src/gtest.cc:2344 #16 0x7d072a in testing::internal::UnitTestImpl::RunAllTests() testing/gtest/src/gtest.cc:4065 #17 0x7cfd70 in HandleExceptionsInMethodIfSupported\u003Ctesting::internal::UnitTestImpl, bool> testing/gtest/src/gtest.cc:2045 #18 0x7cfd70 in testing::UnitTest::Run() testing/gtest/src/gtest.cc:3697 #19 0x7770b4 in RUN_ALL_TESTS testing/gtest/include/gtest/gtest.h:2231 #20 0x7770b4 in base::TestSuite::Run() base/test/test_suite.cc:227 #21 0x76e0c1 in Run base/callback.h:401 #22 0x76e0c1 in base::(anonymous namespace)::LaunchUnitTestsInternal(base::Callback\u003Cint ()> const&, int, bool, base::Callback\u003Cvoid ()> const&) base/test/launcher/unit_test_launcher.cc:498 #23 0x76da5c in base::LaunchUnitTests(int, char**, base::Callback\u003Cint ()> const&) base/test/launcher/unit_test_launcher.cc:553 #24 0x59cfaa in main ui/base/test/run_all_unittests.cc:105 #25 0x7fd0195b276c in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226 Original issue's description: > Added wrapper test class for touch_exploration_controller. > Wrapper class is currently located in the unittest file and is a friend of touch_exploration_controller. > > BUG=377040 > > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=283741 TBR=aboxhall@chromium.org,dmazzoni@chromium.org,evy@chromium.org NOTREECHECKS=true NOTRY=true BUG=377040 Review URL: https://codereview.chromium.org/404473006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283811 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/chromeos')
-rw-r--r--ui/chromeos/touch_exploration_controller.cc31
-rw-r--r--ui/chromeos/touch_exploration_controller.h11
-rw-r--r--ui/chromeos/touch_exploration_controller_unittest.cc55
3 files changed, 43 insertions, 54 deletions
diff --git a/ui/chromeos/touch_exploration_controller.cc b/ui/chromeos/touch_exploration_controller.cc
index 1a3b8fa..287e59f 100644
--- a/ui/chromeos/touch_exploration_controller.cc
+++ b/ui/chromeos/touch_exploration_controller.cc
@@ -35,10 +35,41 @@ TouchExplorationController::TouchExplorationController(
root_window->GetHost()->GetEventSource()->AddEventRewriter(this);
}
+
TouchExplorationController::~TouchExplorationController() {
root_window_->GetHost()->GetEventSource()->RemoveEventRewriter(this);
}
+void TouchExplorationController::CallTapTimerNowForTesting() {
+ DCHECK(tap_timer_.IsRunning());
+ tap_timer_.Stop();
+ OnTapTimerFired();
+}
+
+void TouchExplorationController::CallTapTimerNowIfRunningForTesting() {
+ if (tap_timer_.IsRunning()) {
+ tap_timer_.Stop();
+ OnTapTimerFired();
+ }
+}
+
+void TouchExplorationController::SetEventHandlerForTesting(
+ ui::EventHandler* event_handler_for_testing) {
+ event_handler_for_testing_ = event_handler_for_testing;
+}
+
+bool TouchExplorationController::IsInNoFingersDownStateForTesting() const {
+ return state_ == NO_FINGERS_DOWN;
+}
+
+bool TouchExplorationController::IsInGestureInProgressStateForTesting() const {
+ return state_ == GESTURE_IN_PROGRESS;
+}
+
+void TouchExplorationController::SuppressVLOGsForTesting(bool suppress) {
+ VLOG_on_ = !suppress;
+}
+
ui::EventRewriteStatus TouchExplorationController::RewriteEvent(
const ui::Event& event,
scoped_ptr<ui::Event>* rewritten_event) {
diff --git a/ui/chromeos/touch_exploration_controller.h b/ui/chromeos/touch_exploration_controller.h
index 17731ff..e809bcd 100644
--- a/ui/chromeos/touch_exploration_controller.h
+++ b/ui/chromeos/touch_exploration_controller.h
@@ -103,9 +103,16 @@ class UI_CHROMEOS_EXPORT TouchExplorationController
explicit TouchExplorationController(aura::Window* root_window);
virtual ~TouchExplorationController();
- private:
- friend class TouchExplorationControllerTestApi;
+ void CallTapTimerNowForTesting();
+ void CallTapTimerNowIfRunningForTesting();
+ void SetEventHandlerForTesting(ui::EventHandler* event_handler_for_testing);
+ bool IsInNoFingersDownStateForTesting() const;
+ bool IsInGestureInProgressStateForTesting() const;
+ // VLOGs should be suppressed in tests that generate a lot of logs,
+ // for example permutations of nine touch events.
+ void SuppressVLOGsForTesting(bool suppress);
+ private:
// Overridden from ui::EventRewriter
virtual ui::EventRewriteStatus RewriteEvent(
const ui::Event& event,
diff --git a/ui/chromeos/touch_exploration_controller_unittest.cc b/ui/chromeos/touch_exploration_controller_unittest.cc
index a19a39b..6b1f3de 100644
--- a/ui/chromeos/touch_exploration_controller_unittest.cc
+++ b/ui/chromeos/touch_exploration_controller_unittest.cc
@@ -22,7 +22,6 @@
namespace ui {
namespace {
-
// Records all mouse, touch, gesture, and key events.
class EventCapturer : public ui::EventHandler {
public:
@@ -74,53 +73,6 @@ int Factorial(int n) {
} // namespace
-class TouchExplorationControllerTestApi {
- public:
- TouchExplorationControllerTestApi(
- TouchExplorationController* touch_exploration_controller)
- : touch_exploration_controller_(touch_exploration_controller) {}
-
- void CallTapTimerNowForTesting() {
- DCHECK(touch_exploration_controller_->tap_timer_.IsRunning());
- touch_exploration_controller_->tap_timer_.Stop();
- touch_exploration_controller_->OnTapTimerFired();
- }
-
- void CallTapTimerNowIfRunningForTesting() {
- if (touch_exploration_controller_->tap_timer_.IsRunning()) {
- touch_exploration_controller_->tap_timer_.Stop();
- touch_exploration_controller_->OnTapTimerFired();
- }
- }
-
- void SetEventHandlerForTesting(
- ui::EventHandler* event_handler_for_testing) {
- touch_exploration_controller_->event_handler_for_testing_ =
- event_handler_for_testing;
- }
-
- bool IsInNoFingersDownStateForTesting() const {
- return touch_exploration_controller_->state_ ==
- touch_exploration_controller_->NO_FINGERS_DOWN;
- }
-
- bool IsInGestureInProgressStateForTesting() const {
- return touch_exploration_controller_->state_ ==
- touch_exploration_controller_->GESTURE_IN_PROGRESS;
- }
-
- // VLOGs should be suppressed in tests that generate a lot of logs,
- // for example permutations of nine touch events.
- void SuppressVLOGsForTesting(bool suppress) {
- touch_exploration_controller_->VLOG_on_ = !suppress;
- }
-
- private:
- TouchExplorationController* touch_exploration_controller_;
-
- DISALLOW_COPY_AND_ASSIGN(TouchExplorationControllerTestApi);
-};
-
class TouchExplorationTest : public aura::test::AuraTestBase {
public:
TouchExplorationTest() : simulated_clock_(new base::SimpleTestTickClock()) {
@@ -211,8 +163,8 @@ class TouchExplorationTest : public aura::test::AuraTestBase {
if (!on && touch_exploration_controller_.get()) {
touch_exploration_controller_.reset();
} else if (on && !touch_exploration_controller_.get()) {
- touch_exploration_controller_.reset(new TouchExplorationControllerTestApi(
- new ui::TouchExplorationController(root_window())));
+ touch_exploration_controller_.reset(
+ new ui::TouchExplorationController(root_window()));
touch_exploration_controller_->SetEventHandlerForTesting(
&event_capturer_);
cursor_client()->ShowCursor();
@@ -269,8 +221,7 @@ class TouchExplorationTest : public aura::test::AuraTestBase {
private:
EventCapturer event_capturer_;
- scoped_ptr<TouchExplorationControllerTestApi>
- touch_exploration_controller_;
+ scoped_ptr<ui::TouchExplorationController> touch_exploration_controller_;
scoped_ptr<aura::test::TestCursorClient> cursor_client_;
DISALLOW_COPY_AND_ASSIGN(TouchExplorationTest);