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

Side by Side Diff: content/renderer/external_popup_menu_browsertest.cc

Issue 447503002: Add content browser test for <optgroup> with 'display: none' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
« no previous file with comments | « no previous file | content/renderer/render_view_impl.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/strings/utf_string_conversions.h" 5 #include "base/strings/utf_string_conversions.h"
6 #include "content/common/view_messages.h" 6 #include "content/common/view_messages.h"
7 #include "content/public/test/render_view_test.h" 7 #include "content/public/test/render_view_test.h"
8 #include "content/renderer/render_view_impl.h" 8 #include "content/renderer/render_view_impl.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "third_party/WebKit/public/web/WebView.h" 10 #include "third_party/WebKit/public/web/WebView.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 EXPECT_TRUE(SimulateElementClick(kSelectID)); 138 EXPECT_TRUE(SimulateElementClick(kSelectID));
139 139
140 // Select something, it causes the select to be removed from the page. 140 // Select something, it causes the select to be removed from the page.
141 view()->OnSelectPopupMenuItem(0); 141 view()->OnSelectPopupMenuItem(0);
142 142
143 // Just to check the soundness of the test, call SimulateElementClick again. 143 // Just to check the soundness of the test, call SimulateElementClick again.
144 // It should return false as the select has been removed. 144 // It should return false as the select has been removed.
145 EXPECT_FALSE(SimulateElementClick(kSelectID)); 145 EXPECT_FALSE(SimulateElementClick(kSelectID));
146 } 146 }
147 147
148 class ExternalPopupMenuDisplayNoneTest : public ExternalPopupMenuTest {
149 public:
150 ExternalPopupMenuDisplayNoneTest() {}
151
152 virtual void SetUp() {
153 RenderViewTest::SetUp();
154 // We need to set this explictly as RenderMain is not run.
155 blink::WebView::setUseExternalPopupMenus(true);
156
157 std::string html = "<select id='mySelect'>"
158 " <option value='zero'>zero</option>"
159 " <optgroup label='hide' style='display: none'>"
160 " <option value='one'>one</option>"
161 " </optgroup>"
162 " <option value='two'>two</option>"
163 " <option value='three'>three</option>"
164 " <option value='four'>four</option>"
165 " <option value='five'>five</option>"
166 "</select>";
167 // Load the test page.
168 LoadHTML(html.c_str());
169
170 // Set a minimum size and give focus so simulated events work.
171 view()->webwidget()->resize(blink::WebSize(500, 500));
172 view()->webwidget()->setFocus(true);
173 }
174
175 };
176
177 TEST_F(ExternalPopupMenuDisplayNoneTest, SelectItem) {
178 // Click the text field once to show the popup.
179 EXPECT_TRUE(SimulateElementClick(kSelectID));
180
181 // Select index 1 item. This should select item with index 2
182 // ,skipping the item with 'display: none'
jochen (gone - plz use gerrit) 2014/08/12 14:37:55 nit. , on end of previous line
spartha 2014/08/12 14:46:34 Done.
183 view()->OnSelectPopupMenuItem(1);
184
185 EXPECT_EQ(2,GetSelectedIndex());
186 }
187
148 } // namespace content 188 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/render_view_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698