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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 // A collections of functions designed for use with content_browsertests and | 36 // A collections of functions designed for use with content_browsertests and |
37 // browser_tests. | 37 // browser_tests. |
38 // TO BE CLEAR: any function here must work against both binaries. If it only | 38 // TO BE CLEAR: any function here must work against both binaries. If it only |
39 // works with browser_tests, it should be in chrome\test\base\ui_test_utils.h. | 39 // works with browser_tests, it should be in chrome\test\base\ui_test_utils.h. |
40 // If it only works with content_browsertests, it should be in | 40 // If it only works with content_browsertests, it should be in |
41 // content\test\content_browser_test_utils.h. | 41 // content\test\content_browser_test_utils.h. |
42 | 42 |
43 namespace content { | 43 namespace content { |
44 | 44 |
| 45 class BrowserContext; |
45 class MessageLoopRunner; | 46 class MessageLoopRunner; |
46 class RenderViewHost; | 47 class RenderViewHost; |
47 class WebContents; | 48 class WebContents; |
48 | 49 |
49 // Generate a URL for a file path including a query string. | 50 // Generate a URL for a file path including a query string. |
50 GURL GetFileUrlWithQuery(const FilePath& path, const std::string& query_string); | 51 GURL GetFileUrlWithQuery(const FilePath& path, const std::string& query_string); |
51 | 52 |
52 // Waits for a load stop for the specified |web_contents|'s controller, if the | 53 // Waits for a load stop for the specified |web_contents|'s controller, if the |
53 // tab is currently web_contents. Otherwise returns immediately. | 54 // tab is currently web_contents. Otherwise returns immediately. |
54 void WaitForLoadStop(WebContents* web_contents); | 55 void WaitForLoadStop(WebContents* web_contents); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 bool ExecuteJavaScriptAndExtractBool(RenderViewHost* render_view_host, | 94 bool ExecuteJavaScriptAndExtractBool(RenderViewHost* render_view_host, |
94 const std::wstring& frame_xpath, | 95 const std::wstring& frame_xpath, |
95 const std::wstring& script, | 96 const std::wstring& script, |
96 bool* result) WARN_UNUSED_RESULT; | 97 bool* result) WARN_UNUSED_RESULT; |
97 bool ExecuteJavaScriptAndExtractString( | 98 bool ExecuteJavaScriptAndExtractString( |
98 RenderViewHost* render_view_host, | 99 RenderViewHost* render_view_host, |
99 const std::wstring& frame_xpath, | 100 const std::wstring& frame_xpath, |
100 const std::wstring& script, | 101 const std::wstring& script, |
101 std::string* result) WARN_UNUSED_RESULT; | 102 std::string* result) WARN_UNUSED_RESULT; |
102 | 103 |
| 104 // Returns the cookies for the given url. Runs a nested message loop. |
| 105 std::string GetCookies(BrowserContext* browser_context, const GURL& url); |
| 106 |
103 // Watches title changes on a tab, blocking until an expected title is set. | 107 // Watches title changes on a tab, blocking until an expected title is set. |
104 class TitleWatcher : public NotificationObserver { | 108 class TitleWatcher : public NotificationObserver { |
105 public: | 109 public: |
106 // |web_contents| must be non-NULL and needs to stay alive for the | 110 // |web_contents| must be non-NULL and needs to stay alive for the |
107 // entire lifetime of |this|. |expected_title| is the title that |this| | 111 // entire lifetime of |this|. |expected_title| is the title that |this| |
108 // will wait for. | 112 // will wait for. |
109 TitleWatcher(WebContents* web_contents, | 113 TitleWatcher(WebContents* web_contents, |
110 const string16& expected_title); | 114 const string16& expected_title); |
111 virtual ~TitleWatcher(); | 115 virtual ~TitleWatcher(); |
112 | 116 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 | 202 |
199 // If the python websocket server serves with TLS. | 203 // If the python websocket server serves with TLS. |
200 bool secure_; | 204 bool secure_; |
201 | 205 |
202 DISALLOW_COPY_AND_ASSIGN(TestWebSocketServer); | 206 DISALLOW_COPY_AND_ASSIGN(TestWebSocketServer); |
203 }; | 207 }; |
204 | 208 |
205 } // namespace content | 209 } // namespace content |
206 | 210 |
207 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ | 211 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
OLD | NEW |