| Index: Source/web/tests/PopupMenuTest.cpp
|
| diff --git a/Source/web/tests/PopupMenuTest.cpp b/Source/web/tests/PopupMenuTest.cpp
|
| index bd6529420968b31002e4da5e4564182da7601ee0..ed65f440defa6f0cd89afbe34b1aa1e52989345f 100644
|
| --- a/Source/web/tests/PopupMenuTest.cpp
|
| +++ b/Source/web/tests/PopupMenuTest.cpp
|
| @@ -35,6 +35,7 @@
|
| #include "core/frame/Settings.h"
|
| #include "core/html/HTMLSelectElement.h"
|
| #include "core/page/EventHandler.h"
|
| +#include "core/rendering/RenderMenuList.h"
|
| #include "platform/KeyboardCodes.h"
|
| #include "platform/PlatformMouseEvent.h"
|
| #include "platform/PopupMenu.h"
|
| @@ -548,4 +549,66 @@ TEST_F(SelectPopupMenuTest, PopupListBoxWithOverlayScrollbarDisabled)
|
| EXPECT_EQ(container->width(), listBox->contentsSize().width() + ScrollbarTheme::theme()->scrollbarThickness() + 2);
|
| }
|
|
|
| +class SelectPopupMenuStyleTest : public testing::Test {
|
| +public:
|
| + SelectPopupMenuStyleTest()
|
| + : baseURL("http://www.test.com/")
|
| + {
|
| + }
|
| +
|
| +protected:
|
| + virtual void SetUp() OVERRIDE
|
| + {
|
| + m_helper.initialize(false, 0, &m_webviewClient);
|
| + }
|
| +
|
| + virtual void TearDown() OVERRIDE
|
| + {
|
| + Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
|
| + }
|
| +
|
| + // Returns true if there currently is a select popup in the WebView.
|
| + bool popupOpen() const { return webView()->selectPopup(); }
|
| +
|
| + void registerMockedURLLoad(const std::string& fileName)
|
| + {
|
| + URLTestHelpers::registerMockedURLLoad(toKURL(baseURL + fileName), WebString::fromUTF8(fileName.c_str()), WebString::fromUTF8("popup/"), WebString::fromUTF8("text/html"));
|
| + }
|
| +
|
| + void loadFrame(WebFrame* frame, const std::string& fileName)
|
| + {
|
| + FrameTestHelpers::loadFrame(frame, baseURL + fileName);
|
| + }
|
| +
|
| + WebViewImpl* webView() const { return m_helper.webViewImpl(); }
|
| + WebLocalFrameImpl* mainFrame() const { return m_helper.webViewImpl()->mainFrameImpl(); }
|
| +
|
| +protected:
|
| + PopupTestWebViewClient m_webviewClient;
|
| + RefPtr<PopupMenu> m_popupMenu;
|
| + std::string baseURL;
|
| +
|
| +private:
|
| + FrameTestHelpers::WebViewHelper m_helper;
|
| +};
|
| +
|
| +#if OS(MACOSX) || OS(ANDROID)
|
| +TEST_F(SelectPopupMenuStyleTest, DISABLED_PopupListBoxRTLRowWidth)
|
| +#else
|
| +TEST_F(SelectPopupMenuStyleTest, PopupListBoxRTLRowWidth)
|
| +#endif
|
| +{
|
| + registerMockedURLLoad("select_rtl_width.html");
|
| + loadFrame(mainFrame(), "select_rtl_width.html");
|
| + HTMLSelectElement* select = toHTMLSelectElement(mainFrame()->frame()->document()->focusedElement());
|
| + RenderMenuList* menuList = toRenderMenuList(select->renderer());
|
| + ASSERT(menuList);
|
| + menuList->showPopup();
|
| + ASSERT(popupOpen());
|
| + PopupListBox* listBox = webView()->selectPopup()->listBox();
|
| + int ltrWidth = listBox->getRowBaseWidth(0);
|
| + int rtlWidth = listBox->getRowBaseWidth(1);
|
| + EXPECT_LT(rtlWidth, ltrWidth);
|
| +}
|
| +
|
| } // namespace
|
|
|