summaryrefslogtreecommitdiffstats
path: root/content/browser/renderer_host/input/input_router_impl_unittest.cc
diff options
context:
space:
mode:
authorjdduke@chromium.org <jdduke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-10 05:28:45 +0000
committerjdduke@chromium.org <jdduke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-10 05:28:45 +0000
commit86ae95120d66f3366f1ee17dad5570b1074090c9 (patch)
tree0d99548c3949543134a308021d0b2498f7f3fd6d /content/browser/renderer_host/input/input_router_impl_unittest.cc
parent7cc0cca0c1f47e47a2c6422e00033cf7f80e676b (diff)
downloadchromium_src-86ae95120d66f3366f1ee17dad5570b1074090c9.zip
chromium_src-86ae95120d66f3366f1ee17dad5570b1074090c9.tar.gz
chromium_src-86ae95120d66f3366f1ee17dad5570b1074090c9.tar.bz2
Move TouchEvent timeout code to the TouchEventQueue
Android currently uses custom TouchEvent timeout logic on unresponsive desktop sites. The existence of this timeout has been a trouble spot, so move it to a common, visible location where it can be examined and used by other platforms. BUG=305273 Review URL: https://codereview.chromium.org/48973005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239670 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/renderer_host/input/input_router_impl_unittest.cc')
-rw-r--r--content/browser/renderer_host/input/input_router_impl_unittest.cc37
1 files changed, 33 insertions, 4 deletions
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 dd792a7..ba94e80 100644
--- a/content/browser/renderer_host/input/input_router_impl_unittest.cc
+++ b/content/browser/renderer_host/input/input_router_impl_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/basictypes.h"
+#include "base/command_line.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/utf_string_conversions.h"
#include "content/browser/renderer_host/input/gesture_event_filter.h"
@@ -16,6 +17,7 @@
#include "content/common/input/web_input_event_traits.h"
#include "content/common/input_messages.h"
#include "content/common/view_messages.h"
+#include "content/public/common/content_switches.h"
#include "content/public/test/mock_render_process_host.h"
#include "content/public/test/test_browser_context.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -260,14 +262,14 @@ class InputRouterImplTest : public testing::Test {
return input_router_.get();
}
- bool no_touch_to_renderer() {
- return input_router()->touch_event_queue_->no_touch_to_renderer();
- }
-
bool TouchEventQueueEmpty() const {
return input_router()->touch_event_queue_->empty();
}
+ bool TouchEventTimeoutEnabled() const {
+ return input_router()->touch_event_queue_->ack_timeout_enabled();
+ }
+
size_t GetSentMessageCountAndResetSink() {
size_t count = process_->sink().message_count();
process_->sink().ClearMessages();
@@ -850,4 +852,31 @@ TEST_F(InputRouterImplTest, GestureShowPressIsInOrder) {
EXPECT_EQ(3U, ack_handler_->GetAndResetAckCount());
}
+// Test that touch ack timeout behavior is properly configured via the command
+// line, and toggled by the view update flags.
+TEST_F(InputRouterImplTest, TouchAckTimeoutConfigured) {
+ CommandLine::ForCurrentProcess()->AppendSwitchASCII(
+ switches::kTouchAckTimeoutDelayMs, "5");
+ TearDown();
+ SetUp();
+ ASSERT_TRUE(TouchEventTimeoutEnabled());
+
+ // A fixed page scale or mobile viewport should disable the touch timeout.
+ input_router()->OnViewUpdated(InputRouter::FIXED_PAGE_SCALE);
+ EXPECT_FALSE(TouchEventTimeoutEnabled());
+
+ input_router()->OnViewUpdated(InputRouter::VIEW_FLAGS_NONE);
+ EXPECT_TRUE(TouchEventTimeoutEnabled());
+
+ input_router()->OnViewUpdated(InputRouter::MOBILE_VIEWPORT);
+ EXPECT_FALSE(TouchEventTimeoutEnabled());
+
+ input_router()->OnViewUpdated(InputRouter::MOBILE_VIEWPORT |
+ InputRouter::FIXED_PAGE_SCALE);
+ EXPECT_FALSE(TouchEventTimeoutEnabled());
+
+ input_router()->OnViewUpdated(InputRouter::VIEW_FLAGS_NONE);
+ EXPECT_TRUE(TouchEventTimeoutEnabled());
+}
+
} // namespace content