Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / content / public / test / browser_test_utils.h
index 8880fda..5a0882f 100644 (file)
@@ -35,6 +35,12 @@ namespace gfx {
 class Point;
 }
 
+namespace net {
+namespace test_server {
+class EmbeddedTestServer;
+}
+}
+
 // A collections of functions designed for use with content_browsertests and
 // browser_tests.
 // TO BE CLEAR: any function here must work against both binaries. If it only
@@ -192,6 +198,27 @@ bool SetCookie(BrowserContext* browser_context,
 // the test code has been executed but before performing assertions.
 void FetchHistogramsFromChildProcesses();
 
+// Registers a request handler which redirects to a different host, based
+// on the request path. The format of the path should be
+// "/cross-site/hostname/rest/of/path" to redirect the request to
+// "<scheme>://hostname:<port>/rest/of/path", where <scheme> and <port>
+// are the values for the instance of EmbeddedTestServer.
+void SetupCrossSiteRedirector(
+    net::test_server::EmbeddedTestServer* embedded_test_server);
+
+// Waits for an interstitial page to attach to given web contents.
+void WaitForInterstitialAttach(content::WebContents* web_contents);
+
+// Waits for an interstitial page to detach from given web contents.
+void WaitForInterstitialDetach(content::WebContents* web_contents);
+
+// Runs task and waits for an interstitial page to detach from given web
+// contents. Prefer this over WaitForInterstitialDetach if web_contents may be
+// destroyed by the time WaitForInterstitialDetach is called (e.g. when waiting
+// for an interstitial detach after closing a tab).
+void RunTaskAndWaitForInterstitialDetach(content::WebContents* web_contents,
+                                         const base::Closure& task);
+
 // Watches title changes on a WebContents, blocking until an expected title is
 // set.
 class TitleWatcher : public WebContentsObserver {
@@ -201,7 +228,7 @@ class TitleWatcher : public WebContentsObserver {
   // will wait for.
   TitleWatcher(WebContents* web_contents,
                const base::string16& expected_title);
-  virtual ~TitleWatcher();
+  ~TitleWatcher() override;
 
   // Adds another title to watch for.
   void AlsoWaitForTitle(const base::string16& expected_title);
@@ -213,8 +240,8 @@ class TitleWatcher : public WebContentsObserver {
 
  private:
   // Overridden WebContentsObserver methods.
-  virtual void DidStopLoading(RenderViewHost* render_view_host) OVERRIDE;
-  virtual void TitleWasSet(NavigationEntry* entry, bool explicit_set) OVERRIDE;
+  void DidStopLoading(RenderViewHost* render_view_host) override;
+  void TitleWasSet(NavigationEntry* entry, bool explicit_set) override;
 
   void TestTitle();
 
@@ -231,14 +258,14 @@ class TitleWatcher : public WebContentsObserver {
 class WebContentsDestroyedWatcher : public WebContentsObserver {
  public:
   explicit WebContentsDestroyedWatcher(WebContents* web_contents);
-  virtual ~WebContentsDestroyedWatcher();
+  ~WebContentsDestroyedWatcher() override;
 
   // Waits until the WebContents is destroyed.
   void Wait();
 
  private:
   // Overridden WebContentsObserver methods.
-  virtual void WebContentsDestroyed() OVERRIDE;
+  void WebContentsDestroyed() override;
 
   scoped_refptr<MessageLoopRunner> message_loop_runner_;
 
@@ -257,18 +284,17 @@ class RenderProcessHostWatcher : public RenderProcessHostObserver {
                            WatchType type);
   // Waits for the render process that contains the specified web contents.
   RenderProcessHostWatcher(WebContents* web_contents, WatchType type);
-  virtual ~RenderProcessHostWatcher();
+  ~RenderProcessHostWatcher() override;
 
   // Waits until the renderer process exits.
   void Wait();
 
  private:
   // Overridden RenderProcessHost::LifecycleObserver methods.
-  virtual void RenderProcessExited(RenderProcessHost* host,
-                                   base::ProcessHandle handle,
-                                   base::TerminationStatus status,
-                                   int exit_code) OVERRIDE;
-  virtual void RenderProcessHostDestroyed(RenderProcessHost* host) OVERRIDE;
+  void RenderProcessExited(RenderProcessHost* host,
+                           base::TerminationStatus status,
+                           int exit_code) override;
+  void RenderProcessHostDestroyed(RenderProcessHost* host) override;
 
   RenderProcessHost* render_process_host_;
   WatchType type_;
@@ -286,7 +312,7 @@ class DOMMessageQueue : public NotificationObserver {
   // DOMAutomationController. Do not construct this until the browser has
   // started.
   DOMMessageQueue();
-  virtual ~DOMMessageQueue();
+  ~DOMMessageQueue() override;
 
   // Removes all messages in the message queue.
   void ClearQueue();
@@ -296,9 +322,9 @@ class DOMMessageQueue : public NotificationObserver {
   bool WaitForMessage(std::string* message) WARN_UNUSED_RESULT;
 
   // Overridden NotificationObserver methods.
-  virtual void Observe(int type,
-                       const NotificationSource& source,
-                       const NotificationDetails& details) OVERRIDE;
+  void Observe(int type,
+               const NotificationSource& source,
+               const NotificationDetails& details) override;
 
  private:
   NotificationRegistrar registrar_;