| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 "web/ExternalPopupMenu.h" | 5 #include "web/ExternalPopupMenu.h" |
| 6 | 6 |
| 7 #include "core/HTMLNames.h" | 7 #include "core/HTMLNames.h" |
| 8 #include "core/dom/NodeComputedStyle.h" | 8 #include "core/dom/NodeComputedStyle.h" |
| 9 #include "core/frame/FrameHost.h" | 9 #include "core/frame/FrameHost.h" |
| 10 #include "core/frame/VisualViewport.h" | 10 #include "core/frame/VisualViewport.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 protected: | 33 protected: |
| 34 void SetUp() override | 34 void SetUp() override |
| 35 { | 35 { |
| 36 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); | 36 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); |
| 37 HTMLSelectElement* element = HTMLSelectElement::create(m_dummyPageHolder
->document()); | 37 HTMLSelectElement* element = HTMLSelectElement::create(m_dummyPageHolder
->document()); |
| 38 // Set the 4th an 5th items to have "display: none" property | 38 // Set the 4th an 5th items to have "display: none" property |
| 39 element->setInnerHTML("<option><option><option><option style='display:no
ne;'><option style='display:none;'><option><option>", ASSERT_NO_EXCEPTION); | 39 element->setInnerHTML("<option><option><option><option style='display:no
ne;'><option style='display:none;'><option><option>", ASSERT_NO_EXCEPTION); |
| 40 m_dummyPageHolder->document().body()->appendChild(element, ASSERT_NO_EXC
EPTION); | 40 m_dummyPageHolder->document().body()->appendChild(element, ASSERT_NO_EXC
EPTION); |
| 41 m_ownerElement = element; | 41 m_ownerElement = element; |
| 42 m_dummyPageHolder->document().updateLayoutIgnorePendingStylesheets(); | 42 m_dummyPageHolder->document().updateStyleAndLayoutIgnorePendingStyleshee
ts(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 OwnPtr<DummyPageHolder> m_dummyPageHolder; | 45 OwnPtr<DummyPageHolder> m_dummyPageHolder; |
| 46 Persistent<HTMLSelectElement> m_ownerElement; | 46 Persistent<HTMLSelectElement> m_ownerElement; |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 TEST_F(ExternalPopupMenuDisplayNoneItemsTest, PopupMenuInfoSizeTest) | 49 TEST_F(ExternalPopupMenuDisplayNoneItemsTest, PopupMenuInfoSizeTest) |
| 50 { | 50 { |
| 51 WebPopupMenuInfo info; | 51 WebPopupMenuInfo info; |
| 52 ExternalPopupMenu::getPopupMenuInfo(info, *m_ownerElement); | 52 ExternalPopupMenu::getPopupMenuInfo(info, *m_ownerElement); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 ASSERT_TRUE(select->popupIsVisible()); | 214 ASSERT_TRUE(select->popupIsVisible()); |
| 215 | 215 |
| 216 WebExternalPopupMenuClient* client = static_cast<ExternalPopupMenu*>(select-
>popup()); | 216 WebExternalPopupMenuClient* client = static_cast<ExternalPopupMenu*>(select-
>popup()); |
| 217 WebVector<int> indices; | 217 WebVector<int> indices; |
| 218 client->didAcceptIndices(indices); | 218 client->didAcceptIndices(indices); |
| 219 EXPECT_FALSE(select->popupIsVisible()); | 219 EXPECT_FALSE(select->popupIsVisible()); |
| 220 EXPECT_EQ(-1, select->selectedIndex()); | 220 EXPECT_EQ(-1, select->selectedIndex()); |
| 221 } | 221 } |
| 222 | 222 |
| 223 } // namespace blink | 223 } // namespace blink |
| OLD | NEW |