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

Side by Side Diff: third_party/WebKit/Source/platform/UserGestureIndicatorTest.cpp

Issue 2467993002: Document user gesture state should be able to propagate over postMessage (Closed)
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/UserGestureIndicator.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/UserGestureIndicator.h" 5 #include "platform/UserGestureIndicator.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
11 class TestUserGestureToken final : public UserGestureToken { 11 class TestUserGestureToken final : public UserGestureToken {
12 WTF_MAKE_NONCOPYABLE(TestUserGestureToken); 12 WTF_MAKE_NONCOPYABLE(TestUserGestureToken);
13 13
14 public: 14 public:
15 static PassRefPtr<UserGestureToken> create( 15 static PassRefPtr<UserGestureToken> create(
16 Status status = PossiblyExistingGesture) { 16 Status status = PossiblyExistingGesture) {
17 return adoptRef(new TestUserGestureToken(status)); 17 return adoptRef(new TestUserGestureToken(status));
18 } 18 }
19 19
20 ~TestUserGestureToken() final {}
21
22 private: 20 private:
23 TestUserGestureToken(Status status) : UserGestureToken(status) {} 21 TestUserGestureToken(Status status) : UserGestureToken(status) {}
24 }; 22 };
25 23
26 // Checks for the initial state of UserGestureIndicator. 24 // Checks for the initial state of UserGestureIndicator.
27 TEST(UserGestureIndicatorTest, InitialState) { 25 TEST(UserGestureIndicatorTest, InitialState) {
28 EXPECT_FALSE(UserGestureIndicator::utilizeUserGesture()); 26 EXPECT_FALSE(UserGestureIndicator::utilizeUserGesture());
29 EXPECT_EQ(nullptr, UserGestureIndicator::currentToken()); 27 EXPECT_EQ(nullptr, UserGestureIndicator::currentToken());
30 EXPECT_FALSE(UserGestureIndicator::consumeUserGesture()); 28 EXPECT_FALSE(UserGestureIndicator::consumeUserGesture());
31 } 29 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 } 167 }
170 168
171 // The callback isn't invoked outside the scope of the UGI 169 // The callback isn't invoked outside the scope of the UGI
172 EXPECT_FALSE(UserGestureIndicator::utilizeUserGesture()); 170 EXPECT_FALSE(UserGestureIndicator::utilizeUserGesture());
173 EXPECT_EQ(0u, cb.getAndResetUsedCount()); 171 EXPECT_EQ(0u, cb.getAndResetUsedCount());
174 EXPECT_FALSE(UserGestureIndicator::consumeUserGesture()); 172 EXPECT_FALSE(UserGestureIndicator::consumeUserGesture());
175 EXPECT_EQ(0u, cb.getAndResetUsedCount()); 173 EXPECT_EQ(0u, cb.getAndResetUsedCount());
176 } 174 }
177 175
178 } // namespace blink 176 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/UserGestureIndicator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698