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

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

Issue 1230533002: Fix virtual/override/final usage in Source/web/. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/web/ExternalPopupMenu.h ('k') | Source/web/FrameLoaderClientImpl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "config.h" 5 #include "config.h"
6 #include "web/ExternalPopupMenu.h" 6 #include "web/ExternalPopupMenu.h"
7 7
8 #include "core/HTMLNames.h" 8 #include "core/HTMLNames.h"
9 #include "core/frame/FrameHost.h" 9 #include "core/frame/FrameHost.h"
10 #include "core/frame/PinchViewport.h" 10 #include "core/frame/PinchViewport.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 size_t m_listSize; 74 size_t m_listSize;
75 std::set<unsigned> m_displayNoneIndexSet; 75 std::set<unsigned> m_displayNoneIndexSet;
76 RefPtrWillBePersistent<Element> m_ownerElement; 76 RefPtrWillBePersistent<Element> m_ownerElement;
77 }; 77 };
78 78
79 class ExternalPopupMenuDisplayNoneItemsTest : public testing::Test { 79 class ExternalPopupMenuDisplayNoneItemsTest : public testing::Test {
80 public: 80 public:
81 ExternalPopupMenuDisplayNoneItemsTest() { } 81 ExternalPopupMenuDisplayNoneItemsTest() { }
82 82
83 protected: 83 protected:
84 virtual void SetUp() override 84 void SetUp() override
85 { 85 {
86 m_popupMenuClient.setListSize(kListSize); 86 m_popupMenuClient.setListSize(kListSize);
87 87
88 // Set the 4th an 5th items to have "display: none" property 88 // Set the 4th an 5th items to have "display: none" property
89 m_popupMenuClient.setDisplayNoneIndex(3); 89 m_popupMenuClient.setDisplayNoneIndex(3);
90 m_popupMenuClient.setDisplayNoneIndex(4); 90 m_popupMenuClient.setDisplayNoneIndex(4);
91 91
92 OwnPtr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSiz e(800, 600)); 92 OwnPtr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSiz e(800, 600));
93 m_popupMenuClient.setOwnerElement(HTMLSelectElement::create(dummyPageHol der->document())); 93 m_popupMenuClient.setOwnerElement(HTMLSelectElement::create(dummyPageHol der->document()));
94 } 94 }
(...skipping 15 matching lines...) Expand all
110 EXPECT_EQ(4, ExternalPopupMenu::toExternalPopupMenuItemIndex(6, m_popupMenuC lient)); 110 EXPECT_EQ(4, ExternalPopupMenu::toExternalPopupMenuItemIndex(6, m_popupMenuC lient));
111 EXPECT_EQ(6, ExternalPopupMenu::toPopupMenuItemIndex(4, m_popupMenuClient)); 111 EXPECT_EQ(6, ExternalPopupMenu::toPopupMenuItemIndex(4, m_popupMenuClient));
112 112
113 // Invalid index, methods should return -1. 113 // Invalid index, methods should return -1.
114 EXPECT_EQ(-1, ExternalPopupMenu::toExternalPopupMenuItemIndex(8, m_popupMenu Client)); 114 EXPECT_EQ(-1, ExternalPopupMenu::toExternalPopupMenuItemIndex(8, m_popupMenu Client));
115 EXPECT_EQ(-1, ExternalPopupMenu::toPopupMenuItemIndex(8, m_popupMenuClient)) ; 115 EXPECT_EQ(-1, ExternalPopupMenu::toPopupMenuItemIndex(8, m_popupMenuClient)) ;
116 } 116 }
117 117
118 class ExternalPopupMenuWebFrameClient : public FrameTestHelpers::TestWebFrameCli ent { 118 class ExternalPopupMenuWebFrameClient : public FrameTestHelpers::TestWebFrameCli ent {
119 public: 119 public:
120 virtual WebExternalPopupMenu* createExternalPopupMenu(const WebPopupMenuInfo &, WebExternalPopupMenuClient*) override 120 WebExternalPopupMenu* createExternalPopupMenu(const WebPopupMenuInfo&, WebEx ternalPopupMenuClient*) override
121 { 121 {
122 return &m_mockWebExternalPopupMenu; 122 return &m_mockWebExternalPopupMenu;
123 } 123 }
124 WebRect shownBounds() const 124 WebRect shownBounds() const
125 { 125 {
126 return m_mockWebExternalPopupMenu.shownBounds(); 126 return m_mockWebExternalPopupMenu.shownBounds();
127 } 127 }
128 private: 128 private:
129 class MockWebExternalPopupMenu : public WebExternalPopupMenu { 129 class MockWebExternalPopupMenu : public WebExternalPopupMenu {
130 virtual void show(const WebRect& bounds) override 130 void show(const WebRect& bounds) override
131 { 131 {
132 m_shownBounds = bounds; 132 m_shownBounds = bounds;
133 } 133 }
134 virtual void close() override { } 134 void close() override { }
135 135
136 public: 136 public:
137 WebRect shownBounds() const 137 WebRect shownBounds() const
138 { 138 {
139 return m_shownBounds; 139 return m_shownBounds;
140 } 140 }
141 141
142 private: 142 private:
143 WebRect m_shownBounds; 143 WebRect m_shownBounds;
144 }; 144 };
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 ASSERT_TRUE(menuList->popupIsVisible()); 261 ASSERT_TRUE(menuList->popupIsVisible());
262 262
263 WebExternalPopupMenuClient* client = static_cast<ExternalPopupMenu*>(menuLis t->popup()); 263 WebExternalPopupMenuClient* client = static_cast<ExternalPopupMenu*>(menuLis t->popup());
264 WebVector<int> indices; 264 WebVector<int> indices;
265 client->didAcceptIndices(indices); 265 client->didAcceptIndices(indices);
266 EXPECT_FALSE(menuList->popupIsVisible()); 266 EXPECT_FALSE(menuList->popupIsVisible());
267 EXPECT_EQ(-1, select->selectedIndex()); 267 EXPECT_EQ(-1, select->selectedIndex());
268 } 268 }
269 269
270 } // namespace blink 270 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/ExternalPopupMenu.h ('k') | Source/web/FrameLoaderClientImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698