Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1657)

Unified Diff: Source/web/tests/WebUserGestureTokenTest.cpp

Issue 82693006: Adding handlers for user gesture callbacks. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed unit test bug Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/web/WebUserGestureIndicator.cpp ('k') | public/web/WebUserGestureIndicator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/tests/WebUserGestureTokenTest.cpp
diff --git a/Source/web/tests/WebUserGestureTokenTest.cpp b/Source/web/tests/WebUserGestureTokenTest.cpp
index 0c39c39f1130759e29d2a3a4772e4a35a831a178..67790e0242dbd0803d2d76828ca1745489f3f038 100644
--- a/Source/web/tests/WebUserGestureTokenTest.cpp
+++ b/Source/web/tests/WebUserGestureTokenTest.cpp
@@ -42,6 +42,19 @@ using namespace WebCore;
namespace {
+class GestureHandlerTest : public WebUserGestureHandler {
+public:
+ GestureHandlerTest()
+ : m_reached(false) { }
+
+ void onGesture()
+ {
+ m_reached = true;
+ }
+
+ bool m_reached;
+};
+
TEST(WebUserGestureTokenTest, Basic)
{
WebUserGestureToken token;
@@ -74,6 +87,14 @@ TEST(WebUserGestureTokenTest, Basic)
WebScopedUserGesture indicator(token);
EXPECT_FALSE(WebUserGestureIndicator::isProcessingUserGesture());
}
+
+ {
+ GestureHandlerTest handler;
+ WebUserGestureIndicator::setHandler(&handler);
+ UserGestureIndicator indicator(DefinitelyProcessingNewUserGesture);
+ EXPECT_TRUE(handler.m_reached);
+ WebUserGestureIndicator::setHandler(0);
+ }
}
}
« no previous file with comments | « Source/web/WebUserGestureIndicator.cpp ('k') | public/web/WebUserGestureIndicator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698