| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 WebKeyboardEvent keyEvent; | 234 WebKeyboardEvent keyEvent; |
| 235 keyEvent.windowsKeyCode = keyCode; | 235 keyEvent.windowsKeyCode = keyCode; |
| 236 keyEvent.type = eventType; | 236 keyEvent.type = eventType; |
| 237 webView()->handleInputEvent(keyEvent); | 237 webView()->handleInputEvent(keyEvent); |
| 238 } | 238 } |
| 239 | 239 |
| 240 // Simulates a mouse event on the select popup. | 240 // Simulates a mouse event on the select popup. |
| 241 void simulateLeftMouseDownEvent(const IntPoint& point) | 241 void simulateLeftMouseDownEvent(const IntPoint& point) |
| 242 { | 242 { |
| 243 PlatformMouseEvent mouseEvent(point, point, LeftButton, PlatformEvent::M
ousePressed, | 243 PlatformMouseEvent mouseEvent(point, point, LeftButton, PlatformEvent::M
ousePressed, |
| 244 1, false, false, false, false, 0); | 244 1, false, false, false, false, PlatformMouseEvent::RealOrIndistingui
shable, 0); |
| 245 webView()->selectPopup()->handleMouseDownEvent(mouseEvent); | 245 webView()->selectPopup()->handleMouseDownEvent(mouseEvent); |
| 246 } | 246 } |
| 247 void simulateLeftMouseUpEvent(const IntPoint& point) | 247 void simulateLeftMouseUpEvent(const IntPoint& point) |
| 248 { | 248 { |
| 249 PlatformMouseEvent mouseEvent(point, point, LeftButton, PlatformEvent::M
ouseReleased, | 249 PlatformMouseEvent mouseEvent(point, point, LeftButton, PlatformEvent::M
ouseReleased, |
| 250 1, false, false, false, false, 0); | 250 1, false, false, false, false, PlatformMouseEvent::RealOrIndistingui
shable, 0); |
| 251 webView()->selectPopup()->handleMouseReleaseEvent(mouseEvent); | 251 webView()->selectPopup()->handleMouseReleaseEvent(mouseEvent); |
| 252 } | 252 } |
| 253 | 253 |
| 254 void registerMockedURLLoad(const std::string& fileName) | 254 void registerMockedURLLoad(const std::string& fileName) |
| 255 { | 255 { |
| 256 URLTestHelpers::registerMockedURLLoad(toKURL(baseURL + fileName), WebStr
ing::fromUTF8(fileName.c_str()), WebString::fromUTF8("popup/"), WebString::fromU
TF8("text/html")); | 256 URLTestHelpers::registerMockedURLLoad(toKURL(baseURL + fileName), WebStr
ing::fromUTF8(fileName.c_str()), WebString::fromUTF8("popup/"), WebString::fromU
TF8("text/html")); |
| 257 } | 257 } |
| 258 | 258 |
| 259 void loadFrame(WebFrame* frame, const std::string& fileName) | 259 void loadFrame(WebFrame* frame, const std::string& fileName) |
| 260 { | 260 { |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 // leaves the seleted item unchanged. | 362 // leaves the seleted item unchanged. |
| 363 TEST_F(SelectPopupMenuTest, MouseOverItemClickOutside) | 363 TEST_F(SelectPopupMenuTest, MouseOverItemClickOutside) |
| 364 { | 364 { |
| 365 showPopup(); | 365 showPopup(); |
| 366 | 366 |
| 367 int menuItemHeight = webView()->selectPopup()->menuItemHeight(); | 367 int menuItemHeight = webView()->selectPopup()->menuItemHeight(); |
| 368 // menuItemHeight * 1.5 means the Y position on the item at index 1. | 368 // menuItemHeight * 1.5 means the Y position on the item at index 1. |
| 369 IntPoint row1Point(2, menuItemHeight * 1.5); | 369 IntPoint row1Point(2, menuItemHeight * 1.5); |
| 370 // Simulate the mouse moving over the first item. | 370 // Simulate the mouse moving over the first item. |
| 371 PlatformMouseEvent mouseEvent(row1Point, row1Point, NoButton, PlatformEvent:
:MouseMoved, | 371 PlatformMouseEvent mouseEvent(row1Point, row1Point, NoButton, PlatformEvent:
:MouseMoved, |
| 372 1, false, false, false, false, 0); | 372 1, false, false, false, false, PlatformMouseEvent::RealOrIndistinguishab
le, 0); |
| 373 webView()->selectPopup()->handleMouseMoveEvent(mouseEvent); | 373 webView()->selectPopup()->handleMouseMoveEvent(mouseEvent); |
| 374 | 374 |
| 375 // Click outside the popup. | 375 // Click outside the popup. |
| 376 simulateLeftMouseDownEvent(IntPoint(1000, 1000)); | 376 simulateLeftMouseDownEvent(IntPoint(1000, 1000)); |
| 377 | 377 |
| 378 // Popup should have closed and item 0 should still be selected. | 378 // Popup should have closed and item 0 should still be selected. |
| 379 EXPECT_FALSE(popupOpen()); | 379 EXPECT_FALSE(popupOpen()); |
| 380 EXPECT_EQ(0, selectedIndex()); | 380 EXPECT_EQ(0, selectedIndex()); |
| 381 } | 381 } |
| 382 | 382 |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 ASSERT(menuList); | 605 ASSERT(menuList); |
| 606 menuList->showPopup(); | 606 menuList->showPopup(); |
| 607 ASSERT(popupOpen()); | 607 ASSERT(popupOpen()); |
| 608 PopupListBox* listBox = webView()->selectPopup()->listBox(); | 608 PopupListBox* listBox = webView()->selectPopup()->listBox(); |
| 609 int ltrWidth = listBox->getRowBaseWidth(0); | 609 int ltrWidth = listBox->getRowBaseWidth(0); |
| 610 int rtlWidth = listBox->getRowBaseWidth(1); | 610 int rtlWidth = listBox->getRowBaseWidth(1); |
| 611 EXPECT_LT(rtlWidth, ltrWidth); | 611 EXPECT_LT(rtlWidth, ltrWidth); |
| 612 } | 612 } |
| 613 | 613 |
| 614 } // namespace | 614 } // namespace |
| OLD | NEW |