Index: content/public/test/text_input_test_utils.h |
diff --git a/content/public/test/text_input_test_utils.h b/content/public/test/text_input_test_utils.h |
index 7785b671b3ee5b59db9511858d2cf49d7ce3f5d1..080d0fa07a85798e1111abfc4cb0fa2bb155da38 100644 |
--- a/content/public/test/text_input_test_utils.h |
+++ b/content/public/test/text_input_test_utils.h |
@@ -13,6 +13,14 @@ |
#include "ui/base/ime/text_input_mode.h" |
#include "ui/base/ime/text_input_type.h" |
+#ifdef OS_MACOSX |
+#include "content/public/browser/browser_message_filter.h" |
+#endif |
+ |
+namespace ipc { |
+class Message; |
+} |
+ |
namespace gfx { |
class Range; |
} |
@@ -23,6 +31,8 @@ struct CompositionUnderline; |
namespace content { |
+class MessageLoopRunner; |
+class RenderProcessHost; |
class RenderWidgetHost; |
class RenderWidgetHostView; |
class RenderWidgetHostViewBase; |
@@ -180,6 +190,48 @@ class TestInputMethodObserver { |
TestInputMethodObserver(); |
}; |
+#ifdef OS_MACOSX |
+// The test message filter for TextInputClientMac incoming messages from the |
+// renderer. |
+// NOTE: This filter should be added to the intended RenderProcessHost before |
+// the actual TextInputClientMessageFilter, otherwise, the messages |
+// will be handled and will never receive this filter. |
+class TestTextInputClientMessageFilter : public BrowserMessageFilter { |
+ public: |
+ // Creates the filter and adds itself to |host|. |
+ TestTextInputClientMessageFilter(RenderProcessHost* host); |
+ |
+ // Wait until the IPC TextInputClientReplyMsg_GotStringForRange arrives. |
+ void WaitForStringFromRange(); |
+ |
+ // BrowserMessageFilter overrides. |
+ bool OnMessageReceived(const IPC::Message& message) override; |
+ |
+ RenderProcessHost* process() const { return host_; } |
+ std::string string_from_range() { return string_from_range_; } |
+ |
+ private: |
+ ~TestTextInputClientMessageFilter() override; |
+ RenderProcessHost* const host_; |
+ std::string string_from_range_; |
+ bool received_string_from_range_; |
+ scoped_refptr<MessageLoopRunner> message_loop_runner_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(TestTextInputClientMessageFilter); |
+}; |
+ |
+// Requests the |tab_view| for the definition of the word identified by the |
+// given selection range. |range| identifies a word in the focused |
+// RenderWidgetHost underneath |tab_view| which may be different than the |
+// RenderWidgetHost corresponding to |tab_view|. |
+void AskForLookUpDictionaryForRange(RenderWidgetHostView* tab_view, |
+ const gfx::Range& range); |
+ |
+// Returns the total count of NSWindows instances which belong to the currently |
+// running NSApplication. |
+size_t GetOpenNSWindowsCount(); |
+#endif |
+ |
} // namespace content |
#endif // CONTENT_PUBLIC_TEST_TEXT_INPUT_TEST_UTILS_H_ |