Chromium Code Reviews| 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> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/files/scoped_temp_dir.h" | 14 #include "base/files/scoped_temp_dir.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/process/process.h" | 16 #include "base/process/process.h" |
| 17 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
| 18 #include "content/public/browser/browser_message_filter.h" | 18 #include "content/public/browser/browser_message_filter.h" |
| 19 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
| 20 #include "content/public/browser/notification_registrar.h" | 20 #include "content/public/browser/notification_registrar.h" |
| 21 #include "content/public/browser/render_process_host_observer.h" | 21 #include "content/public/browser/render_process_host_observer.h" |
| 22 #include "content/public/browser/web_contents_observer.h" | 22 #include "content/public/browser/web_contents_observer.h" |
| 23 #include "content/public/common/page_type.h" | 23 #include "content/public/common/page_type.h" |
| 24 #include "net/test/embedded_test_server/embedded_test_server.h" | |
|
mmenke
2015/11/03 19:12:57
Forward declare this? Admittedly, it's a bit ugly
svaldez
2015/11/03 19:33:16
Done.
| |
| 24 #include "third_party/WebKit/public/web/WebInputEvent.h" | 25 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 25 #include "ui/events/keycodes/keyboard_codes.h" | 26 #include "ui/events/keycodes/keyboard_codes.h" |
| 26 #include "url/gurl.h" | 27 #include "url/gurl.h" |
| 27 | 28 |
| 28 #if defined(OS_WIN) | 29 #if defined(OS_WIN) |
| 29 #include "base/win/scoped_handle.h" | 30 #include "base/win/scoped_handle.h" |
| 30 #endif | 31 #endif |
| 31 | 32 |
| 32 namespace gfx { | 33 namespace gfx { |
| 33 class Point; | 34 class Point; |
| 34 } | 35 } |
| 35 | 36 |
| 36 namespace net { | |
| 37 namespace test_server { | |
| 38 class EmbeddedTestServer; | |
| 39 } | |
| 40 } | |
| 41 | |
| 42 // A collections of functions designed for use with content_browsertests and | 37 // A collections of functions designed for use with content_browsertests and |
| 43 // browser_tests. | 38 // browser_tests. |
| 44 // TO BE CLEAR: any function here must work against both binaries. If it only | 39 // TO BE CLEAR: any function here must work against both binaries. If it only |
| 45 // works with browser_tests, it should be in chrome\test\base\ui_test_utils.h. | 40 // works with browser_tests, it should be in chrome\test\base\ui_test_utils.h. |
| 46 // If it only works with content_browsertests, it should be in | 41 // If it only works with content_browsertests, it should be in |
| 47 // content\test\content_browser_test_utils.h. | 42 // content\test\content_browser_test_utils.h. |
| 48 | 43 |
| 49 namespace content { | 44 namespace content { |
| 50 | 45 |
| 51 class BrowserContext; | 46 class BrowserContext; |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 241 | 236 |
| 242 // Fetch the histograms data from other processes. This should be called after | 237 // Fetch the histograms data from other processes. This should be called after |
| 243 // the test code has been executed but before performing assertions. | 238 // the test code has been executed but before performing assertions. |
| 244 void FetchHistogramsFromChildProcesses(); | 239 void FetchHistogramsFromChildProcesses(); |
| 245 | 240 |
| 246 // Registers a request handler which redirects to a different host, based | 241 // Registers a request handler which redirects to a different host, based |
| 247 // on the request path. The format of the path should be | 242 // on the request path. The format of the path should be |
| 248 // "/cross-site/hostname/rest/of/path" to redirect the request to | 243 // "/cross-site/hostname/rest/of/path" to redirect the request to |
| 249 // "<scheme>://hostname:<port>/rest/of/path", where <scheme> and <port> | 244 // "<scheme>://hostname:<port>/rest/of/path", where <scheme> and <port> |
| 250 // are the values for the instance of EmbeddedTestServer. | 245 // are the values for the instance of EmbeddedTestServer. |
| 251 void SetupCrossSiteRedirector( | 246 void SetupCrossSiteRedirector(net::EmbeddedTestServer* embedded_test_server); |
| 252 net::test_server::EmbeddedTestServer* embedded_test_server); | |
| 253 | 247 |
| 254 // Waits for an interstitial page to attach to given web contents. | 248 // Waits for an interstitial page to attach to given web contents. |
| 255 void WaitForInterstitialAttach(content::WebContents* web_contents); | 249 void WaitForInterstitialAttach(content::WebContents* web_contents); |
| 256 | 250 |
| 257 // Waits for an interstitial page to detach from given web contents. | 251 // Waits for an interstitial page to detach from given web contents. |
| 258 void WaitForInterstitialDetach(content::WebContents* web_contents); | 252 void WaitForInterstitialDetach(content::WebContents* web_contents); |
| 259 | 253 |
| 260 // Runs task and waits for an interstitial page to detach from given web | 254 // Runs task and waits for an interstitial page to detach from given web |
| 261 // contents. Prefer this over WaitForInterstitialDetach if web_contents may be | 255 // contents. Prefer this over WaitForInterstitialDetach if web_contents may be |
| 262 // destroyed by the time WaitForInterstitialDetach is called (e.g. when waiting | 256 // destroyed by the time WaitForInterstitialDetach is called (e.g. when waiting |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 428 | 422 |
| 429 int frames_to_wait_; | 423 int frames_to_wait_; |
| 430 base::Closure quit_; | 424 base::Closure quit_; |
| 431 | 425 |
| 432 DISALLOW_COPY_AND_ASSIGN(FrameWatcher); | 426 DISALLOW_COPY_AND_ASSIGN(FrameWatcher); |
| 433 }; | 427 }; |
| 434 | 428 |
| 435 } // namespace content | 429 } // namespace content |
| 436 | 430 |
| 437 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ | 431 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
| OLD | NEW |