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

Side by Side Diff: third_party/WebKit/Source/core/page/ContextMenuControllerTest.cpp

Issue 1654653002: Canvas2d: Implement rerouting event by hit region's control. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix bot errors Created 4 years, 9 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
OLDNEW
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 "document.title = \"Title 9 checked\"; else document.title = \"Title 9 n ot checked\";'>" 62 "document.title = \"Title 9 checked\"; else document.title = \"Title 9 n ot checked\";'>"
63 "<menuitem id=\"item10\" type=\"radio\" radiogroup=\"group\" label=\"Ite m10\"" 63 "<menuitem id=\"item10\" type=\"radio\" radiogroup=\"group\" label=\"Ite m10\""
64 "onclick='if (document.getElementById(\"item10\").hasAttribute(\"checked \"))" 64 "onclick='if (document.getElementById(\"item10\").hasAttribute(\"checked \"))"
65 "document.title = \"Title 10 checked\"; else if (document.getElementById (\"item8\").hasAttribute(\"checked\"))" 65 "document.title = \"Title 10 checked\"; else if (document.getElementById (\"item8\").hasAttribute(\"checked\"))"
66 "document.title = \"Title 10 not checked and Title 8 checked\";'>" 66 "document.title = \"Title 10 not checked and Title 8 checked\";'>"
67 "</menu>" 67 "</menu>"
68 "</button>"); 68 "</button>");
69 69
70 // Create right button click event and pass it to context menu controller. 70 // Create right button click event and pass it to context menu controller.
71 RefPtrWillBeRawPtr<Event> event = MouseEvent::create(EventTypeNames::click, false, false, 71 RefPtrWillBeRawPtr<Event> event = MouseEvent::create(EventTypeNames::click, false, false,
72 document().domWindow(), 50, 50, 0, 0, 0, 0, 0, PlatformEvent::NoModifier s, 1, 0, nullptr, 0); 72 document().domWindow(), 50, 50, 0, 0, 0, 0, 0, PlatformEvent::NoModifier s, 1, 0, nullptr, 0,
73 PlatformMouseEvent::RealOrIndistinguishable, String());
73 document().getElementById("button_id")->focus(); 74 document().getElementById("button_id")->focus();
74 event->setTarget(document().getElementById("button_id")); 75 event->setTarget(document().getElementById("button_id"));
75 document().page()->contextMenuController().handleContextMenuEvent(event.get( )); 76 document().page()->contextMenuController().handleContextMenuEvent(event.get( ));
76 77
77 // Item 1 78 // Item 1
78 // Item 2 79 // Item 2
79 // Item 3 80 // Item 3
80 // Submenu > Item 4 81 // Submenu > Item 4
81 // Item 5 82 // Item 5
82 // Item 6 83 // Item 6
(...skipping 18 matching lines...) Expand all
101 EXPECT_STREQ("Title 7 checked", document().title().utf8().data()); 102 EXPECT_STREQ("Title 7 checked", document().title().utf8().data());
102 document().page()->contextMenuController().contextMenuItemSelected(&items[4] ); 103 document().page()->contextMenuController().contextMenuItemSelected(&items[4] );
103 EXPECT_STREQ("Title 7 not checked", document().title().utf8().data()); 104 EXPECT_STREQ("Title 7 not checked", document().title().utf8().data());
104 document().page()->contextMenuController().contextMenuItemSelected(&items[5] ); 105 document().page()->contextMenuController().contextMenuItemSelected(&items[5] );
105 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());
106 document().page()->contextMenuController().contextMenuItemSelected(&items[7] ); 107 document().page()->contextMenuController().contextMenuItemSelected(&items[7] );
107 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());
108 } 109 }
109 110
110 } // namespace blink 111 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698