Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(990)

Side by Side Diff: third_party/WebKit/Source/web/ExternalPopupMenuTest.cpp

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "core/html/HTMLSelectElement.h" 11 #include "core/html/HTMLSelectElement.h"
12 #include "core/layout/LayoutMenuList.h" 12 #include "core/layout/LayoutMenuList.h"
13 #include "core/page/Page.h" 13 #include "core/page/Page.h"
14 #include "core/testing/DummyPageHolder.h" 14 #include "core/testing/DummyPageHolder.h"
15 #include "platform/PopupMenu.h" 15 #include "platform/PopupMenu.h"
16 #include "platform/testing/URLTestHelpers.h" 16 #include "platform/testing/URLTestHelpers.h"
17 #include "public/platform/Platform.h" 17 #include "public/platform/Platform.h"
18 #include "public/platform/WebURLLoaderMockFactory.h" 18 #include "public/platform/WebURLLoaderMockFactory.h"
19 #include "public/web/WebCache.h" 19 #include "public/web/WebCache.h"
20 #include "public/web/WebExternalPopupMenu.h" 20 #include "public/web/WebExternalPopupMenu.h"
21 #include "public/web/WebPopupMenuInfo.h" 21 #include "public/web/WebPopupMenuInfo.h"
22 #include "public/web/WebSettings.h" 22 #include "public/web/WebSettings.h"
23 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
24 #include "web/WebLocalFrameImpl.h" 24 #include "web/WebLocalFrameImpl.h"
25 #include "web/tests/FrameTestHelpers.h" 25 #include "web/tests/FrameTestHelpers.h"
26 #include <memory>
26 27
27 namespace blink { 28 namespace blink {
28 29
29 class ExternalPopupMenuDisplayNoneItemsTest : public testing::Test { 30 class ExternalPopupMenuDisplayNoneItemsTest : public testing::Test {
30 public: 31 public:
31 ExternalPopupMenuDisplayNoneItemsTest() { } 32 ExternalPopupMenuDisplayNoneItemsTest() { }
32 33
33 protected: 34 protected:
34 void SetUp() override 35 void SetUp() override
35 { 36 {
36 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); 37 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600));
37 HTMLSelectElement* element = HTMLSelectElement::create(m_dummyPageHolder ->document()); 38 HTMLSelectElement* element = HTMLSelectElement::create(m_dummyPageHolder ->document());
38 // Set the 4th an 5th items to have "display: none" property 39 // 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); 40 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); 41 m_dummyPageHolder->document().body()->appendChild(element, ASSERT_NO_EXC EPTION);
41 m_ownerElement = element; 42 m_ownerElement = element;
42 m_dummyPageHolder->document().updateStyleAndLayoutIgnorePendingStyleshee ts(); 43 m_dummyPageHolder->document().updateStyleAndLayoutIgnorePendingStyleshee ts();
43 } 44 }
44 45
45 OwnPtr<DummyPageHolder> m_dummyPageHolder; 46 std::unique_ptr<DummyPageHolder> m_dummyPageHolder;
46 Persistent<HTMLSelectElement> m_ownerElement; 47 Persistent<HTMLSelectElement> m_ownerElement;
47 }; 48 };
48 49
49 TEST_F(ExternalPopupMenuDisplayNoneItemsTest, PopupMenuInfoSizeTest) 50 TEST_F(ExternalPopupMenuDisplayNoneItemsTest, PopupMenuInfoSizeTest)
50 { 51 {
51 WebPopupMenuInfo info; 52 WebPopupMenuInfo info;
52 ExternalPopupMenu::getPopupMenuInfo(info, *m_ownerElement); 53 ExternalPopupMenu::getPopupMenuInfo(info, *m_ownerElement);
53 EXPECT_EQ(5U, info.items.size()); 54 EXPECT_EQ(5U, info.items.size());
54 } 55 }
55 56
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 ASSERT_TRUE(select->popupIsVisible()); 215 ASSERT_TRUE(select->popupIsVisible());
215 216
216 WebExternalPopupMenuClient* client = static_cast<ExternalPopupMenu*>(select- >popup()); 217 WebExternalPopupMenuClient* client = static_cast<ExternalPopupMenu*>(select- >popup());
217 WebVector<int> indices; 218 WebVector<int> indices;
218 client->didAcceptIndices(indices); 219 client->didAcceptIndices(indices);
219 EXPECT_FALSE(select->popupIsVisible()); 220 EXPECT_FALSE(select->popupIsVisible());
220 EXPECT_EQ(-1, select->selectedIndex()); 221 EXPECT_EQ(-1, select->selectedIndex());
221 } 222 }
222 223
223 } // namespace blink 224 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/ExternalPopupMenu.cpp ('k') | third_party/WebKit/Source/web/FrameLoaderClientImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698