summaryrefslogtreecommitdiffstats
path: root/chrome/test/ui/ui_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/test/ui/ui_test.cc')
-rw-r--r--chrome/test/ui/ui_test.cc40
1 files changed, 36 insertions, 4 deletions
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc
index 12846c6..7f8bdb8 100644
--- a/chrome/test/ui/ui_test.cc
+++ b/chrome/test/ui/ui_test.cc
@@ -535,7 +535,12 @@ void UITestBase::NavigateToURLAsync(const GURL& url) {
}
void UITestBase::NavigateToURL(const GURL& url) {
- NavigateToURLBlockUntilNavigationsComplete(url, 1);
+ NavigateToURL(url, 0, GetActiveTabIndex(0));
+}
+
+void UITestBase::NavigateToURL(const GURL& url, int window_index, int
+ tab_index) {
+ NavigateToURLBlockUntilNavigationsComplete(url, 1, window_index, tab_index);
}
void UITestBase::NavigateToURLBlockUntilNavigationsComplete(
@@ -552,6 +557,27 @@ void UITestBase::NavigateToURLBlockUntilNavigationsComplete(
ASSERT_FALSE(is_timeout) << url.spec();
}
+void UITestBase::NavigateToURLBlockUntilNavigationsComplete(
+ const GURL& url, int number_of_navigations, int window_index,
+ int tab_index) {
+ scoped_refptr<BrowserProxy> window =
+ automation()->GetBrowserWindow(window_index);
+ ASSERT_TRUE(window.get());
+ if (!window.get())
+ return;
+
+ scoped_refptr<TabProxy> tab_proxy(window->GetTab(tab_index));
+ ASSERT_TRUE(tab_proxy.get());
+ if (!tab_proxy.get())
+ return;
+
+ bool is_timeout = true;
+ ASSERT_TRUE(tab_proxy->NavigateToURLWithTimeout(
+ url, number_of_navigations, command_execution_timeout_ms(),
+ &is_timeout)) << url.spec();
+ ASSERT_FALSE(is_timeout) << url.spec();
+}
+
bool UITestBase::WaitForDownloadShelfVisible(BrowserProxy* browser) {
return WaitForDownloadShelfVisibilityChange(browser, true);
}
@@ -684,12 +710,18 @@ DictionaryValue* UITestBase::GetDefaultProfilePreferences() {
}
int UITestBase::GetTabCount() {
- scoped_refptr<BrowserProxy> first_window(automation()->GetBrowserWindow(0));
- if (!first_window.get())
+ return GetTabCount(0);
+}
+
+int UITestBase::GetTabCount(int window_index) {
+ scoped_refptr<BrowserProxy> window(
+ automation()->GetBrowserWindow(window_index));
+ EXPECT_TRUE(window.get());
+ if (!window.get())
return 0;
int result = 0;
- EXPECT_TRUE(first_window->GetTabCount(&result));
+ EXPECT_TRUE(window->GetTabCount(&result));
return result;
}