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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 // A collections of functions designed for use with content_browsertests and | 45 // A collections of functions designed for use with content_browsertests and |
46 // browser_tests. | 46 // browser_tests. |
47 // TO BE CLEAR: any function here must work against both binaries. If it only | 47 // TO BE CLEAR: any function here must work against both binaries. If it only |
48 // works with browser_tests, it should be in chrome\test\base\ui_test_utils.h. | 48 // works with browser_tests, it should be in chrome\test\base\ui_test_utils.h. |
49 // If it only works with content_browsertests, it should be in | 49 // If it only works with content_browsertests, it should be in |
50 // content\test\content_browser_test_utils.h. | 50 // content\test\content_browser_test_utils.h. |
51 | 51 |
52 namespace content { | 52 namespace content { |
53 | 53 |
54 class BrowserContext; | 54 class BrowserContext; |
55 class InterstitialPage; | |
mattm
2015/01/22 04:51:27
no longer needed
meacer
2015/01/22 18:31:37
Done.
| |
55 class MessageLoopRunner; | 56 class MessageLoopRunner; |
56 class RenderViewHost; | 57 class RenderViewHost; |
57 class WebContents; | 58 class WebContents; |
58 | 59 |
59 // Navigate a frame with ID |iframe_id| to |url|, blocking until the navigation | 60 // Navigate a frame with ID |iframe_id| to |url|, blocking until the navigation |
60 // finishes. Uses a renderer-initiated navigation from script code in the | 61 // finishes. Uses a renderer-initiated navigation from script code in the |
61 // main frame. | 62 // main frame. |
62 bool NavigateIframeToURL(WebContents* web_contents, | 63 bool NavigateIframeToURL(WebContents* web_contents, |
63 std::string iframe_id, | 64 std::string iframe_id, |
64 const GURL& url); | 65 const GURL& url); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
236 // Waits for an interstitial page to detach from given web contents. | 237 // Waits for an interstitial page to detach from given web contents. |
237 void WaitForInterstitialDetach(content::WebContents* web_contents); | 238 void WaitForInterstitialDetach(content::WebContents* web_contents); |
238 | 239 |
239 // Runs task and waits for an interstitial page to detach from given web | 240 // Runs task and waits for an interstitial page to detach from given web |
240 // contents. Prefer this over WaitForInterstitialDetach if web_contents may be | 241 // contents. Prefer this over WaitForInterstitialDetach if web_contents may be |
241 // destroyed by the time WaitForInterstitialDetach is called (e.g. when waiting | 242 // destroyed by the time WaitForInterstitialDetach is called (e.g. when waiting |
242 // for an interstitial detach after closing a tab). | 243 // for an interstitial detach after closing a tab). |
243 void RunTaskAndWaitForInterstitialDetach(content::WebContents* web_contents, | 244 void RunTaskAndWaitForInterstitialDetach(content::WebContents* web_contents, |
244 const base::Closure& task); | 245 const base::Closure& task); |
245 | 246 |
247 // Waits until all resources have loaded in the given RenderFrameHost. | |
248 bool WaitForRenderFrameReady(RenderFrameHost* rfh); | |
Paweł Hajdan Jr.
2015/01/22 15:43:10
nit: Please add WARN_UNUSED_RESULT.
meacer
2015/01/22 18:31:37
Done.
| |
249 | |
246 // Watches title changes on a WebContents, blocking until an expected title is | 250 // Watches title changes on a WebContents, blocking until an expected title is |
247 // set. | 251 // set. |
248 class TitleWatcher : public WebContentsObserver { | 252 class TitleWatcher : public WebContentsObserver { |
249 public: | 253 public: |
250 // |web_contents| must be non-NULL and needs to stay alive for the | 254 // |web_contents| must be non-NULL and needs to stay alive for the |
251 // entire lifetime of |this|. |expected_title| is the title that |this| | 255 // entire lifetime of |this|. |expected_title| is the title that |this| |
252 // will wait for. | 256 // will wait for. |
253 TitleWatcher(WebContents* web_contents, | 257 TitleWatcher(WebContents* web_contents, |
254 const base::string16& expected_title); | 258 const base::string16& expected_title); |
255 ~TitleWatcher() override; | 259 ~TitleWatcher() override; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
383 WebContents* web_contents_; | 387 WebContents* web_contents_; |
384 scoped_ptr<RenderViewCreatedObserver> child_observer_; | 388 scoped_ptr<RenderViewCreatedObserver> child_observer_; |
385 scoped_refptr<MessageLoopRunner> runner_; | 389 scoped_refptr<MessageLoopRunner> runner_; |
386 | 390 |
387 DISALLOW_COPY_AND_ASSIGN(WebContentsAddedObserver); | 391 DISALLOW_COPY_AND_ASSIGN(WebContentsAddedObserver); |
388 }; | 392 }; |
389 | 393 |
390 } // namespace content | 394 } // namespace content |
391 | 395 |
392 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ | 396 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
OLD | NEW |