|
public:
Source/WebKit/chromium/tests/PopupMenuTest.cpp_sec1
|
| 182 |
protected: |
182 |
protected: |
| 183 |
virtual void SetUp() |
183 |
virtual void SetUp() |
| 184 |
{ |
184 |
{ |
| 185 |
// When touch is enabled, padding is added to option elements |
|
|
| 186 |
// In these tests, we'll assume touch is disabled. |
| 187 |
m_touchWasEnabled = RuntimeEnabledFeatures::touchEnabled(); |
| 188 |
RuntimeEnabledFeatures::setTouchEnabled(false); |
| 189 |
m_webView = static_cast<WebViewImpl*>(WebView::create(&m_webviewClient)); |
185 |
m_webView = static_cast<WebViewImpl*>(WebView::create(&m_webviewClient)); |
| 190 |
m_webView->initializeMainFrame(&m_webFrameClient); |
186 |
m_webView->initializeMainFrame(&m_webFrameClient); |
| 191 |
m_popupMenu = adoptRef(new PopupMenuChromium(&m_popupMenuClient)); |
187 |
m_popupMenu = adoptRef(new PopupMenuChromium(&m_popupMenuClient)); |
|
protected:
Source/WebKit/chromium/tests/PopupMenuTest.cpp_sec2
|
| 196 |
m_popupMenu = 0; |
192 |
m_popupMenu = 0; |
| 197 |
m_webView->close(); |
193 |
m_webView->close(); |
| 198 |
webkit_support::UnregisterAllMockedURLs(); |
194 |
webkit_support::UnregisterAllMockedURLs(); |
| 199 |
RuntimeEnabledFeatures::setTouchEnabled(m_touchWasEnabled); |
|
|
| 200 |
} |
195 |
} |
| 201 |
|
196 |
|
| 202 |
// Returns true if there currently is a select popup in the WebView. |
197 |
// Returns true if there currently is a select popup in the WebView. |
|
protected:
Source/WebKit/chromium/tests/PopupMenuTest.cpp_sec3
|
| 284 |
TestWebFrameClient m_webFrameClient; |
279 |
TestWebFrameClient m_webFrameClient; |
| 285 |
TestPopupMenuClient m_popupMenuClient; |
280 |
TestPopupMenuClient m_popupMenuClient; |
| 286 |
RefPtr<PopupMenu> m_popupMenu; |
281 |
RefPtr<PopupMenu> m_popupMenu; |
| 287 |
bool m_touchWasEnabled; |
|
|
| 288 |
std::string baseURL; |
282 |
std::string baseURL; |
| 289 |
}; |
283 |
}; |
| 290 |
|
284 |
|
|
TEST_F(SelectPopupMenuTest, ClickItem)
Source/WebKit/chromium/tests/PopupMenuTest.cpp_sec4
|
| 360 |
{ |
354 |
{ |
| 361 |
showPopup(); |
355 |
showPopup(); |
| 362 |
|
356 |
|
| 363 |
// Y of 18 to be on the item at index 1 (12 font plus border and more to be safe). |
357 |
int menuItemHeight = m_webView->selectPopup()->menuItemHeight(); |
| 364 |
IntPoint row1Point(2, 18); |
358 |
// menuItemHeight * 1.5 means the Y position on the item at index 1. |
|
|
359 |
IntPoint row1Point(2, menuItemHeight * 1.5); |
| 365 |
// Simulate a click down/up on the first item. |
360 |
// Simulate a click down/up on the first item. |
| 366 |
simulateLeftMouseDownEvent(row1Point); |
361 |
simulateLeftMouseDownEvent(row1Point); |
| 367 |
simulateLeftMouseUpEvent(row1Point); |
362 |
simulateLeftMouseUpEvent(row1Point); |
|
TEST_F(SelectPopupMenuTest, MouseOverIte
Source/WebKit/chromium/tests/PopupMenuTest.cpp_sec5
|
| 377 |
{ |
372 |
{ |
| 378 |
showPopup(); |
373 |
showPopup(); |
| 379 |
|
374 |
|
| 380 |
// Y of 18 to be on the item at index 1 (12 font plus border and more to be safe). |
375 |
int menuItemHeight = m_webView->selectPopup()->menuItemHeight(); |
| 381 |
IntPoint row1Point(2, 18); |
376 |
// menuItemHeight * 1.5 means the Y position on the item at index 1. |
|
|
377 |
IntPoint row1Point(2, menuItemHeight * 1.5); |
| 382 |
// Simulate the mouse moving over the first item. |
378 |
// Simulate the mouse moving over the first item. |
| 383 |
PlatformMouseEvent mouseEvent(row1Point, row1Point, NoButton, PlatformEvent::MouseMoved, |
379 |
PlatformMouseEvent mouseEvent(row1Point, row1Point, NoButton, PlatformEvent::MouseMoved, |
| 384 |
1, false, false, false, false, 0); |
380 |
1, false, false, false, false, 0); |
|
TEST_F(SelectPopupMenuTest, DISABLED_Sel
Source/WebKit/chromium/tests/PopupMenuTest.cpp_sec6
|
| 421 |
|
417 |
|
| 422 |
showPopup(); |
418 |
showPopup(); |
| 423 |
|
419 |
|
| 424 |
int menuHeight = m_webView->selectPopup()->menuItemHeight(); |
420 |
int menuItemHeight = m_webView->selectPopup()->menuItemHeight(); |
| 425 |
// menuHeight * 0.5 means the Y position on the item at index 0. |
421 |
// menuItemHeight * 0.5 means the Y position on the item at index 0. |
| 426 |
IntPoint row1Point(2, menuHeight * 0.5); |
422 |
IntPoint row1Point(2, menuItemHeight * 0.5); |
| 427 |
simulateLeftMouseDownEvent(row1Point); |
423 |
simulateLeftMouseDownEvent(row1Point); |
| 428 |
simulateLeftMouseUpEvent(row1Point); |
424 |
simulateLeftMouseUpEvent(row1Point); |
| 429 |
|
425 |
|
|
TEST_F(SelectPopupMenuTest, DISABLED_Sel
Source/WebKit/chromium/tests/PopupMenuTest.cpp_sec7
|
| 437 |
m_popupMenuClient.setDisabledIndex(1); |
433 |
m_popupMenuClient.setDisabledIndex(1); |
| 438 |
|
434 |
|
| 439 |
showPopup(); |
435 |
showPopup(); |
| 440 |
// menuHeight * 1.5 means the Y position on the item at index 1. |
436 |
// menuItemHeight * 1.5 means the Y position on the item at index 1. |
| 441 |
row1Point.setY(menuHeight * 1.5); |
437 |
row1Point.setY(menuItemHeight * 1.5); |
| 442 |
simulateLeftMouseDownEvent(row1Point); |
438 |
simulateLeftMouseDownEvent(row1Point); |
| 443 |
simulateLeftMouseUpEvent(row1Point); |
439 |
simulateLeftMouseUpEvent(row1Point); |
| 444 |
|
440 |
|
|
TEST_F(SelectPopupMenuTest, DISABLED_Sel
Source/WebKit/chromium/tests/PopupMenuTest.cpp_sec8
|
| 446 |
EXPECT_STREQ("upclick", std::string(element.innerText().utf8()).c_str()); |
442 |
EXPECT_STREQ("upclick", std::string(element.innerText().utf8()).c_str()); |
| 447 |
|
443 |
|
| 448 |
showPopup(); |
444 |
showPopup(); |
| 449 |
// menuHeight * 2.5 means the Y position on the item at index 2. |
445 |
// menuItemHeight * 2.5 means the Y position on the item at index 2. |
| 450 |
row1Point.setY(menuHeight * 2.5); |
446 |
row1Point.setY(menuItemHeight * 2.5); |
| 451 |
simulateLeftMouseDownEvent(row1Point); |
447 |
simulateLeftMouseDownEvent(row1Point); |
| 452 |
simulateLeftMouseUpEvent(row1Point); |
448 |
simulateLeftMouseUpEvent(row1Point); |
| 453 |
|
449 |
|
|
TEST_F(SelectPopupMenuTest, SelectItemRe
Source/WebKit/chromium/tests/PopupMenuTest.cpp_sec9
|
| 488 |
|
484 |
|
| 489 |
showPopup(); |
485 |
showPopup(); |
| 490 |
|
486 |
|
| 491 |
int menuHeight = m_webView->selectPopup()->menuItemHeight(); |
487 |
int menuItemHeight = m_webView->selectPopup()->menuItemHeight(); |
| 492 |
// menuHeight * 1.5 means the Y position on the item at index 1. |
488 |
// menuItemHeight * 1.5 means the Y position on the item at index 1. |
| 493 |
IntPoint row1Point(2, menuHeight * 1.5); |
489 |
IntPoint row1Point(2, menuItemHeight * 1.5); |
| 494 |
simulateLeftMouseDownEvent(row1Point); |
490 |
simulateLeftMouseDownEvent(row1Point); |
| 495 |
simulateLeftMouseUpEvent(row1Point); |
491 |
simulateLeftMouseUpEvent(row1Point); |
| 496 |
|
492 |
|
|
TEST_F(SelectPopupMenuTest, SelectItemRe
Source/WebKit/chromium/tests/PopupMenuTest.cpp_sec10
|
| 510 |
|
506 |
|
| 511 |
showPopup(); |
507 |
showPopup(); |
| 512 |
|
508 |
|
| 513 |
int menuHeight = m_webView->selectPopup()->menuItemHeight(); |
509 |
int menuItemHeight = m_webView->selectPopup()->menuItemHeight(); |
| 514 |
// menuHeight * 1.5 means the Y position on the item at index 1. |
510 |
// menuItemHeight * 1.5 means the Y position on the item at index 1. |
| 515 |
IntPoint row1Point(2, menuHeight * 1.5); |
511 |
IntPoint row1Point(2, menuItemHeight * 1.5); |
| 516 |
simulateLeftMouseDownEvent(row1Point); |
512 |
simulateLeftMouseDownEvent(row1Point); |
| 517 |
simulateLeftMouseUpEvent(row1Point); |
513 |
simulateLeftMouseUpEvent(row1Point); |
| 518 |
|
514 |
|