| Index: content/renderer/external_popup_menu_browsertest.cc
|
| diff --git a/content/renderer/external_popup_menu_browsertest.cc b/content/renderer/external_popup_menu_browsertest.cc
|
| index c29306c44edae1fbdd09b3a411631f760dc1af74..f17971c3c8f9ba75263cda098ebccd7721736dcf 100644
|
| --- a/content/renderer/external_popup_menu_browsertest.cc
|
| +++ b/content/renderer/external_popup_menu_browsertest.cc
|
| @@ -3,8 +3,9 @@
|
| // found in the LICENSE file.
|
|
|
| #include "base/strings/utf_string_conversions.h"
|
| -#include "content/common/view_messages.h"
|
| +#include "content/common/frame_messages.h"
|
| #include "content/public/test/render_view_test.h"
|
| +#include "content/renderer/render_frame_impl.h"
|
| #include "content/renderer/render_view_impl.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| #include "third_party/WebKit/public/web/WebView.h"
|
| @@ -28,6 +29,10 @@ class ExternalPopupMenuTest : public RenderViewTest {
|
| return static_cast<RenderViewImpl*>(view_);
|
| }
|
|
|
| + RenderFrameImpl* frame() {
|
| + return view()->main_render_frame();
|
| + }
|
| +
|
| virtual void SetUp() {
|
| RenderViewTest::SetUp();
|
| // We need to set this explictly as RenderMain is not run.
|
| @@ -79,28 +84,28 @@ TEST_F(ExternalPopupMenuTest, NormalCase) {
|
|
|
| // We should have sent a message to the browser to show the popup menu.
|
| const IPC::Message* message =
|
| - sink.GetUniqueMessageMatching(ViewHostMsg_ShowPopup::ID);
|
| + sink.GetUniqueMessageMatching(FrameHostMsg_ShowPopup::ID);
|
| ASSERT_TRUE(message != NULL);
|
| - Tuple1<ViewHostMsg_ShowPopup_Params> param;
|
| - ViewHostMsg_ShowPopup::Read(message, ¶m);
|
| + Tuple1<FrameHostMsg_ShowPopup_Params> param;
|
| + FrameHostMsg_ShowPopup::Read(message, ¶m);
|
| ASSERT_EQ(3U, param.a.popup_items.size());
|
| EXPECT_EQ(1, param.a.selected_item);
|
|
|
| - // Simulate the user canceling the popup, the index should not have changed.
|
| - view()->OnSelectPopupMenuItem(-1);
|
| + // Simulate the user canceling the popup; the index should not have changed.
|
| + frame()->OnSelectPopupMenuItem(-1);
|
| EXPECT_EQ(1, GetSelectedIndex());
|
|
|
| // Show the pop-up again and this time make a selection.
|
| EXPECT_TRUE(SimulateElementClick(kSelectID));
|
| - view()->OnSelectPopupMenuItem(0);
|
| + frame()->OnSelectPopupMenuItem(0);
|
| EXPECT_EQ(0, GetSelectedIndex());
|
|
|
| // Show the pop-up again and make another selection.
|
| sink.ClearMessages();
|
| EXPECT_TRUE(SimulateElementClick(kSelectID));
|
| - message = sink.GetUniqueMessageMatching(ViewHostMsg_ShowPopup::ID);
|
| + message = sink.GetUniqueMessageMatching(FrameHostMsg_ShowPopup::ID);
|
| ASSERT_TRUE(message != NULL);
|
| - ViewHostMsg_ShowPopup::Read(message, ¶m);
|
| + FrameHostMsg_ShowPopup::Read(message, ¶m);
|
| ASSERT_EQ(3U, param.a.popup_items.size());
|
| EXPECT_EQ(0, param.a.selected_item);
|
| }
|
| @@ -114,7 +119,7 @@ TEST_F(ExternalPopupMenuTest, ShowPopupThenNavigate) {
|
| LoadHTML("<blink>Awesome page!</blink>");
|
|
|
| // Now the user selects something, we should not crash.
|
| - view()->OnSelectPopupMenuItem(-1);
|
| + frame()->OnSelectPopupMenuItem(-1);
|
| }
|
|
|
| // An empty select should not cause a crash when clicked.
|
| @@ -138,7 +143,7 @@ TEST_F(ExternalPopupMenuRemoveTest, RemoveOnChange) {
|
| EXPECT_TRUE(SimulateElementClick(kSelectID));
|
|
|
| // Select something, it causes the select to be removed from the page.
|
| - view()->OnSelectPopupMenuItem(0);
|
| + frame()->OnSelectPopupMenuItem(0);
|
|
|
| // Just to check the soundness of the test, call SimulateElementClick again.
|
| // It should return false as the select has been removed.
|
| @@ -180,9 +185,9 @@ TEST_F(ExternalPopupMenuDisplayNoneTest, SelectItem) {
|
|
|
| // Select index 1 item. This should select item with index 2,
|
| // skipping the item with 'display: none'
|
| - view()->OnSelectPopupMenuItem(1);
|
| + frame()->OnSelectPopupMenuItem(1);
|
|
|
| - EXPECT_EQ(2,GetSelectedIndex());
|
| + EXPECT_EQ(2, GetSelectedIndex());
|
| }
|
|
|
| } // namespace content
|
|
|