summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/base/ui_test_utils.cc34
-rw-r--r--chrome/test/base/ui_test_utils.h8
-rw-r--r--chrome/test/data/webui/hung_renderer_dialog_ui_test-inl.h6
3 files changed, 27 insertions, 21 deletions
diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc
index 5cb2e63..01d332e 100644
--- a/chrome/test/base/ui_test_utils.cc
+++ b/chrome/test/base/ui_test_utils.cc
@@ -304,10 +304,10 @@ void RunAllPendingInMessageLoop(content::BrowserThread::ID thread_id) {
}
bool GetCurrentTabTitle(const Browser* browser, string16* title) {
- TabContents* tab_contents = browser->GetSelectedTabContents();
- if (!tab_contents)
+ WebContents* web_contents = browser->GetSelectedWebContents();
+ if (!web_contents)
return false;
- NavigationEntry* last_entry = tab_contents->GetController().GetActiveEntry();
+ NavigationEntry* last_entry = web_contents->GetController().GetActiveEntry();
if (!last_entry)
return false;
title->assign(last_entry->GetTitleForDisplay(""));
@@ -338,7 +338,7 @@ void WaitForBrowserActionUpdated(ExtensionAction* browser_action) {
content::Source<ExtensionAction>(browser_action));
}
-void WaitForLoadStop(TabContents* tab) {
+void WaitForLoadStop(WebContents* tab) {
WindowedNotificationObserver load_stop_observer(
content::NOTIFICATION_LOAD_STOP,
content::Source<NavigationController>(&tab->GetController()));
@@ -371,7 +371,7 @@ void OpenURLOffTheRecord(Profile* profile, const GURL& url) {
Browser::OpenURLOffTheRecord(profile, url);
Browser* browser = BrowserList::FindTabbedBrowser(
profile->GetOffTheRecordProfile(), false);
- WaitForNavigations(&browser->GetSelectedTabContents()->GetController(), 1);
+ WaitForNavigations(&browser->GetSelectedWebContents()->GetController(), 1);
}
void NavigateToURL(browser::NavigateParams* params) {
@@ -400,11 +400,11 @@ static void NavigateToURLWithDispositionBlockUntilNavigationsComplete(
int number_of_navigations,
WindowOpenDisposition disposition,
int browser_test_flags) {
- if (disposition == CURRENT_TAB && browser->GetSelectedTabContents())
- WaitForLoadStop(browser->GetSelectedTabContents());
+ if (disposition == CURRENT_TAB && browser->GetSelectedWebContents())
+ WaitForLoadStop(browser->GetSelectedWebContents());
TestNavigationObserver same_tab_observer(
content::Source<NavigationController>(
- &browser->GetSelectedTabContents()->GetController()),
+ &browser->GetSelectedWebContents()->GetController()),
NULL,
number_of_navigations);
@@ -429,11 +429,11 @@ static void NavigateToURLWithDispositionBlockUntilNavigationsComplete(
// Some other flag caused the wait prior to this.
return;
}
- TabContents* tab_contents = NULL;
+ WebContents* web_contents = NULL;
if (disposition == NEW_BACKGROUND_TAB) {
// We've opened up a new tab, but not selected it.
- tab_contents = browser->GetTabContentsAt(browser->active_index() + 1);
- EXPECT_TRUE(tab_contents != NULL)
+ web_contents = browser->GetTabContentsAt(browser->active_index() + 1);
+ EXPECT_TRUE(web_contents != NULL)
<< " Unable to wait for navigation to \"" << url.spec()
<< "\" because the new tab is not available yet";
return;
@@ -441,7 +441,7 @@ static void NavigateToURLWithDispositionBlockUntilNavigationsComplete(
(disposition == NEW_FOREGROUND_TAB) ||
(disposition == SINGLETON_TAB)) {
// The currently selected tab is the right one.
- tab_contents = browser->GetSelectedTabContents();
+ web_contents = browser->GetSelectedWebContents();
}
if (disposition == CURRENT_TAB) {
same_tab_observer.WaitForObservation(
@@ -449,12 +449,12 @@ static void NavigateToURLWithDispositionBlockUntilNavigationsComplete(
base::Bind(&MessageLoop::Quit,
base::Unretained(MessageLoopForUI::current())));
return;
- } else if (tab_contents) {
- NavigationController* controller = &tab_contents->GetController();
+ } else if (web_contents) {
+ NavigationController* controller = &web_contents->GetController();
WaitForNavigations(controller, number_of_navigations);
return;
}
- EXPECT_TRUE(NULL != tab_contents) << " Unable to wait for navigation to \""
+ EXPECT_TRUE(NULL != web_contents) << " Unable to wait for navigation to \""
<< url.spec() << "\""
<< " because we can't get the tab contents";
}
@@ -485,7 +485,7 @@ void NavigateToURLBlockUntilNavigationsComplete(Browser* browser,
DOMElementProxyRef GetActiveDOMDocument(Browser* browser) {
JavaScriptExecutionController* executor =
new InProcessJavaScriptExecutionController(
- browser->GetSelectedTabContents()->GetRenderViewHost());
+ browser->GetSelectedWebContents()->GetRenderViewHost());
int element_handle;
executor->ExecuteJavaScriptAndGetReturn("document;", &element_handle);
return executor->GetObjectProxy<DOMElementProxy>(element_handle);
@@ -566,7 +566,7 @@ AppModalDialog* WaitForAppModalDialog() {
return content::Source<AppModalDialog>(observer.source()).ptr();
}
-void CrashTab(TabContents* tab) {
+void CrashTab(WebContents* tab) {
content::RenderProcessHost* rph = tab->GetRenderProcessHost();
base::KillProcess(rph->GetHandle(), 0, false);
TestNotificationObserver observer;
diff --git a/chrome/test/base/ui_test_utils.h b/chrome/test/base/ui_test_utils.h
index 4fce446..3657c4e 100644
--- a/chrome/test/base/ui_test_utils.h
+++ b/chrome/test/base/ui_test_utils.h
@@ -54,6 +54,10 @@ namespace browser {
struct NavigateParams;
}
+namespace content {
+class WebContents;
+}
+
namespace gfx {
class Size;
}
@@ -106,7 +110,7 @@ void WaitForBrowserActionUpdated(ExtensionAction* browser_action);
// Waits for a load stop for the specified |tab|'s controller, if the tab is
// currently loading. Otherwise returns immediately.
-void WaitForLoadStop(TabContents* tab);
+void WaitForLoadStop(content::WebContents* tab);
// Waits for a new browser to be created, returning the browser.
Browser* WaitForNewBrowser();
@@ -192,7 +196,7 @@ GURL GetFileUrlWithQuery(const FilePath& path, const std::string& query_string);
AppModalDialog* WaitForAppModalDialog();
// Causes the specified tab to crash. Blocks until it is crashed.
-void CrashTab(TabContents* tab);
+void CrashTab(content::WebContents* tab);
// Performs a find in the page of the specified tab. Returns the number of
// matches found. |ordinal| is an optional parameter which is set to the index
diff --git a/chrome/test/data/webui/hung_renderer_dialog_ui_test-inl.h b/chrome/test/data/webui/hung_renderer_dialog_ui_test-inl.h
index 5552d8b..9fd0e8e 100644
--- a/chrome/test/data/webui/hung_renderer_dialog_ui_test-inl.h
+++ b/chrome/test/data/webui/hung_renderer_dialog_ui_test-inl.h
@@ -12,6 +12,8 @@
#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/webui/web_ui.h"
+using content::WebContents;
+
// Test framework for chrome/test/data/webui/hung_renderer_dialog_test.js.
class HungRendererDialogUITest : public WebUIBrowserTest {
public:
@@ -29,14 +31,14 @@ void HungRendererDialogUITest::ShowHungRendererDialogInternal() {
// Choose which tab contents to report as hung. In this case, the default
// tab contents will be about:blank.
ASSERT_TRUE(browser());
- TabContents* tab_contents = browser()->GetSelectedTabContents();
+ WebContents* web_contents = browser()->GetSelectedWebContents();
// The TestHtmlDialogObserver will catch our dialog when it gets created.
TestHtmlDialogObserver dialog_observer(this);
// Show a disabled Hung Renderer Dialog that won't kill processes or restart
// hang timers.
- HungRendererDialog::ShowHungRendererDialogInternal(tab_contents, false);
+ HungRendererDialog::ShowHungRendererDialogInternal(web_contents, false);
// Now we can get the WebUI object from the observer, and make some details
// about our test available to the JavaScript.