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_BROWSER_TEST_UTILS_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
6 #define CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ | 6 #define CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 bool ExecuteScriptAndExtractInt(const ToRenderFrameHost& adapter, | 187 bool ExecuteScriptAndExtractInt(const ToRenderFrameHost& adapter, |
188 const std::string& script, | 188 const std::string& script, |
189 int* result) WARN_UNUSED_RESULT; | 189 int* result) WARN_UNUSED_RESULT; |
190 bool ExecuteScriptAndExtractBool(const ToRenderFrameHost& adapter, | 190 bool ExecuteScriptAndExtractBool(const ToRenderFrameHost& adapter, |
191 const std::string& script, | 191 const std::string& script, |
192 bool* result) WARN_UNUSED_RESULT; | 192 bool* result) WARN_UNUSED_RESULT; |
193 bool ExecuteScriptAndExtractString(const ToRenderFrameHost& adapter, | 193 bool ExecuteScriptAndExtractString(const ToRenderFrameHost& adapter, |
194 const std::string& script, | 194 const std::string& script, |
195 std::string* result) WARN_UNUSED_RESULT; | 195 std::string* result) WARN_UNUSED_RESULT; |
196 | 196 |
197 // This function behaves similarly to ExecuteScriptAndExtractBool but runs the | |
198 // the script in the specified isolated world. | |
199 bool ExecuteScriptInIsolatedWorldAndExtractBool( | |
200 const ToRenderFrameHost& adapter, | |
201 const int world_id, | |
202 const std::string& script, | |
203 bool* result) WARN_UNUSED_RESULT; | |
204 | |
205 // Walks the frame tree of the specified WebContents and returns the sole frame | 197 // Walks the frame tree of the specified WebContents and returns the sole frame |
206 // that matches the specified predicate function. This function will DCHECK if | 198 // that matches the specified predicate function. This function will DCHECK if |
207 // no frames match the specified predicate, or if more than one frame matches. | 199 // no frames match the specified predicate, or if more than one frame matches. |
208 RenderFrameHost* FrameMatchingPredicate( | 200 RenderFrameHost* FrameMatchingPredicate( |
209 WebContents* web_contents, | 201 WebContents* web_contents, |
210 const base::Callback<bool(RenderFrameHost*)>& predicate); | 202 const base::Callback<bool(RenderFrameHost*)>& predicate); |
211 | 203 |
212 // Predicates for use with FrameMatchingPredicate. | 204 // Predicates for use with FrameMatchingPredicate. |
213 bool FrameMatchesName(const std::string& name, RenderFrameHost* frame); | 205 bool FrameMatchesName(const std::string& name, RenderFrameHost* frame); |
214 bool FrameIsChildOfMainFrame(RenderFrameHost* frame); | 206 bool FrameIsChildOfMainFrame(RenderFrameHost* frame); |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 | 410 |
419 int frames_to_wait_; | 411 int frames_to_wait_; |
420 base::Closure quit_; | 412 base::Closure quit_; |
421 | 413 |
422 DISALLOW_COPY_AND_ASSIGN(FrameWatcher); | 414 DISALLOW_COPY_AND_ASSIGN(FrameWatcher); |
423 }; | 415 }; |
424 | 416 |
425 } // namespace content | 417 } // namespace content |
426 | 418 |
427 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ | 419 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
OLD | NEW |