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/events/TouchEvent.h" | 5 #include "core/events/TouchEvent.h" |
6 | 6 |
7 #include "core/frame/FrameConsole.h" | 7 #include "core/frame/FrameConsole.h" |
8 #include "core/frame/UseCounter.h" | 8 #include "core/frame/UseCounter.h" |
9 #include "core/loader/EmptyClients.h" | 9 #include "core/loader/EmptyClients.h" |
10 #include "core/testing/DummyPageHolder.h" | 10 #include "core/testing/DummyPageHolder.h" |
11 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 using testing::ElementsAre; | 14 using ::testing::ElementsAre; |
15 | 15 |
16 namespace blink { | 16 namespace blink { |
17 | 17 |
18 class ConsoleCapturingChromeClient : public EmptyChromeClient { | 18 class ConsoleCapturingChromeClient : public EmptyChromeClient { |
19 public: | 19 public: |
20 ConsoleCapturingChromeClient() : EmptyChromeClient() {} | 20 ConsoleCapturingChromeClient() : EmptyChromeClient() {} |
21 | 21 |
22 // ChromeClient methods: | 22 // ChromeClient methods: |
23 void AddMessageToConsole(LocalFrame*, | 23 void AddMessageToConsole(LocalFrame*, |
24 MessageSource message_source, | 24 MessageSource message_source, |
(...skipping 10 matching lines...) Expand all Loading... |
35 const std::vector<String>& Messages() { return messages_; } | 35 const std::vector<String>& Messages() { return messages_; } |
36 const std::vector<MessageSource>& MessageSources() { | 36 const std::vector<MessageSource>& MessageSources() { |
37 return message_sources_; | 37 return message_sources_; |
38 } | 38 } |
39 | 39 |
40 private: | 40 private: |
41 std::vector<String> messages_; | 41 std::vector<String> messages_; |
42 std::vector<MessageSource> message_sources_; | 42 std::vector<MessageSource> message_sources_; |
43 }; | 43 }; |
44 | 44 |
45 class TouchEventTest : public testing::Test { | 45 class TouchEventTest : public ::testing::Test { |
46 public: | 46 public: |
47 TouchEventTest() { | 47 TouchEventTest() { |
48 chrome_client_ = new ConsoleCapturingChromeClient(); | 48 chrome_client_ = new ConsoleCapturingChromeClient(); |
49 Page::PageClients clients; | 49 Page::PageClients clients; |
50 FillWithEmptyClients(clients); | 50 FillWithEmptyClients(clients); |
51 clients.chrome_client = chrome_client_.Get(); | 51 clients.chrome_client = chrome_client_.Get(); |
52 page_holder_ = DummyPageHolder::Create(IntSize(800, 600), &clients); | 52 page_holder_ = DummyPageHolder::Create(IntSize(800, 600), &clients); |
53 } | 53 } |
54 | 54 |
55 const std::vector<String>& Messages() { return chrome_client_->Messages(); } | 55 const std::vector<String>& Messages() { return chrome_client_->Messages(); } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 EXPECT_THAT(Messages(), ElementsAre()); | 126 EXPECT_THAT(Messages(), ElementsAre()); |
127 event->preventDefault(); | 127 event->preventDefault(); |
128 EXPECT_THAT( | 128 EXPECT_THAT( |
129 Messages(), | 129 Messages(), |
130 ElementsAre("Unable to preventDefault inside passive event listener due " | 130 ElementsAre("Unable to preventDefault inside passive event listener due " |
131 "to target being treated as passive. See " | 131 "to target being treated as passive. See " |
132 "https://www.chromestatus.com/features/5093566007214080")); | 132 "https://www.chromestatus.com/features/5093566007214080")); |
133 EXPECT_THAT(MessageSources(), ElementsAre(kInterventionMessageSource)); | 133 EXPECT_THAT(MessageSources(), ElementsAre(kInterventionMessageSource)); |
134 } | 134 } |
135 | 135 |
136 class TouchEventTestNoFrame : public testing::Test {}; | 136 class TouchEventTestNoFrame : public ::testing::Test {}; |
137 | 137 |
138 TEST_F(TouchEventTestNoFrame, PreventDefaultDoesntRequireFrame) { | 138 TEST_F(TouchEventTestNoFrame, PreventDefaultDoesntRequireFrame) { |
139 TouchEvent::Create()->preventDefault(); | 139 TouchEvent::Create()->preventDefault(); |
140 } | 140 } |
141 | 141 |
142 } // namespace blink | 142 } // namespace blink |
OLD | NEW |