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

Unified Diff: content/browser/renderer_host/render_widget_host_unittest.cc

Issue 2775553002: Adds the ability for WebContentsDelegate to decide if event should be updated (Closed)
Patch Set: Fix compile Created 3 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_unittest.cc
diff --git a/content/browser/renderer_host/render_widget_host_unittest.cc b/content/browser/renderer_host/render_widget_host_unittest.cc
index 47cf95fbaac0a9f49ec6940ba8f5ab097836844b..e6da4b4c1219c21e462d8520563ba5f8c7c9607f 100644
--- a/content/browser/renderer_host/render_widget_host_unittest.cc
+++ b/content/browser/renderer_host/render_widget_host_unittest.cc
@@ -27,6 +27,7 @@
#include "content/common/input_messages.h"
#include "content/common/resize_params.h"
#include "content/common/view_messages.h"
+#include "content/public/browser/keyboard_event_processing_result.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/mock_render_process_host.h"
@@ -411,12 +412,15 @@ class MockRenderWidgetHostDelegate : public RenderWidgetHostDelegate {
}
protected:
- bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
- bool* is_keyboard_shortcut) override {
+ KeyboardEventProcessingResult PreHandleKeyboardEvent(
+ const NativeWebKeyboardEvent& event) override {
prehandle_keyboard_event_type_ = event.type();
prehandle_keyboard_event_called_ = true;
- *is_keyboard_shortcut = prehandle_keyboard_event_is_shortcut_;
- return prehandle_keyboard_event_;
+ if (prehandle_keyboard_event_)
+ return KeyboardEventProcessingResult::HANDLED;
+ return prehandle_keyboard_event_is_shortcut_
+ ? KeyboardEventProcessingResult::NOT_HANDLED_IS_SHORTCUT
+ : KeyboardEventProcessingResult::NOT_HANDLED;
}
void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) override {
@@ -569,7 +573,7 @@ class RenderWidgetHostTest : public testing::Test {
GetNextSimulatedEventTimeSeconds());
EditCommands commands;
commands.emplace_back("name", "value");
- host_->ForwardKeyboardEventWithCommands(native_event, &commands);
+ host_->ForwardKeyboardEventWithCommands(native_event, &commands, nullptr);
}
void SimulateMouseEvent(WebInputEvent::Type type) {
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.cc ('k') | content/browser/renderer_host/render_widget_host_view_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698