Move InterstitialObserver and WaitForInterstitial to browser_test_utils

BUG=4086

Review URL: https://codereview.chromium.org/628433002

Cr-Commit-Position: refs/heads/master@{#298353}
diff --git a/chrome/browser/ui/browser_focus_uitest.cc b/chrome/browser/ui/browser_focus_uitest.cc
index d13fa7b..40f349a8 100644
--- a/chrome/browser/ui/browser_focus_uitest.cc
+++ b/chrome/browser/ui/browser_focus_uitest.cc
@@ -136,23 +136,6 @@
   }
 };
 
-// A helper class that waits for an interstitial page to attach.
-class WaitForInterstitial : public content::WebContentsObserver {
- public:
-  explicit WaitForInterstitial(content::WebContents* tab)
-      : WebContentsObserver(tab),
-        runner_(new content::MessageLoopRunner) {
-    runner_->Run();
-  }
-
-  virtual void DidAttachInterstitialPage() override { runner_->Quit(); }
-  virtual void DidDetachInterstitialPage() override { NOTREACHED(); }
-
- private:
-  scoped_refptr<content::MessageLoopRunner> runner_;
-  DISALLOW_COPY_AND_ASSIGN(WaitForInterstitial);
-};
-
 // A test interstitial page with typical HTML contents.
 class TestInterstitialPage : public content::InterstitialPageDelegate {
  public:
@@ -168,7 +151,8 @@
 
     // Show the interstitial and delay return until it has attached.
     interstitial_page_->Show();
-    WaitForInterstitial wait(tab);
+    content::WaitForInterstitialAttach(tab);
+
     EXPECT_TRUE(tab->ShowingInterstitialPage());
   }