Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7384)

Unified Diff: chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
===================================================================
--- chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc (revision 145001)
+++ chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc (working copy)
@@ -15,6 +15,7 @@
#include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
@@ -261,7 +262,7 @@
}
void SendCommand(const std::string& command) {
- WebContents* contents = browser()->GetActiveWebContents();
+ WebContents* contents = chrome::GetActiveWebContents(browser());
// 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
@@ -276,7 +277,7 @@
}
void DontProceedThroughInterstitial() {
- WebContents* contents = browser()->GetActiveWebContents();
+ WebContents* contents = chrome::GetActiveWebContents(browser());
InterstitialPage* interstitial_page = InterstitialPage::GetInterstitialPage(
contents);
ASSERT_TRUE(interstitial_page);
@@ -284,7 +285,7 @@
}
void ProceedThroughInterstitial() {
- WebContents* contents = browser()->GetActiveWebContents();
+ WebContents* contents = chrome::GetActiveWebContents(browser());
InterstitialPage* interstitial_page = InterstitialPage::GetInterstitialPage(
contents);
ASSERT_TRUE(interstitial_page);
@@ -292,7 +293,7 @@
}
void AssertNoInterstitial(bool wait_for_delete) {
- WebContents* contents = browser()->GetActiveWebContents();
+ WebContents* contents = chrome::GetActiveWebContents(browser());
if (contents->ShowingInterstitialPage() && wait_for_delete) {
// We'll get notified when the interstitial is deleted.
@@ -308,14 +309,14 @@
}
bool YesInterstitial() {
- WebContents* contents = browser()->GetActiveWebContents();
+ WebContents* contents = chrome::GetActiveWebContents(browser());
InterstitialPage* interstitial_page = InterstitialPage::GetInterstitialPage(
contents);
return interstitial_page != NULL;
}
void WaitForInterstitial() {
- WebContents* contents = browser()->GetActiveWebContents();
+ WebContents* contents = chrome::GetActiveWebContents(browser());
ui_test_utils::WindowedNotificationObserver interstitial_observer(
content::NOTIFICATION_INTERSTITIAL_ATTACHED,
content::Source<WebContents>(contents));
@@ -357,13 +358,13 @@
ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB);
WaitForInterstitial();
// Cancel the redirect request while interstitial page is open.
- browser()->ActivateTabAt(0, true);
+ chrome::ActivateTabAt(browser(), 0, true);
ui_test_utils::NavigateToURLWithDisposition(
browser(),
GURL("javascript:stopWin()"),
CURRENT_TAB,
ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
- browser()->ActivateTabAt(1, true);
+ chrome::ActivateTabAt(browser(), 1, true);
// Simulate the user clicking "proceed", there should be no crash.
SendCommand("\"proceed\"");
}
@@ -409,7 +410,7 @@
AssertNoInterstitial(false); // Assert the interstitial is gone
EXPECT_EQ(
GURL(chrome::kAboutBlankURL), // Back to "about:blank"
- browser()->GetActiveWebContents()->GetURL());
+ chrome::GetActiveWebContents(browser())->GetURL());
}
IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MalwareProceed) {
@@ -422,11 +423,11 @@
ui_test_utils::WindowedNotificationObserver observer(
content::NOTIFICATION_NAV_ENTRY_COMMITTED,
content::Source<NavigationController>(
- &browser()->GetActiveWebContents()->GetController()));
+ &chrome::GetActiveWebContents(browser())->GetController()));
SendCommand("\"proceed\""); // Simulate the user clicking "proceed"
observer.Wait();
AssertNoInterstitial(true); // Assert the interstitial is gone.
- EXPECT_EQ(url, browser()->GetActiveWebContents()->GetURL());
+ EXPECT_EQ(url, chrome::GetActiveWebContents(browser())->GetURL());
}
IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, PhishingDontProceed) {
@@ -439,7 +440,7 @@
AssertNoInterstitial(false); // Assert the interstitial is gone
EXPECT_EQ(
GURL(chrome::kAboutBlankURL), // We are back to "about:blank".
- browser()->GetActiveWebContents()->GetURL());
+ chrome::GetActiveWebContents(browser())->GetURL());
}
IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, PhishingProceed) {
@@ -453,11 +454,11 @@
ui_test_utils::WindowedNotificationObserver observer(
content::NOTIFICATION_NAV_ENTRY_COMMITTED,
content::Source<NavigationController>(
- &browser()->GetActiveWebContents()->GetController()));
+ &chrome::GetActiveWebContents(browser())->GetController()));
SendCommand("\"proceed\""); // Simulate the user clicking "proceed".
observer.Wait();
AssertNoInterstitial(true); // Assert the interstitial is gone
- EXPECT_EQ(url, browser()->GetActiveWebContents()->GetURL());
+ EXPECT_EQ(url, chrome::GetActiveWebContents(browser())->GetURL());
}
IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, PhishingReportError) {
@@ -471,7 +472,7 @@
ui_test_utils::WindowedNotificationObserver observer(
content::NOTIFICATION_NAV_ENTRY_COMMITTED,
content::Source<NavigationController>(
- &browser()->GetActiveWebContents()->GetController()));
+ &chrome::GetActiveWebContents(browser())->GetController()));
SendCommand("\"reportError\""); // Simulate the user clicking "report error"
observer.Wait();
AssertNoInterstitial(false); // Assert the interstitial is gone
@@ -479,7 +480,7 @@
// We are in the error reporting page.
EXPECT_EQ(
"/safebrowsing/report_error/",
- browser()->GetActiveWebContents()->GetURL().path());
+ chrome::GetActiveWebContents(browser())->GetURL().path());
}
IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest,
@@ -494,7 +495,7 @@
ui_test_utils::WindowedNotificationObserver observer(
content::NOTIFICATION_NAV_ENTRY_COMMITTED,
content::Source<NavigationController>(
- &browser()->GetActiveWebContents()->GetController()));
+ &chrome::GetActiveWebContents(browser())->GetController()));
SendCommand("\"learnMore\""); // Simulate the user clicking "learn more"
observer.Wait();
AssertNoInterstitial(false); // Assert the interstitial is gone
@@ -502,7 +503,7 @@
// We are in the help page.
EXPECT_EQ(
"/support/bin/answer.py",
- browser()->GetActiveWebContents()->GetURL().path());
+ chrome::GetActiveWebContents(browser())->GetURL().path());
}
IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MalwareIframeDontProceed) {
@@ -515,14 +516,14 @@
ui_test_utils::WindowedNotificationObserver observer(
content::NOTIFICATION_NAV_ENTRY_COMMITTED,
content::Source<NavigationController>(
- &browser()->GetActiveWebContents()->GetController()));
+ &chrome::GetActiveWebContents(browser())->GetController()));
SendCommand("\"takeMeBack\""); // Simulate the user clicking "back"
observer.Wait();
AssertNoInterstitial(false); // Assert the interstitial is gone
EXPECT_EQ(
GURL(chrome::kAboutBlankURL), // Back to "about:blank"
- browser()->GetActiveWebContents()->GetURL());
+ chrome::GetActiveWebContents(browser())->GetURL());
}
// Crashy, http://crbug.com/68834.
@@ -537,7 +538,7 @@
SendCommand("\"proceed\""); // Simulate the user clicking "proceed"
AssertNoInterstitial(true); // Assert the interstitial is gone
- EXPECT_EQ(url, browser()->GetActiveWebContents()->GetURL());
+ EXPECT_EQ(url, chrome::GetActiveWebContents(browser())->GetURL());
}
IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest,
@@ -558,6 +559,6 @@
SendCommand("\"proceed\""); // Simulate the user clicking "back"
AssertNoInterstitial(true); // Assert the interstitial is gone
- EXPECT_EQ(url, browser()->GetActiveWebContents()->GetURL());
+ EXPECT_EQ(url, chrome::GetActiveWebContents(browser())->GetURL());
AssertReportSent();
}
« no previous file with comments | « chrome/browser/repost_form_warning_browsertest.cc ('k') | chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698