Index: content/public/test/content_browser_test_utils_mac.mm |
diff --git a/content/public/test/content_browser_test_utils_mac.mm b/content/public/test/content_browser_test_utils_mac.mm |
index d2e879cfa3526bdd20a88b0a5625c60feaa9a15f..da54e5735de8ef6fc4b9e6b0104b2a0935a20a07 100644 |
--- a/content/public/test/content_browser_test_utils_mac.mm |
+++ b/content/public/test/content_browser_test_utils_mac.mm |
@@ -7,7 +7,11 @@ |
#include <Carbon/Carbon.h> |
#import <Cocoa/Cocoa.h> |
+#include "content/browser/renderer_host/text_input_client_mac.h" |
+#include "content/public/browser/render_widget_host.h" |
+#include "ui/gfx/geometry/point.h" |
#include "ui/gfx/geometry/rect.h" |
+#include "ui/gfx/range/range.h" |
namespace content { |
@@ -22,4 +26,29 @@ void SetWindowBounds(gfx::NativeWindow window, const gfx::Rect& bounds) { |
[window setFrame:new_bounds display:NO]; |
} |
+void GetStringAtPointForRenderWidget( |
+ RenderWidgetHost* rwh, |
+ const gfx::Point& point, |
+ base::Callback<void(const std::string&, const gfx::Point&)> |
+ result_callback) { |
+ TextInputClientMac::GetInstance()->GetStringAtPoint( |
+ rwh, point, ^(NSAttributedString* string, NSPoint baselinePoint) { |
+ result_callback.Run([[string string] UTF8String], |
+ gfx::Point(baselinePoint.x, baselinePoint.y)); |
+ }); |
+} |
+ |
+void GetStringFromRangeForRenderWidget( |
+ RenderWidgetHost* rwh, |
+ const gfx::Range& range, |
+ base::Callback<void(const std::string&, const gfx::Point&)> |
+ result_callback) { |
+ TextInputClientMac::GetInstance()->GetStringFromRange( |
+ rwh, range.ToNSRange(), |
+ ^(NSAttributedString* string, NSPoint baselinePoint) { |
+ result_callback.Run([[string string] UTF8String], |
+ gfx::Point(baselinePoint.x, baselinePoint.y)); |
+ }); |
+} |
+ |
} // namespace content |