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

Side by Side Diff: third_party/WebKit/Source/core/dom/DocumentUserGestureTokenTest.cpp

Issue 2721423003: Reset Frame::m_hasReceivedUserGesture for main frames on navigation (Closed)
Patch Set: One bit, reset for main frames on commit Created 3 years, 9 months 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 | « no previous file | third_party/WebKit/Source/core/frame/LocalFrame.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 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 "core/dom/DocumentUserGestureToken.h" 5 #include "core/dom/DocumentUserGestureToken.h"
6 6
7 #include "core/testing/DummyPageHolder.h" 7 #include "core/testing/DummyPageHolder.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace blink { 10 namespace blink {
(...skipping 25 matching lines...) Expand all
36 DocumentUserGestureToken::create(nullptr); 36 DocumentUserGestureToken::create(nullptr);
37 EXPECT_TRUE(document().frame()->hasReceivedUserGesture()); 37 EXPECT_TRUE(document().frame()->hasReceivedUserGesture());
38 } 38 }
39 39
40 TEST_F(DocumentUserGestureTokenTest, NewGesture) { 40 TEST_F(DocumentUserGestureTokenTest, NewGesture) {
41 // UserGestureToken::Status doesn't impact Document gesture state. 41 // UserGestureToken::Status doesn't impact Document gesture state.
42 DocumentUserGestureToken::create(&document(), UserGestureToken::NewGesture); 42 DocumentUserGestureToken::create(&document(), UserGestureToken::NewGesture);
43 EXPECT_TRUE(document().frame()->hasReceivedUserGesture()); 43 EXPECT_TRUE(document().frame()->hasReceivedUserGesture());
44 } 44 }
45 45
46 TEST_F(DocumentUserGestureTokenTest, Navigate) {
47 DocumentUserGestureToken::create(&document());
48 ASSERT_TRUE(document().frame()->hasReceivedUserGesture());
49
50 // Navigate to a different Document. In the main frame, user gesture state
51 // will get reset.
52 document().frame()->loader().load(FrameLoadRequest(nullptr, KURL()));
53 EXPECT_FALSE(document().frame()->hasReceivedUserGesture());
54 }
55
46 } // namespace blink 56 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/LocalFrame.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698