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

Unified Diff: chrome/test/automated_ui_tests/automated_ui_test_base.cc

Issue 113722: Make automation proxy objects to ref_counted. That allows to process async no... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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/test/automated_ui_tests/automated_ui_test_base.cc
===================================================================
--- chrome/test/automated_ui_tests/automated_ui_test_base.cc (revision 17078)
+++ chrome/test/automated_ui_tests/automated_ui_test_base.cc (working copy)
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/scoped_ptr.h"
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/test/automated_ui_tests/automated_ui_test_base.h"
#include "chrome/test/automation/browser_proxy.h"
@@ -66,8 +65,8 @@
LogErrorMessage("Application closed unexpectedly.");
return false;
}
- BrowserProxy* browser = automation()->FindNormalBrowserWindow();
- if (browser == NULL) {
+ scoped_refptr<BrowserProxy> browser(automation()->FindNormalBrowserWindow());
+ if (!browser.get()) {
LogErrorMessage("Can't find browser window.");
return false;
}
@@ -88,7 +87,7 @@
}
bool AutomatedUITestBase::OpenAndActivateNewBrowserWindow(
- BrowserProxy** previous_browser) {
+ scoped_refptr<BrowserProxy>* previous_browser) {
if (!automation()->OpenNewBrowserWindow(SW_SHOWNORMAL)) {
LogWarningMessage("failed_to_open_new_browser_window");
return false;
@@ -97,7 +96,7 @@
automation()->GetBrowserWindowCount(&num_browser_windows);
// Get the most recently opened browser window and activate the tab
// in order to activate this browser window.
- scoped_ptr<BrowserProxy> browser(
+ scoped_refptr<BrowserProxy> browser(
automation()->GetBrowserWindow(num_browser_windows - 1));
if (browser.get() == NULL) {
LogErrorMessage("browser_window_not_found");
@@ -110,14 +109,17 @@
return false;
}
+ if (previous_browser) {
+ DCHECK(previous_browser->get() == NULL);
+ active_browser_.swap(*previous_browser);
+ }
+
active_browser_.swap(browser);
- if (previous_browser)
- *previous_browser = browser.release();
return true;
}
bool AutomatedUITestBase::Navigate(const GURL& url) {
- scoped_ptr<TabProxy> tab(GetActiveTab());
+ scoped_refptr<TabProxy> tab(GetActiveTab());
if (tab.get() == NULL) {
LogErrorMessage("active_tab_not_found");
return false;
@@ -176,7 +178,7 @@
return true;
}
-TabProxy* AutomatedUITestBase::GetActiveTab() {
+scoped_refptr<TabProxy> AutomatedUITestBase::GetActiveTab() {
BrowserProxy* browser = active_browser();
if (browser == NULL) {
LogErrorMessage("browser_window_not_found");
@@ -184,7 +186,7 @@
}
bool did_timeout;
- TabProxy* tab =
+ scoped_refptr<TabProxy> tab =
browser->GetActiveTabWithTimeout(action_max_timeout_ms(), &did_timeout);
if (did_timeout)
return NULL;
« no previous file with comments | « chrome/test/automated_ui_tests/automated_ui_test_base.h ('k') | chrome/test/automated_ui_tests/automated_ui_test_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698