| Index: chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
|
| ===================================================================
|
| --- chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc (revision 120576)
|
| +++ chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc (working copy)
|
| @@ -21,6 +21,7 @@
|
| #include "chrome/test/base/in_process_browser_test.h"
|
| #include "chrome/test/base/ui_test_utils.h"
|
| #include "content/browser/renderer_host/resource_dispatcher_host.h"
|
| +#include "content/browser/tab_contents/interstitial_page.h"
|
| #include "content/public/browser/navigation_controller.h"
|
| #include "content/public/browser/web_contents.h"
|
| #include "content/public/browser/web_contents_view.h"
|
| @@ -264,21 +265,22 @@
|
| service->AddURLResult(url, checkresult);
|
| }
|
|
|
| - void SendCommand(const std::string& command) {
|
| - WebContents* contents =
|
| - browser()->GetSelectedTabContentsWrapper()->web_contents();
|
| + TestSafeBrowsingBlockingPage* GetSafeBrowsingBlockingPage() {
|
| // We use InterstitialPage::GetInterstitialPage(tab) instead of
|
| // tab->GetInterstitialPage() because the tab doesn't have a pointer
|
| // to its interstital page until it gets a command from the renderer
|
| // that it has indeed displayed it -- and this sometimes happens after
|
| // NavigateToURL returns.
|
| - SafeBrowsingBlockingPage* interstitial_page =
|
| - static_cast<SafeBrowsingBlockingPage*>(
|
| - InterstitialPage::GetInterstitialPage(contents));
|
| - ASSERT_TRUE(interstitial_page);
|
| - interstitial_page->CommandReceived(command);
|
| + WebContents* contents =
|
| + browser()->GetSelectedTabContentsWrapper()->web_contents();
|
| + return static_cast<TestSafeBrowsingBlockingPage*>(
|
| + contents->GetInterstitialPage()->GetDelegateForTesting());
|
| }
|
|
|
| + void SendCommand(const std::string& command) {
|
| + GetSafeBrowsingBlockingPage()->CommandReceived(command);
|
| + }
|
| +
|
| void DontProceedThroughInterstitial() {
|
| WebContents* contents =
|
| browser()->GetSelectedTabContentsWrapper()->web_contents();
|
| @@ -303,8 +305,7 @@
|
|
|
| if (contents->ShowingInterstitialPage() && wait_for_delete) {
|
| // We'll get notified when the interstitial is deleted.
|
| - static_cast<TestSafeBrowsingBlockingPage*>(
|
| - contents->GetInterstitialPage())->set_wait_for_delete();
|
| + GetSafeBrowsingBlockingPage()->set_wait_for_delete();
|
| ui_test_utils::RunMessageLoop();
|
| }
|
|
|
|
|