summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorstoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-21 01:21:48 +0000
committerstoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-21 01:21:48 +0000
commit82a200191df08bab26f78240af1883ca46b1942f (patch)
tree0ff39c52e8e86e0eff79f88d74d35bd003e8960e /chrome/browser
parent58567187439fdcad4cf4fdc39a1d92668b7afbb8 (diff)
downloadchromium_src-82a200191df08bab26f78240af1883ca46b1942f.zip
chromium_src-82a200191df08bab26f78240af1883ca46b1942f.tar.gz
chromium_src-82a200191df08bab26f78240af1883ca46b1942f.tar.bz2
Refactor automation wrappers. Move the methods from AutomationProxy to the appropriate classes.
Review URL: http://codereview.chromium.org/18335 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8351 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/browser_focus_uitest.cc24
-rw-r--r--chrome/browser/browser_uitest.cc3
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc4
-rw-r--r--chrome/browser/views/constrained_window_impl_interactive_uitest.cc11
-rw-r--r--chrome/browser/views/find_bar_win_interactive_uitest.cc3
-rw-r--r--chrome/browser/views/tabs/tab_dragging_test.cc15
6 files changed, 21 insertions, 39 deletions
diff --git a/chrome/browser/browser_focus_uitest.cc b/chrome/browser/browser_focus_uitest.cc
index 160c3ab..dcc00f6 100644
--- a/chrome/browser/browser_focus_uitest.cc
+++ b/chrome/browser/browser_focus_uitest.cc
@@ -68,8 +68,7 @@ TEST_F(BrowserFocusTest, BrowsersRememberFocus) {
scoped_ptr<WindowProxy> window(automation()->GetActiveWindow());
ASSERT_TRUE(window.get() != NULL);
- scoped_ptr<BrowserProxy> browser(automation()->
- GetBrowserForWindow(window.get()));
+ scoped_ptr<BrowserProxy> browser(window->GetBrowser());
ASSERT_TRUE(browser.get() != NULL);
int focused_view_id;
@@ -103,8 +102,7 @@ TEST_F(BrowserFocusTest, BrowsersRememberFocus) {
EXPECT_TRUE(automation()->OpenNewBrowserWindow(SW_SHOWNORMAL));
scoped_ptr<WindowProxy> new_window(automation()->GetActiveWindow());
ASSERT_TRUE(new_window.get() != NULL);
- scoped_ptr<BrowserProxy> new_browser(automation()->
- GetBrowserForWindow(new_window.get()));
+ scoped_ptr<BrowserProxy> new_browser(new_window->GetBrowser());
ASSERT_TRUE(new_browser.get() != NULL);
// Let's make sure we have 2 different browser windows.
@@ -138,8 +136,7 @@ TEST_F(BrowserFocusTest, TabsRememberFocus) {
scoped_ptr<WindowProxy> window(automation()->GetActiveWindow());
ASSERT_TRUE(window.get() != NULL);
- scoped_ptr<BrowserProxy> browser(
- automation()->GetBrowserForWindow(window.get()));
+ scoped_ptr<BrowserProxy> browser(window->GetBrowser());
ASSERT_TRUE(browser.get() != NULL);
// First we navigate to our test page.
@@ -209,16 +206,14 @@ TEST_F(BrowserFocusTest, BackgroundBrowserDontStealFocus) {
scoped_ptr<WindowProxy> window(automation()->GetActiveWindow());
ASSERT_TRUE(window.get() != NULL);
- scoped_ptr<BrowserProxy> browser(
- automation()->GetBrowserForWindow(window.get()));
+ scoped_ptr<BrowserProxy> browser(window->GetBrowser());
ASSERT_TRUE(browser.get() != NULL);
// Open a new browser window.
EXPECT_TRUE(automation()->OpenNewBrowserWindow(SW_SHOWNORMAL));
scoped_ptr<WindowProxy> new_window(automation()->GetActiveWindow());
ASSERT_TRUE(window.get() != NULL);
- scoped_ptr<BrowserProxy> new_browser(
- automation()->GetBrowserForWindow(new_window.get()));
+ scoped_ptr<BrowserProxy> new_browser(new_window->GetBrowser());
ASSERT_TRUE(new_browser.get() != NULL);
GURL steal_focus_url = server->TestServerPageW(kStealFocusPage);
@@ -249,8 +244,7 @@ TEST_F(BrowserFocusTest, LocationBarLockFocus) {
scoped_ptr<WindowProxy> window(automation()->GetActiveWindow());
ASSERT_TRUE(window.get() != NULL);
- scoped_ptr<BrowserProxy> browser(
- automation()->GetBrowserForWindow(window.get()));
+ scoped_ptr<BrowserProxy> browser(window->GetBrowser());
ASSERT_TRUE(browser.get() != NULL);
// Click on the location bar.
@@ -283,8 +277,7 @@ TEST_F(BrowserFocusTest, FocusTraversal) {
scoped_ptr<WindowProxy> window(automation()->GetActiveWindow());
ASSERT_TRUE(window.get() != NULL);
- scoped_ptr<BrowserProxy> browser(
- automation()->GetBrowserForWindow(window.get()));
+ scoped_ptr<BrowserProxy> browser(window->GetBrowser());
ASSERT_TRUE(browser.get() != NULL);
// Click on the location bar.
@@ -358,8 +351,7 @@ TEST_F(BrowserFocusTest, FindFocusTest) {
scoped_ptr<WindowProxy> window(automation()->GetActiveWindow());
ASSERT_TRUE(window.get() != NULL);
- scoped_ptr<BrowserProxy> browser(
- automation()->GetBrowserForWindow(window.get()));
+ scoped_ptr<BrowserProxy> browser(window->GetBrowser());
ASSERT_TRUE(browser.get() != NULL);
// Press Ctrl+F, which will make the Find box open and request focus.
diff --git a/chrome/browser/browser_uitest.cc b/chrome/browser/browser_uitest.cc
index 1037a89..f64abe7 100644
--- a/chrome/browser/browser_uitest.cc
+++ b/chrome/browser/browser_uitest.cc
@@ -32,8 +32,7 @@ class BrowserTest : public UITest {
protected:
HWND GetMainWindow() {
scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
- scoped_ptr<WindowProxy> window(
- automation()->GetWindowForBrowser(browser.get()));
+ scoped_ptr<WindowProxy> window(browser->GetWindow());
HWND window_handle;
EXPECT_TRUE(window->GetHWND(&window_handle));
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc b/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc
index 0ff6044..49cafcd 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc
+++ b/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc
@@ -69,8 +69,8 @@ TEST_F(ResourceDispatcherTest, SniffNoContentTypeNoData) {
EXPECT_EQ(1, GetTabCount());
// Make sure the download shelf is not showing.
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
- scoped_ptr<TabProxy> dl_tab(window->GetTab(0));
+ scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ scoped_ptr<TabProxy> dl_tab(browser->GetTab(0));
ASSERT_TRUE(dl_tab.get());
bool visible = false;
diff --git a/chrome/browser/views/constrained_window_impl_interactive_uitest.cc b/chrome/browser/views/constrained_window_impl_interactive_uitest.cc
index 4eaef9ed..51d12f7 100644
--- a/chrome/browser/views/constrained_window_impl_interactive_uitest.cc
+++ b/chrome/browser/views/constrained_window_impl_interactive_uitest.cc
@@ -31,7 +31,7 @@ class InteractiveConstrainedWindowTest : public UITest {
browser_.reset(automation()->GetBrowserWindow(0));
ASSERT_TRUE(browser_.get());
- window_.reset(automation()->GetWindowForBrowser(browser_.get()));
+ window_.reset(browser_->GetWindow());
ASSERT_TRUE(window_.get());
tab_.reset(browser_->GetTab(0));
@@ -71,8 +71,7 @@ TEST_F(InteractiveConstrainedWindowTest, TestOpenAndResizeTo) {
scoped_ptr<BrowserProxy> popup_browser(automation()->GetBrowserWindow(1));
ASSERT_TRUE(popup_browser != NULL);
- scoped_ptr<WindowProxy> popup_window(
- automation()->GetWindowForBrowser(popup_browser.get()));
+ scoped_ptr<WindowProxy> popup_window(popup_browser->GetWindow());
ASSERT_TRUE(popup_window != NULL);
// Make sure we were created with the correct width and height.
@@ -187,8 +186,7 @@ TEST_F(InteractiveConstrainedWindowTest, WindowOpenWindowClosePopup) {
// Make sure we have a blocked popup notification
scoped_ptr<BrowserProxy> popup_browser(automation()->GetBrowserWindow(1));
ASSERT_TRUE(popup_browser.get());
- scoped_ptr<WindowProxy> popup_window(
- automation()->GetWindowForBrowser(popup_browser.get()));
+ scoped_ptr<WindowProxy> popup_window(popup_browser->GetWindow());
ASSERT_TRUE(popup_window.get());
scoped_ptr<TabProxy> popup_tab(popup_browser->GetTab(0));
ASSERT_TRUE(popup_tab.get());
@@ -235,8 +233,7 @@ TEST_F(InteractiveConstrainedWindowTest, ShowAlertFromNormalPopup) {
scoped_ptr<BrowserProxy> popup_browser(automation()->GetBrowserWindow(1));
ASSERT_TRUE(popup_browser.get());
- scoped_ptr<WindowProxy> popup_window(
- automation()->GetWindowForBrowser(popup_browser.get()));
+ scoped_ptr<WindowProxy> popup_window(popup_browser->GetWindow());
ASSERT_TRUE(popup_window.get());
scoped_ptr<TabProxy> popup_tab(popup_browser->GetTab(0));
ASSERT_TRUE(popup_tab.get());
diff --git a/chrome/browser/views/find_bar_win_interactive_uitest.cc b/chrome/browser/views/find_bar_win_interactive_uitest.cc
index c036b7c..2923f26 100644
--- a/chrome/browser/views/find_bar_win_interactive_uitest.cc
+++ b/chrome/browser/views/find_bar_win_interactive_uitest.cc
@@ -58,8 +58,7 @@ TEST_F(FindInPageTest, CrashEscHandlers) {
scoped_ptr<BrowserProxy> browser(automation()->GetLastActiveBrowserWindow());
ASSERT_TRUE(browser.get() != NULL);
- scoped_ptr<WindowProxy> window(
- automation()->GetWindowForBrowser(browser.get()));
+ scoped_ptr<WindowProxy> window(browser->GetWindow());
ASSERT_TRUE(window.get() != NULL);
// First we navigate to our test page (tab A).
diff --git a/chrome/browser/views/tabs/tab_dragging_test.cc b/chrome/browser/views/tabs/tab_dragging_test.cc
index 642d34f..a136046 100644
--- a/chrome/browser/views/tabs/tab_dragging_test.cc
+++ b/chrome/browser/views/tabs/tab_dragging_test.cc
@@ -31,8 +31,7 @@ protected:
TEST_F(TabDraggingTest, Tab1Tab2) {
scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
ASSERT_TRUE(browser.get());
- scoped_ptr<WindowProxy> window(
- automation()->GetWindowForBrowser(browser.get()));
+ scoped_ptr<WindowProxy> window(browser->GetWindow());
ASSERT_TRUE(window.get());
// Get initial tab count.
@@ -135,8 +134,7 @@ TEST_F(TabDraggingTest, Tab1Tab2) {
TEST_F(TabDraggingTest, Tab1Tab3) {
scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
ASSERT_TRUE(browser.get());
- scoped_ptr<WindowProxy> window(
- automation()->GetWindowForBrowser(browser.get()));
+ scoped_ptr<WindowProxy> window(browser->GetWindow());
ASSERT_TRUE(window.get());
// Get initial tab count.
@@ -246,8 +244,7 @@ TEST_F(TabDraggingTest, Tab1Tab3) {
TEST_F(TabDraggingTest, Tab1Tab3Escape) {
scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
ASSERT_TRUE(browser.get());
- scoped_ptr<WindowProxy> window(
- automation()->GetWindowForBrowser(browser.get()));
+ scoped_ptr<WindowProxy> window(browser->GetWindow());
ASSERT_TRUE(window.get());
// Get initial tab count.
@@ -360,8 +357,7 @@ TEST_F(TabDraggingTest, Tab1Tab3Escape) {
TEST_F(TabDraggingTest, Tab2OutOfTabStrip) {
scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
ASSERT_TRUE(browser.get());
- scoped_ptr<WindowProxy> window(
- automation()->GetWindowForBrowser(browser.get()));
+ scoped_ptr<WindowProxy> window(browser->GetWindow());
ASSERT_TRUE(window.get());
// Get initial tab count.
@@ -484,8 +480,7 @@ TEST_F(TabDraggingTest, Tab2OutOfTabStrip) {
// Now check to make sure a new window has opened.
scoped_ptr<BrowserProxy> browser2(automation()->GetBrowserWindow(1));
ASSERT_TRUE(browser2.get());
- scoped_ptr<WindowProxy> window2(
- automation()->GetWindowForBrowser(browser2.get()));
+ scoped_ptr<WindowProxy> window2(browser2->GetWindow());
ASSERT_TRUE(window2.get());
// Make sure that the new window has only one tab.