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

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

Issue 475733002: Test case modified to check against the item count in ExternalPopupMenu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Mac Build Created 6 years, 3 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 | no next file » | 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/frame_messages.h" 6 #include "content/common/frame_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_frame_impl.h" 8 #include "content/renderer/render_frame_impl.h"
9 #include "content/renderer/render_view_impl.h" 9 #include "content/renderer/render_view_impl.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 LoadHTML(html.c_str()); 173 LoadHTML(html.c_str());
174 174
175 // Set a minimum size and give focus so simulated events work. 175 // Set a minimum size and give focus so simulated events work.
176 view()->webwidget()->resize(blink::WebSize(500, 500)); 176 view()->webwidget()->resize(blink::WebSize(500, 500));
177 view()->webwidget()->setFocus(true); 177 view()->webwidget()->setFocus(true);
178 } 178 }
179 179
180 }; 180 };
181 181
182 TEST_F(ExternalPopupMenuDisplayNoneTest, SelectItem) { 182 TEST_F(ExternalPopupMenuDisplayNoneTest, SelectItem) {
183 IPC::TestSink& sink = render_thread_->sink();
184
183 // Click the text field once to show the popup. 185 // Click the text field once to show the popup.
184 EXPECT_TRUE(SimulateElementClick(kSelectID)); 186 EXPECT_TRUE(SimulateElementClick(kSelectID));
185 187
188 // Read the message sent to browser to show the popup menu.
189 const IPC::Message* message =
190 sink.GetUniqueMessageMatching(FrameHostMsg_ShowPopup::ID);
191 ASSERT_TRUE(message != NULL);
192 Tuple1<FrameHostMsg_ShowPopup_Params> param;
193 FrameHostMsg_ShowPopup::Read(message, &param);
194 // Number of items should match item count minus the number
195 // of "display: none" items.
196 ASSERT_EQ(5U, param.a.popup_items.size());
197
186 // Select index 1 item. This should select item with index 2, 198 // Select index 1 item. This should select item with index 2,
187 // skipping the item with 'display: none' 199 // skipping the item with 'display: none'
188 frame()->OnSelectPopupMenuItem(1); 200 frame()->OnSelectPopupMenuItem(1);
189 201
190 EXPECT_EQ(2, GetSelectedIndex()); 202 EXPECT_EQ(2, GetSelectedIndex());
191 } 203 }
192 204
193 } // namespace content 205 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698