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

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

Issue 2625773002: Reenable framebusting (Closed)
Patch Set: Pass through FrameReplicationState Created 3 years, 11 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
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 {
11 11
12 class DocumentUserGestureTokenTest : public ::testing::Test { 12 class DocumentUserGestureTokenTest : public ::testing::Test {
13 public: 13 public:
14 void SetUp() override { 14 void SetUp() override {
15 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); 15 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600));
16 ASSERT_FALSE(document().hasReceivedUserGesture()); 16 ASSERT_FALSE(document().frame()->hasReceivedUserGesture());
17 } 17 }
18 18
19 Document& document() const { return m_dummyPageHolder->document(); } 19 Document& document() const { return m_dummyPageHolder->document(); }
20 20
21 private: 21 private:
22 std::unique_ptr<DummyPageHolder> m_dummyPageHolder; 22 std::unique_ptr<DummyPageHolder> m_dummyPageHolder;
23 }; 23 };
24 24
25 TEST_F(DocumentUserGestureTokenTest, NoGesture) { 25 TEST_F(DocumentUserGestureTokenTest, NoGesture) {
26 // A nullptr Document* will not set user gesture state. 26 // A nullptr Document* will not set user gesture state.
27 DocumentUserGestureToken::create(nullptr); 27 DocumentUserGestureToken::create(nullptr);
28 EXPECT_FALSE(document().hasReceivedUserGesture()); 28 EXPECT_FALSE(document().frame()->hasReceivedUserGesture());
29 } 29 }
30 30
31 TEST_F(DocumentUserGestureTokenTest, PossiblyExisting) { 31 TEST_F(DocumentUserGestureTokenTest, PossiblyExisting) {
32 // A non-null Document* will set state, but a subsequent nullptr Document* 32 // A non-null Document* will set state, but a subsequent nullptr Document*
33 // token will not override it. 33 // token will not override it.
34 DocumentUserGestureToken::create(&document()); 34 DocumentUserGestureToken::create(&document());
35 EXPECT_TRUE(document().hasReceivedUserGesture()); 35 EXPECT_TRUE(document().frame()->hasReceivedUserGesture());
36 DocumentUserGestureToken::create(nullptr); 36 DocumentUserGestureToken::create(nullptr);
37 EXPECT_TRUE(document().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().hasReceivedUserGesture()); 43 EXPECT_TRUE(document().frame()->hasReceivedUserGesture());
44 } 44 }
45 45
46 } // namespace blink 46 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/DocumentUserGestureToken.h ('k') | third_party/WebKit/Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698