OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 TestWebViewClient m_webViewClient; | 113 TestWebViewClient m_webViewClient; |
114 WebViewImpl* m_webView; | 114 WebViewImpl* m_webView; |
115 WebFrame* m_mainFrame; | 115 WebFrame* m_mainFrame; |
116 FrameTestHelpers::TestWebFrameClient m_webFrameClient; | 116 FrameTestHelpers::TestWebFrameClient m_webFrameClient; |
117 Persistent<ChromeClientImpl> m_chromeClientImpl; | 117 Persistent<ChromeClientImpl> m_chromeClientImpl; |
118 }; | 118 }; |
119 | 119 |
120 TEST_F(GetNavigationPolicyTest, LeftClick) | 120 TEST_F(GetNavigationPolicyTest, LeftClick) |
121 { | 121 { |
122 int modifiers = 0; | 122 int modifiers = 0; |
123 WebMouseEvent::Button button = WebMouseEvent::ButtonLeft; | 123 WebMouseEvent::Button button = WebMouseEvent::Button::Left; |
124 bool asPopup = false; | 124 bool asPopup = false; |
125 EXPECT_EQ(WebNavigationPolicyNewForegroundTab, | 125 EXPECT_EQ(WebNavigationPolicyNewForegroundTab, |
126 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); | 126 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); |
127 } | 127 } |
128 | 128 |
129 TEST_F(GetNavigationPolicyTest, LeftClickPopup) | 129 TEST_F(GetNavigationPolicyTest, LeftClickPopup) |
130 { | 130 { |
131 int modifiers = 0; | 131 int modifiers = 0; |
132 WebMouseEvent::Button button = WebMouseEvent::ButtonLeft; | 132 WebMouseEvent::Button button = WebMouseEvent::Button::Left; |
133 bool asPopup = true; | 133 bool asPopup = true; |
134 EXPECT_EQ(WebNavigationPolicyNewPopup, | 134 EXPECT_EQ(WebNavigationPolicyNewPopup, |
135 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); | 135 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); |
136 } | 136 } |
137 | 137 |
138 TEST_F(GetNavigationPolicyTest, ShiftLeftClick) | 138 TEST_F(GetNavigationPolicyTest, ShiftLeftClick) |
139 { | 139 { |
140 int modifiers = WebInputEvent::ShiftKey; | 140 int modifiers = WebInputEvent::ShiftKey; |
141 WebMouseEvent::Button button = WebMouseEvent::ButtonLeft; | 141 WebMouseEvent::Button button = WebMouseEvent::Button::Left; |
142 bool asPopup = false; | 142 bool asPopup = false; |
143 EXPECT_EQ(WebNavigationPolicyNewWindow, | 143 EXPECT_EQ(WebNavigationPolicyNewWindow, |
144 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); | 144 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); |
145 } | 145 } |
146 | 146 |
147 TEST_F(GetNavigationPolicyTest, ShiftLeftClickPopup) | 147 TEST_F(GetNavigationPolicyTest, ShiftLeftClickPopup) |
148 { | 148 { |
149 int modifiers = WebInputEvent::ShiftKey; | 149 int modifiers = WebInputEvent::ShiftKey; |
150 WebMouseEvent::Button button = WebMouseEvent::ButtonLeft; | 150 WebMouseEvent::Button button = WebMouseEvent::Button::Left; |
151 bool asPopup = true; | 151 bool asPopup = true; |
152 EXPECT_EQ(WebNavigationPolicyNewPopup, | 152 EXPECT_EQ(WebNavigationPolicyNewPopup, |
153 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); | 153 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); |
154 } | 154 } |
155 | 155 |
156 TEST_F(GetNavigationPolicyTest, ControlOrMetaLeftClick) | 156 TEST_F(GetNavigationPolicyTest, ControlOrMetaLeftClick) |
157 { | 157 { |
158 #if OS(MACOSX) | 158 #if OS(MACOSX) |
159 int modifiers = WebInputEvent::MetaKey; | 159 int modifiers = WebInputEvent::MetaKey; |
160 #else | 160 #else |
161 int modifiers = WebInputEvent::ControlKey; | 161 int modifiers = WebInputEvent::ControlKey; |
162 #endif | 162 #endif |
163 WebMouseEvent::Button button = WebMouseEvent::ButtonLeft; | 163 WebMouseEvent::Button button = WebMouseEvent::Button::Left; |
164 bool asPopup = false; | 164 bool asPopup = false; |
165 EXPECT_EQ(WebNavigationPolicyNewBackgroundTab, | 165 EXPECT_EQ(WebNavigationPolicyNewBackgroundTab, |
166 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); | 166 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); |
167 } | 167 } |
168 | 168 |
169 TEST_F(GetNavigationPolicyTest, ControlOrMetaLeftClickPopup) | 169 TEST_F(GetNavigationPolicyTest, ControlOrMetaLeftClickPopup) |
170 { | 170 { |
171 #if OS(MACOSX) | 171 #if OS(MACOSX) |
172 int modifiers = WebInputEvent::MetaKey; | 172 int modifiers = WebInputEvent::MetaKey; |
173 #else | 173 #else |
174 int modifiers = WebInputEvent::ControlKey; | 174 int modifiers = WebInputEvent::ControlKey; |
175 #endif | 175 #endif |
176 WebMouseEvent::Button button = WebMouseEvent::ButtonLeft; | 176 WebMouseEvent::Button button = WebMouseEvent::Button::Left; |
177 bool asPopup = true; | 177 bool asPopup = true; |
178 EXPECT_EQ(WebNavigationPolicyNewBackgroundTab, | 178 EXPECT_EQ(WebNavigationPolicyNewBackgroundTab, |
179 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); | 179 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); |
180 } | 180 } |
181 | 181 |
182 TEST_F(GetNavigationPolicyTest, ControlOrMetaAndShiftLeftClick) | 182 TEST_F(GetNavigationPolicyTest, ControlOrMetaAndShiftLeftClick) |
183 { | 183 { |
184 #if OS(MACOSX) | 184 #if OS(MACOSX) |
185 int modifiers = WebInputEvent::MetaKey; | 185 int modifiers = WebInputEvent::MetaKey; |
186 #else | 186 #else |
187 int modifiers = WebInputEvent::ControlKey; | 187 int modifiers = WebInputEvent::ControlKey; |
188 #endif | 188 #endif |
189 modifiers |= WebInputEvent::ShiftKey; | 189 modifiers |= WebInputEvent::ShiftKey; |
190 WebMouseEvent::Button button = WebMouseEvent::ButtonLeft; | 190 WebMouseEvent::Button button = WebMouseEvent::Button::Left; |
191 bool asPopup = false; | 191 bool asPopup = false; |
192 EXPECT_EQ(WebNavigationPolicyNewForegroundTab, | 192 EXPECT_EQ(WebNavigationPolicyNewForegroundTab, |
193 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); | 193 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); |
194 } | 194 } |
195 | 195 |
196 TEST_F(GetNavigationPolicyTest, ControlOrMetaAndShiftLeftClickPopup) | 196 TEST_F(GetNavigationPolicyTest, ControlOrMetaAndShiftLeftClickPopup) |
197 { | 197 { |
198 #if OS(MACOSX) | 198 #if OS(MACOSX) |
199 int modifiers = WebInputEvent::MetaKey; | 199 int modifiers = WebInputEvent::MetaKey; |
200 #else | 200 #else |
201 int modifiers = WebInputEvent::ControlKey; | 201 int modifiers = WebInputEvent::ControlKey; |
202 #endif | 202 #endif |
203 modifiers |= WebInputEvent::ShiftKey; | 203 modifiers |= WebInputEvent::ShiftKey; |
204 WebMouseEvent::Button button = WebMouseEvent::ButtonLeft; | 204 WebMouseEvent::Button button = WebMouseEvent::Button::Left; |
205 bool asPopup = true; | 205 bool asPopup = true; |
206 EXPECT_EQ(WebNavigationPolicyNewForegroundTab, | 206 EXPECT_EQ(WebNavigationPolicyNewForegroundTab, |
207 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); | 207 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); |
208 } | 208 } |
209 | 209 |
210 TEST_F(GetNavigationPolicyTest, MiddleClick) | 210 TEST_F(GetNavigationPolicyTest, MiddleClick) |
211 { | 211 { |
212 int modifiers = 0; | 212 int modifiers = 0; |
213 bool asPopup = false; | 213 bool asPopup = false; |
214 WebMouseEvent::Button button = WebMouseEvent::ButtonMiddle; | 214 WebMouseEvent::Button button = WebMouseEvent::Button::Middle; |
215 EXPECT_EQ(WebNavigationPolicyNewBackgroundTab, | 215 EXPECT_EQ(WebNavigationPolicyNewBackgroundTab, |
216 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); | 216 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); |
217 } | 217 } |
218 | 218 |
219 TEST_F(GetNavigationPolicyTest, MiddleClickPopup) | 219 TEST_F(GetNavigationPolicyTest, MiddleClickPopup) |
220 { | 220 { |
221 int modifiers = 0; | 221 int modifiers = 0; |
222 bool asPopup = true; | 222 bool asPopup = true; |
223 WebMouseEvent::Button button = WebMouseEvent::ButtonMiddle; | 223 WebMouseEvent::Button button = WebMouseEvent::Button::Middle; |
224 EXPECT_EQ(WebNavigationPolicyNewBackgroundTab, | 224 EXPECT_EQ(WebNavigationPolicyNewBackgroundTab, |
225 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); | 225 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); |
226 } | 226 } |
227 | 227 |
228 TEST_F(GetNavigationPolicyTest, NoToolbarsForcesPopup) | 228 TEST_F(GetNavigationPolicyTest, NoToolbarsForcesPopup) |
229 { | 229 { |
230 m_chromeClientImpl->setToolbarsVisible(false); | 230 m_chromeClientImpl->setToolbarsVisible(false); |
231 EXPECT_TRUE(isNavigationPolicyPopup()); | 231 EXPECT_TRUE(isNavigationPolicyPopup()); |
232 m_chromeClientImpl->setToolbarsVisible(true); | 232 m_chromeClientImpl->setToolbarsVisible(true); |
233 EXPECT_FALSE(isNavigationPolicyPopup()); | 233 EXPECT_FALSE(isNavigationPolicyPopup()); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 { | 295 { |
296 m_webView->page()->setDefersLoading(true); | 296 m_webView->page()->setDefersLoading(true); |
297 LocalFrame* frame = toWebLocalFrameImpl(m_mainFrame)->frame(); | 297 LocalFrame* frame = toWebLocalFrameImpl(m_mainFrame)->frame(); |
298 FrameLoadRequest request(frame->document()); | 298 FrameLoadRequest request(frame->document()); |
299 WindowFeatures features; | 299 WindowFeatures features; |
300 EXPECT_EQ(nullptr, m_chromeClientImpl->createWindow(frame, request, features
, NavigationPolicyNewForegroundTab)); | 300 EXPECT_EQ(nullptr, m_chromeClientImpl->createWindow(frame, request, features
, NavigationPolicyNewForegroundTab)); |
301 m_webView->page()->setDefersLoading(false); | 301 m_webView->page()->setDefersLoading(false); |
302 } | 302 } |
303 | 303 |
304 } // namespace blink | 304 } // namespace blink |
OLD | NEW |