OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_UTILS_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_UTILS_H_ |
6 #define CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_UTILS_H_ | 6 #define CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_UTILS_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "content/public/browser/web_contents_delegate.h" | 11 #include "content/public/browser/web_contents_delegate.h" |
12 #include "content/public/common/page_type.h" | 12 #include "content/public/common/page_type.h" |
13 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class FilePath; | 17 class FilePath; |
18 } | 18 } |
19 | 19 |
20 namespace gfx { | 20 namespace gfx { |
| 21 class Point; |
| 22 class Range; |
21 class Rect; | 23 class Rect; |
22 } | 24 } |
23 | 25 |
24 // A collections of functions designed for use with content_shell based browser | 26 // A collections of functions designed for use with content_shell based browser |
25 // tests. | 27 // tests. |
26 // Note: if a function here also works with browser_tests, it should be in | 28 // Note: if a function here also works with browser_tests, it should be in |
27 // content\public\test\browser_test_utils.h | 29 // content\public\test\browser_test_utils.h |
28 | 30 |
29 namespace content { | 31 namespace content { |
30 | 32 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 std::string message_; | 138 std::string message_; |
137 | 139 |
138 // The MessageLoopRunner used to spin the message loop. | 140 // The MessageLoopRunner used to spin the message loop. |
139 scoped_refptr<MessageLoopRunner> message_loop_runner_; | 141 scoped_refptr<MessageLoopRunner> message_loop_runner_; |
140 | 142 |
141 DISALLOW_COPY_AND_ASSIGN(ConsoleObserverDelegate); | 143 DISALLOW_COPY_AND_ASSIGN(ConsoleObserverDelegate); |
142 }; | 144 }; |
143 | 145 |
144 #if defined OS_MACOSX | 146 #if defined OS_MACOSX |
145 void SetWindowBounds(gfx::NativeWindow window, const gfx::Rect& bounds); | 147 void SetWindowBounds(gfx::NativeWindow window, const gfx::Rect& bounds); |
| 148 |
| 149 // This method will request the string (word) at |point| inside the |rwh| where |
| 150 // |point| is with respect to the |rwh| coordinates. |result_callback| is called |
| 151 // with the word as well as |baselinePoint| when the result comes back from the |
| 152 // renderer. The baseline point is the position of the pop-up in AppKit |
| 153 // coordinate system (inverted y-axis). |
| 154 void GetStringAtPointForRenderWidget( |
| 155 RenderWidgetHost* rwh, |
| 156 const gfx::Point& point, |
| 157 base::Callback<void(const std::string&, const gfx::Point&)> |
| 158 result_callback); |
| 159 |
| 160 // This method will request the string identified by |range| inside the |rwh|. |
| 161 // When the result comes back, |result_callback| is invoked with the given text |
| 162 // and its position in AppKit coordinates (inverted-y axis). |
| 163 void GetStringFromRangeForRenderWidget( |
| 164 RenderWidgetHost* rwh, |
| 165 const gfx::Range& range, |
| 166 base::Callback<void(const std::string&, const gfx::Point&)> |
| 167 result_callback); |
| 168 |
146 #endif | 169 #endif |
147 | 170 |
148 } // namespace content | 171 } // namespace content |
149 | 172 |
150 #endif // CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_UTILS_H_ | 173 #endif // CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_UTILS_H_ |
OLD | NEW |