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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 "document.title = \"Title 9 checked\"; else document.title = \"Title 9 n
ot checked\";'>" | 63 "document.title = \"Title 9 checked\"; else document.title = \"Title 9 n
ot checked\";'>" |
64 "<menuitem id=\"item10\" type=\"radio\" radiogroup=\"group\" label=\"Ite
m10\"" | 64 "<menuitem id=\"item10\" type=\"radio\" radiogroup=\"group\" label=\"Ite
m10\"" |
65 "onclick='if (document.getElementById(\"item10\").hasAttribute(\"checked
\"))" | 65 "onclick='if (document.getElementById(\"item10\").hasAttribute(\"checked
\"))" |
66 "document.title = \"Title 10 checked\"; else if (document.getElementById
(\"item8\").hasAttribute(\"checked\"))" | 66 "document.title = \"Title 10 checked\"; else if (document.getElementById
(\"item8\").hasAttribute(\"checked\"))" |
67 "document.title = \"Title 10 not checked and Title 8 checked\";'>" | 67 "document.title = \"Title 10 not checked and Title 8 checked\";'>" |
68 "</menu>" | 68 "</menu>" |
69 "</button>"); | 69 "</button>"); |
70 | 70 |
71 // Create right button click event and pass it to context menu controller. | 71 // Create right button click event and pass it to context menu controller. |
72 RefPtrWillBeRawPtr<Event> event = MouseEvent::create(EventTypeNames::click,
false, false, | 72 RefPtrWillBeRawPtr<Event> event = MouseEvent::create(EventTypeNames::click,
false, false, |
73 document().domWindow(), 50, 50, 0, 0, 0, 0, 0, false, false, false, fals
e, 1, 0, nullptr, nullptr); | 73 document().domWindow(), 50, 50, 0, 0, 0, 0, 0, false, false, false, fals
e, 1, 0, nullptr); |
74 document().getElementById("button_id")->focus(); | 74 document().getElementById("button_id")->focus(); |
75 event->setTarget(document().getElementById("button_id")); | 75 event->setTarget(document().getElementById("button_id")); |
76 document().page()->contextMenuController().handleContextMenuEvent(event.get(
)); | 76 document().page()->contextMenuController().handleContextMenuEvent(event.get(
)); |
77 | 77 |
78 // Item 1 | 78 // Item 1 |
79 // Item 2 | 79 // Item 2 |
80 // Item 3 | 80 // Item 3 |
81 // Submenu > Item 4 | 81 // Submenu > Item 4 |
82 // Item 5 | 82 // Item 5 |
83 // Item 6 | 83 // Item 6 |
(...skipping 18 matching lines...) Expand all 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 |