Index: content/browser/renderer_host/input/input_router_impl_unittest.cc |
diff --git a/content/browser/renderer_host/input/input_router_impl_unittest.cc b/content/browser/renderer_host/input/input_router_impl_unittest.cc |
index 0853e8ded1076736bf1cb19ca1b6f1258e1b6826..de00b479265e0b283cdd2dbce79dffdccd3256d8 100644 |
--- a/content/browser/renderer_host/input/input_router_impl_unittest.cc |
+++ b/content/browser/renderer_host/input/input_router_impl_unittest.cc |
@@ -145,11 +145,10 @@ |
ack_handler_.reset(new MockInputAckHandler()); |
CommandLine* command_line = CommandLine::ForCurrentProcess(); |
command_line->AppendSwitch(switches::kValidateInputEventStream); |
- input_router_.reset(new InputRouterImpl(process_.get(), |
- client_.get(), |
- ack_handler_.get(), |
- MSG_ROUTING_NONE, |
- config_)); |
+ input_router_.reset(new InputRouterImpl( |
+ process_.get(), client_.get(), ack_handler_.get(), MSG_ROUTING_NONE)); |
+ input_router_->gesture_event_queue_.set_debounce_enabled_for_testing( |
+ false); |
client_->set_input_router(input_router()); |
ack_handler_->set_input_router(input_router()); |
} |
@@ -162,14 +161,6 @@ |
client_.reset(); |
process_.reset(); |
browser_context_.reset(); |
- } |
- |
- void SetUpForTouchAckTimeoutTest(int timeout_ms) { |
- config_.touch_config.touch_ack_timeout_delay = |
- base::TimeDelta::FromMilliseconds(timeout_ms); |
- config_.touch_config.touch_ack_timeout_supported = true; |
- TearDown(); |
- SetUp(); |
} |
void SimulateKeyboardEvent(WebInputEvent::Type type, bool is_shortcut) { |
@@ -339,7 +330,6 @@ |
base::MessageLoop::current()->Run(); |
} |
- InputRouterImpl::Config config_; |
scoped_ptr<MockRenderProcessHost> process_; |
scoped_ptr<MockInputRouterClient> client_; |
scoped_ptr<MockInputAckHandler> ack_handler_; |
@@ -1021,11 +1011,17 @@ |
EXPECT_EQ(3U, ack_handler_->GetAndResetAckCount()); |
} |
-// Test that touch ack timeout behavior is properly toggled by view update flags |
-// and allowed touch actions. |
+// Test that touch ack timeout behavior is properly configured via the command |
+// line, and toggled by view update flags and allowed touch actions. |
TEST_F(InputRouterImplTest, TouchAckTimeoutConfigured) { |
- const int timeout_ms = 1; |
- SetUpForTouchAckTimeoutTest(timeout_ms); |
+ // Unless explicitly supported via the command-line, the touch timeout should |
+ // be disabled. |
+ EXPECT_FALSE(TouchEventTimeoutEnabled()); |
+ |
+ CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
+ switches::kTouchAckTimeoutDelayMs, "1"); |
+ TearDown(); |
+ SetUp(); |
ASSERT_TRUE(TouchEventTimeoutEnabled()); |
// Verify that the touch ack timeout fires upon the delayed ack. |
@@ -1033,7 +1029,7 @@ |
SendTouchEvent(); |
EXPECT_EQ(0U, ack_handler_->GetAndResetAckCount()); |
EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
- RunTasksAndWait(base::TimeDelta::FromMilliseconds(timeout_ms + 1)); |
+ RunTasksAndWait(base::TimeDelta::FromMilliseconds(2)); |
// The timed-out event should have been ack'ed. |
EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount()); |
@@ -1099,8 +1095,10 @@ |
// the touch timeout. |
TEST_F(InputRouterImplTest, |
TouchAckTimeoutDisabledForTouchSequenceAfterTouchActionNone) { |
- const int timeout_ms = 1; |
- SetUpForTouchAckTimeoutTest(timeout_ms); |
+ CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
+ switches::kTouchAckTimeoutDelayMs, "1"); |
+ TearDown(); |
+ SetUp(); |
ASSERT_TRUE(TouchEventTimeoutEnabled()); |
OnHasTouchEventHandlers(true); |
@@ -1130,7 +1128,7 @@ |
EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
// Delay the ack. The timeout should *not* fire. |
- RunTasksAndWait(base::TimeDelta::FromMilliseconds(timeout_ms + 1)); |
+ RunTasksAndWait(base::TimeDelta::FromMilliseconds(2)); |
EXPECT_EQ(0U, ack_handler_->GetAndResetAckCount()); |
EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); |
@@ -1156,7 +1154,7 @@ |
EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
// Wait for the touch ack timeout to fire. |
- RunTasksAndWait(base::TimeDelta::FromMilliseconds(timeout_ms + 1)); |
+ RunTasksAndWait(base::TimeDelta::FromMilliseconds(2)); |
EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount()); |
} |