| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "core/page/ContextMenuController.h" | 6 #include "core/page/ContextMenuController.h" |
| 7 | 7 |
| 8 #include "core/clipboard/DataTransfer.h" | 8 #include "core/clipboard/DataTransfer.h" |
| 9 #include "core/events/MouseEvent.h" | 9 #include "core/events/MouseEvent.h" |
| 10 #include "core/frame/FrameView.h" | 10 #include "core/frame/FrameView.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 private: | 35 private: |
| 36 OwnPtr<DummyPageHolder> m_pageHolder; | 36 OwnPtr<DummyPageHolder> m_pageHolder; |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 TEST_F(ContextMenuControllerTest, TestCustomMenu) | 39 TEST_F(ContextMenuControllerTest, TestCustomMenu) |
| 40 { | 40 { |
| 41 document().settings()->setScriptEnabled(true); | 41 document().settings()->setScriptEnabled(true); |
| 42 // Load the the test page. | 42 // Load the the test page. |
| 43 setBodyInnerHTML( | 43 setBodyInnerHTML( |
| 44 "<button id=\"button_id\" contextmenu=\"menu_id\" style=\"height: 100px;
width: 100px;\">" | 44 "<button id=\"button_id\" contextmenu=\"menu_id\" style=\"height: 100px;
width: 100px;\">" |
| 45 "<menu type=\"popup\" id=\"menu_id\">" | 45 "<menu type=\"context\" id=\"menu_id\">" |
| 46 "<menuitem label=\"Item1\" onclick='document.title = \"Title 1\";'>" | 46 "<menuitem label=\"Item1\" onclick='document.title = \"Title 1\";'>" |
| 47 "<menuitem label=\"Item2\" onclick='document.title = \"Title 2\";'>" | 47 "<menuitem label=\"Item2\" onclick='document.title = \"Title 2\";'>" |
| 48 "<menuitem label=\"Item3\" onclick='document.title = \"Title 3\";'>" | 48 "<menuitem label=\"Item3\" onclick='document.title = \"Title 3\";'>" |
| 49 "<menu label='Submenu'>" | 49 "<menu label='Submenu'>" |
| 50 "<menuitem label=\"Item4\" onclick='document.title = \"Title 4\";'>" | 50 "<menuitem label=\"Item4\" onclick='document.title = \"Title 4\";'>" |
| 51 "<menuitem label=\"Item5\" onclick='document.title = \"Title 5\";'>" | 51 "<menuitem label=\"Item5\" onclick='document.title = \"Title 5\";'>" |
| 52 "<menuitem label=\"Item6\" onclick='document.title = \"Title 6\";'>" | 52 "<menuitem label=\"Item6\" onclick='document.title = \"Title 6\";'>" |
| 53 "</menu>" | 53 "</menu>" |
| 54 "<menuitem id=\"item7\" type=\"checkbox\" checked label=\"Item7\"" | 54 "<menuitem id=\"item7\" type=\"checkbox\" checked label=\"Item7\"" |
| 55 "onclick='if (document.getElementById(\"item7\").hasAttribute(\"checked\
"))" | 55 "onclick='if (document.getElementById(\"item7\").hasAttribute(\"checked\
"))" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 EXPECT_STREQ("Title 7 checked", document().title().utf8().data()); | 102 EXPECT_STREQ("Title 7 checked", document().title().utf8().data()); |
| 103 document().page()->contextMenuController().contextMenuItemSelected(&items[4]
); | 103 document().page()->contextMenuController().contextMenuItemSelected(&items[4]
); |
| 104 EXPECT_STREQ("Title 7 not checked", document().title().utf8().data()); | 104 EXPECT_STREQ("Title 7 not checked", document().title().utf8().data()); |
| 105 document().page()->contextMenuController().contextMenuItemSelected(&items[5]
); | 105 document().page()->contextMenuController().contextMenuItemSelected(&items[5]
); |
| 106 EXPECT_STREQ("Title 8 not checked and Title 9 checked", document().title().u
tf8().data()); | 106 EXPECT_STREQ("Title 8 not checked and Title 9 checked", document().title().u
tf8().data()); |
| 107 document().page()->contextMenuController().contextMenuItemSelected(&items[7]
); | 107 document().page()->contextMenuController().contextMenuItemSelected(&items[7]
); |
| 108 EXPECT_STREQ("Title 10 not checked and Title 8 checked", document().title().
utf8().data()); | 108 EXPECT_STREQ("Title 10 not checked and Title 8 checked", document().title().
utf8().data()); |
| 109 } | 109 } |
| 110 | 110 |
| 111 } | 111 } |
| OLD | NEW |