| 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 "core/page/ContextMenuController.h" | 5 #include "core/page/ContextMenuController.h" | 
| 6 | 6 | 
| 7 #include "core/clipboard/DataTransfer.h" | 7 #include "core/clipboard/DataTransfer.h" | 
| 8 #include "core/events/MouseEvent.h" | 8 #include "core/events/MouseEvent.h" | 
| 9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" | 
| 10 #include "core/frame/Settings.h" | 10 #include "core/frame/Settings.h" | 
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 72       "(document.getElementById(\"item10\").hasAttribute(\"checked\"))" | 72       "(document.getElementById(\"item10\").hasAttribute(\"checked\"))" | 
| 73       "document.title = \"Title 10 checked\"; else if " | 73       "document.title = \"Title 10 checked\"; else if " | 
| 74       "(document.getElementById(\"item8\").hasAttribute(\"checked\"))" | 74       "(document.getElementById(\"item8\").hasAttribute(\"checked\"))" | 
| 75       "document.title = \"Title 10 not checked and Title 8 checked\";'>" | 75       "document.title = \"Title 10 not checked and Title 8 checked\";'>" | 
| 76       "</menu>" | 76       "</menu>" | 
| 77       "</button>"); | 77       "</button>"); | 
| 78 | 78 | 
| 79   // Create right button click event and pass it to context menu controller. | 79   // Create right button click event and pass it to context menu controller. | 
| 80   Event* event = MouseEvent::create( | 80   Event* event = MouseEvent::create( | 
| 81       EventTypeNames::click, false, false, document().domWindow(), 50, 50, 0, 0, | 81       EventTypeNames::click, false, false, document().domWindow(), 50, 50, 0, 0, | 
| 82       0, 0, 0, PlatformEvent::NoModifiers, 1, 0, nullptr, 0, | 82       0, 0, 0, PlatformEvent::NoModifiers, 1, 0, nullptr, TimeTicks(), | 
| 83       PlatformMouseEvent::RealOrIndistinguishable, String(), nullptr); | 83       PlatformMouseEvent::RealOrIndistinguishable, String(), nullptr); | 
| 84   document().getElementById("button_id")->focus(); | 84   document().getElementById("button_id")->focus(); | 
| 85   event->setTarget(document().getElementById("button_id")); | 85   event->setTarget(document().getElementById("button_id")); | 
| 86   document().page()->contextMenuController().handleContextMenuEvent(event); | 86   document().page()->contextMenuController().handleContextMenuEvent(event); | 
| 87 | 87 | 
| 88   // Item 1 | 88   // Item 1 | 
| 89   // Item 2 | 89   // Item 2 | 
| 90   // Item 3 | 90   // Item 3 | 
| 91   // Submenu > Item 4 | 91   // Submenu > Item 4 | 
| 92   //           Item 5 | 92   //           Item 5 | 
| (...skipping 23 matching lines...) Expand all  Loading... | 
| 116   EXPECT_STREQ("Title 7 not checked", document().title().utf8().data()); | 116   EXPECT_STREQ("Title 7 not checked", document().title().utf8().data()); | 
| 117   document().page()->contextMenuController().contextMenuItemSelected(&items[5]); | 117   document().page()->contextMenuController().contextMenuItemSelected(&items[5]); | 
| 118   EXPECT_STREQ("Title 8 not checked and Title 9 checked", | 118   EXPECT_STREQ("Title 8 not checked and Title 9 checked", | 
| 119                document().title().utf8().data()); | 119                document().title().utf8().data()); | 
| 120   document().page()->contextMenuController().contextMenuItemSelected(&items[7]); | 120   document().page()->contextMenuController().contextMenuItemSelected(&items[7]); | 
| 121   EXPECT_STREQ("Title 10 not checked and Title 8 checked", | 121   EXPECT_STREQ("Title 10 not checked and Title 8 checked", | 
| 122                document().title().utf8().data()); | 122                document().title().utf8().data()); | 
| 123 } | 123 } | 
| 124 | 124 | 
| 125 }  // namespace blink | 125 }  // namespace blink | 
| OLD | NEW | 
|---|