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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 const std::vector<int>& js_resource_ids); | 181 const std::vector<int>& js_resource_ids); |
182 | 182 |
183 // Returns the cookies for the given url. | 183 // Returns the cookies for the given url. |
184 std::string GetCookies(BrowserContext* browser_context, const GURL& url); | 184 std::string GetCookies(BrowserContext* browser_context, const GURL& url); |
185 | 185 |
186 // Sets a cookie for the given url. Returns true on success. | 186 // Sets a cookie for the given url. Returns true on success. |
187 bool SetCookie(BrowserContext* browser_context, | 187 bool SetCookie(BrowserContext* browser_context, |
188 const GURL& url, | 188 const GURL& url, |
189 const std::string& value); | 189 const std::string& value); |
190 | 190 |
| 191 // Fetch the histograms data from other processes. This should be called after |
| 192 // the test code has been executed but before performing assertions. |
| 193 void FetchHistogramsFromChildProcesses(); |
| 194 |
191 // Watches title changes on a WebContents, blocking until an expected title is | 195 // Watches title changes on a WebContents, blocking until an expected title is |
192 // set. | 196 // set. |
193 class TitleWatcher : public WebContentsObserver { | 197 class TitleWatcher : public WebContentsObserver { |
194 public: | 198 public: |
195 // |web_contents| must be non-NULL and needs to stay alive for the | 199 // |web_contents| must be non-NULL and needs to stay alive for the |
196 // entire lifetime of |this|. |expected_title| is the title that |this| | 200 // entire lifetime of |this|. |expected_title| is the title that |this| |
197 // will wait for. | 201 // will wait for. |
198 TitleWatcher(WebContents* web_contents, | 202 TitleWatcher(WebContents* web_contents, |
199 const base::string16& expected_title); | 203 const base::string16& expected_title); |
200 virtual ~TitleWatcher(); | 204 virtual ~TitleWatcher(); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 NotificationRegistrar registrar_; | 304 NotificationRegistrar registrar_; |
301 std::queue<std::string> message_queue_; | 305 std::queue<std::string> message_queue_; |
302 scoped_refptr<MessageLoopRunner> message_loop_runner_; | 306 scoped_refptr<MessageLoopRunner> message_loop_runner_; |
303 | 307 |
304 DISALLOW_COPY_AND_ASSIGN(DOMMessageQueue); | 308 DISALLOW_COPY_AND_ASSIGN(DOMMessageQueue); |
305 }; | 309 }; |
306 | 310 |
307 } // namespace content | 311 } // namespace content |
308 | 312 |
309 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ | 313 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
OLD | NEW |