| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |