summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/browser_uitest.cc22
-rw-r--r--chrome/browser/crash_recovery_uitest.cc6
-rw-r--r--chrome/browser/download/download_uitest.cc10
-rw-r--r--chrome/browser/download/save_page_uitest.cc14
-rw-r--r--chrome/browser/extensions/extension_uitest.cc2
-rw-r--r--chrome/browser/history/redirect_uitest.cc16
-rw-r--r--chrome/browser/login_prompt_uitest.cc16
-rw-r--r--chrome/browser/metrics/metrics_service_uitest.cc10
-rw-r--r--chrome/browser/printing/printing_layout_uitest.cc6
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc32
-rw-r--r--chrome/browser/session_history_uitest.cc8
-rw-r--r--chrome/browser/sessions/session_restore_uitest.cc69
-rw-r--r--chrome/browser/ssl/ssl_uitest.cc60
-rw-r--r--chrome/browser/tab_contents/view_source_uitest.cc4
-rw-r--r--chrome/browser/tab_restore_uitest.cc105
-rw-r--r--chrome/browser/unload_uitest.cc14
-rw-r--r--chrome/browser/views/constrained_window_impl_interactive_uitest.cc40
-rw-r--r--chrome/browser/views/find_bar_win_interactive_uitest.cc8
-rw-r--r--chrome/browser/views/find_bar_win_uitest.cc8
-rw-r--r--chrome/browser/views/tabs/tab_dragging_test.cc66
-rw-r--r--chrome/common/logging_chrome_uitest.cc2
-rw-r--r--chrome/common/net/cache_uitest.cc2
-rw-r--r--chrome/common/pref_service_uitest.cc4
-rw-r--r--chrome/test/accessibility/accessibility_tests.cc12
-rw-r--r--chrome/test/automated_ui_tests/automated_ui_test_base.cc22
-rw-r--r--chrome/test/automated_ui_tests/automated_ui_test_base.h9
-rw-r--r--chrome/test/automated_ui_tests/automated_ui_test_test.cc9
-rw-r--r--chrome/test/automated_ui_tests/automated_ui_tests.cc11
-rw-r--r--chrome/test/automated_ui_tests/automated_ui_tests.h2
-rw-r--r--chrome/test/automation/automation_handle_tracker.cc46
-rw-r--r--chrome/test/automation/automation_handle_tracker.h10
-rw-r--r--chrome/test/automation/automation_proxy.cc117
-rw-r--r--chrome/test/automation/automation_proxy.h15
-rw-r--r--chrome/test/automation/automation_proxy_uitest.cc156
-rw-r--r--chrome/test/automation/browser_proxy.cc56
-rw-r--r--chrome/test/automation/browser_proxy.h14
-rw-r--r--chrome/test/automation/tab_proxy.cc39
-rw-r--r--chrome/test/automation/tab_proxy.h20
-rw-r--r--chrome/test/automation/window_proxy.cc20
-rw-r--r--chrome/test/automation/window_proxy.h9
-rw-r--r--chrome/test/interactive_ui/npapi_interactive_test.cc2
-rw-r--r--chrome/test/memory_test/memory_test.cc8
-rw-r--r--chrome/test/page_cycler/page_cycler_test.cc2
-rw-r--r--chrome/test/plugin/plugin_test.cpp2
-rw-r--r--chrome/test/reliability/page_load_test.cc8
-rw-r--r--chrome/test/selenium/selenium_test.cc2
-rw-r--r--chrome/test/startup/feature_startup_test.cc6
-rw-r--r--chrome/test/tab_switching/tab_switching_test.cc4
-rw-r--r--chrome/test/ui/dom_checker_uitest.cc2
-rw-r--r--chrome/test/ui/inspector_controller_uitest.cc6
-rw-r--r--chrome/test/ui/layout_plugin_uitest.cc4
-rw-r--r--chrome/test/ui/npapi_uitest.cc2
-rw-r--r--chrome/test/ui/omnibox_uitest.cc6
-rw-r--r--chrome/test/ui/sunspider_uitest.cc2
-rw-r--r--chrome/test/ui/ui_test.cc32
-rw-r--r--chrome/test/ui/ui_test.h4
-rw-r--r--chrome/test/ui/v8_benchmark_uitest.cc2
-rw-r--r--chrome/test/url_fetch_test/url_fetch_test.cc2
-rw-r--r--chrome/worker/worker_uitest.cc2
59 files changed, 668 insertions, 521 deletions
diff --git a/chrome/browser/browser_uitest.cc b/chrome/browser/browser_uitest.cc
index 4feb635..3b2437a 100644
--- a/chrome/browser/browser_uitest.cc
+++ b/chrome/browser/browser_uitest.cc
@@ -42,8 +42,8 @@ class BrowserTest : public UITest {
protected:
#if defined(OS_WIN)
HWND GetMainWindow() {
- scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
- scoped_ptr<WindowProxy> window(browser->GetWindow());
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ scoped_refptr<WindowProxy> window(browser->GetWindow());
HWND window_handle;
EXPECT_TRUE(window->GetHWND(&window_handle));
@@ -52,8 +52,8 @@ class BrowserTest : public UITest {
#endif
std::wstring GetWindowTitle() {
- scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
- scoped_ptr<WindowProxy> window(browser->GetWindow());
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ scoped_refptr<WindowProxy> window(browser->GetWindow());
string16 title;
EXPECT_TRUE(window->GetWindowTitle(&title));
@@ -104,7 +104,7 @@ TEST_F(BrowserTest, ThirtyFourTabs) {
FilePath test_file(test_data_directory_);
test_file = test_file.AppendASCII("title2.html");
GURL url(net::FilePathToFileURL(test_file));
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
// There is one initial tab.
for (int ix = 0; ix != 33; ++ix) {
EXPECT_TRUE(window->AppendTab(url));
@@ -167,13 +167,13 @@ TEST_F(BrowserTest, WindowsSessionEnd) {
// This test is flakey, see bug 5668 for details.
TEST_F(BrowserTest, DISABLED_JavascriptAlertActivatesTab) {
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
int start_index;
ASSERT_TRUE(window->GetActiveTabIndex(&start_index));
ASSERT_TRUE(window->AppendTab(GURL("about:blank")));
int javascript_tab_index;
ASSERT_TRUE(window->GetActiveTabIndex(&javascript_tab_index));
- TabProxy* javascript_tab = window->GetActiveTab();
+ scoped_refptr<TabProxy> javascript_tab = window->GetActiveTab();
// Switch back to the starting tab, then send the second tab a javascript
// alert, which should force it to become active.
ASSERT_TRUE(window->ActivateTab(start_index));
@@ -200,8 +200,8 @@ TEST_F(BrowserTest, NullOpenerRedirectForksProcess) {
HTTPTestServer::CreateServer(kDocRoot, NULL);
ASSERT_TRUE(NULL != server.get());
FilePath test_file(test_data_directory_);
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
- scoped_ptr<TabProxy> tab(window->GetActiveTab());
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ scoped_refptr<TabProxy> tab(window->GetActiveTab());
// Start with a file:// url
test_file = test_file.AppendASCII("title2.html");
@@ -242,8 +242,8 @@ TEST_F(BrowserTest, OtherRedirectsDontForkProcess) {
HTTPTestServer::CreateServer(kDocRoot, NULL);
ASSERT_TRUE(NULL != server.get());
FilePath test_file(test_data_directory_);
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
- scoped_ptr<TabProxy> tab(window->GetActiveTab());
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ scoped_refptr<TabProxy> tab(window->GetActiveTab());
// Start with a file:// url
test_file = test_file.AppendASCII("title2.html");
diff --git a/chrome/browser/crash_recovery_uitest.cc b/chrome/browser/crash_recovery_uitest.cc
index 551e323..2a39152 100644
--- a/chrome/browser/crash_recovery_uitest.cc
+++ b/chrome/browser/crash_recovery_uitest.cc
@@ -27,7 +27,7 @@ TEST_F(CrashRecoveryUITest, Reload) {
std::wstring title1 = GetActiveTabTitle();
- scoped_ptr<TabProxy> tab(GetActiveTab());
+ scoped_refptr<TabProxy> tab(GetActiveTab());
// Cause the renderer to crash.
expected_crashes_ = 1;
@@ -61,7 +61,7 @@ TEST_F(CrashRecoveryUITest, LoadInNewTab) {
const std::wstring title(L"Title Of Awesomeness");
EXPECT_EQ(title, GetActiveTabTitle());
- scoped_ptr<TabProxy> tab(GetActiveTab());
+ scoped_refptr<TabProxy> tab(GetActiveTab());
// Cause the renderer to crash.
expected_crashes_ = 1;
@@ -70,7 +70,7 @@ TEST_F(CrashRecoveryUITest, LoadInNewTab) {
// Wait for the browser to notice the renderer crash.
PlatformThread::Sleep(1000);
- scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
ASSERT_TRUE(browser_proxy->AppendTab(url));
// Ensure the title of the new tab is updated, indicating that the navigation
diff --git a/chrome/browser/download/download_uitest.cc b/chrome/browser/download/download_uitest.cc
index 18eaed2..78a3683 100644
--- a/chrome/browser/download/download_uitest.cc
+++ b/chrome/browser/download/download_uitest.cc
@@ -124,14 +124,14 @@ class DownloadTest : public UITest {
// Complete sending the request. We do this by loading a second URL in a
// separate tab.
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
EXPECT_TRUE(window->AppendTab(GURL(
URLRequestSlowDownloadJob::kFinishDownloadUrl)));
EXPECT_EQ(2, GetTabCount());
// TODO(tc): check download status text
// Make sure the download shelf is showing.
- scoped_ptr<TabProxy> dl_tab(window->GetTab(0));
+ scoped_refptr<TabProxy> dl_tab(window->GetTab(0));
ASSERT_TRUE(dl_tab.get());
EXPECT_TRUE(WaitForDownloadShelfVisible(dl_tab.get()));
}
@@ -170,7 +170,7 @@ TEST_F(DownloadTest, DownloadMimeType) {
CleanUpDownload(file);
- scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
+ scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
ASSERT_TRUE(tab_proxy.get());
EXPECT_TRUE(WaitForDownloadShelfVisible(tab_proxy.get()));
}
@@ -196,7 +196,7 @@ TEST_F(DownloadTest, NoDownload) {
if (file_util::PathExists(file_path))
ASSERT_TRUE(file_util::Delete(file_path, false));
- scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
+ scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
ASSERT_TRUE(tab_proxy.get());
EXPECT_FALSE(WaitForDownloadShelfVisible(tab_proxy.get()));
}
@@ -219,7 +219,7 @@ TEST_F(DownloadTest, ContentDisposition) {
CleanUpDownload(download_file, file);
// Ensure the download shelf is visible on the current tab.
- scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
+ scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
ASSERT_TRUE(tab_proxy.get());
EXPECT_TRUE(WaitForDownloadShelfVisible(tab_proxy.get()));
}
diff --git a/chrome/browser/download/save_page_uitest.cc b/chrome/browser/download/save_page_uitest.cc
index 9172680..4562d20 100644
--- a/chrome/browser/download/save_page_uitest.cc
+++ b/chrome/browser/download/save_page_uitest.cc
@@ -79,7 +79,7 @@ TEST_F(SavePageTest, SaveHTMLOnly) {
GURL url = URLRequestMockHTTPJob::GetMockUrl(
UTF8ToWide(kTestDir + "/" + file_name));
- scoped_ptr<TabProxy> tab(GetActiveTab());
+ scoped_refptr<TabProxy> tab(GetActiveTab());
ASSERT_TRUE(tab->NavigateToURL(url));
WaitUntilTabCount(1);
@@ -99,7 +99,7 @@ TEST_F(SavePageTest, SaveCompleteHTML) {
GURL url = URLRequestMockHTTPJob::GetMockUrl(UTF8ToWide(kTestDir + "/" +
file_name));
- scoped_ptr<TabProxy> tab(GetActiveTab());
+ scoped_refptr<TabProxy> tab(GetActiveTab());
ASSERT_TRUE(tab->NavigateToURL(url));
WaitUntilTabCount(1);
@@ -121,7 +121,7 @@ TEST_F(SavePageTest, NoSave) {
FilePath full_file_name = save_dir_.AppendASCII(file_name);
FilePath dir = save_dir_.AppendASCII("c_files");
- scoped_ptr<TabProxy> tab(GetActiveTab());
+ scoped_refptr<TabProxy> tab(GetActiveTab());
ASSERT_TRUE(tab->NavigateToURL(GURL("about:blank")));
WaitUntilTabCount(1);
@@ -141,11 +141,11 @@ TEST_F(SavePageTest, FilenameFromPageTitle) {
GURL url = URLRequestMockHTTPJob::GetMockUrl(UTF8ToWide(kTestDir + "/" +
file_name));
- scoped_ptr<TabProxy> tab(GetActiveTab());
+ scoped_refptr<TabProxy> tab(GetActiveTab());
ASSERT_TRUE(tab->NavigateToURL(url));
WaitUntilTabCount(1);
- scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
automation()->SavePackageShouldPromptUser(false);
EXPECT_TRUE(browser->RunCommandAsync(IDC_SAVE_PAGE));
EXPECT_TRUE(WaitForDownloadShelfVisible(tab.get()));
@@ -173,11 +173,11 @@ TEST_F(SavePageTest, CleanFilenameFromPageTitle) {
GURL url = URLRequestMockHTTPJob::GetMockUrl(UTF8ToWide(kTestDir + "/" +
file_name));
- scoped_ptr<TabProxy> tab(GetActiveTab());
+ scoped_refptr<TabProxy> tab(GetActiveTab());
ASSERT_TRUE(tab->NavigateToURL(url));
WaitUntilTabCount(1);
- scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
automation()->SavePackageShouldPromptUser(false);
EXPECT_TRUE(browser->RunCommandAsync(IDC_SAVE_PAGE));
EXPECT_TRUE(WaitForDownloadShelfVisible(tab.get()));
diff --git a/chrome/browser/extensions/extension_uitest.cc b/chrome/browser/extensions/extension_uitest.cc
index 867a13a..102bbac 100644
--- a/chrome/browser/extensions/extension_uitest.cc
+++ b/chrome/browser/extensions/extension_uitest.cc
@@ -52,7 +52,7 @@ class ExtensionUITest : public ParentTestType {
void TestWithURL(const GURL& url) {
HWND external_tab_container = NULL;
- scoped_ptr<TabProxy> tab(automation()->CreateExternalTab(NULL, gfx::Rect(),
+ scoped_refptr<TabProxy> tab(automation()->CreateExternalTab(NULL, gfx::Rect(),
WS_POPUP, false, &external_tab_container));
ASSERT_TRUE(tab != NULL);
ASSERT_NE(FALSE, ::IsWindow(external_tab_container));
diff --git a/chrome/browser/history/redirect_uitest.cc b/chrome/browser/history/redirect_uitest.cc
index e51e992..301acc3 100644
--- a/chrome/browser/history/redirect_uitest.cc
+++ b/chrome/browser/history/redirect_uitest.cc
@@ -38,7 +38,7 @@ TEST_F(RedirectTest, Server) {
NavigateToURL(first_url);
- scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
+ scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
ASSERT_TRUE(tab_proxy.get());
std::vector<GURL> redirects;
@@ -63,7 +63,7 @@ TEST_F(RedirectTest, Client) {
NavigateToURL(first_url);
PlatformThread::Sleep(action_timeout_ms());
- scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
+ scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
ASSERT_TRUE(tab_proxy.get());
std::vector<GURL> redirects;
@@ -91,7 +91,7 @@ TEST_F(RedirectTest, ClientEmptyReferer) {
// the TestServer.
for (int i = 0; i < 10; ++i) {
PlatformThread::Sleep(sleep_timeout_ms());
- scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
+ scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
ASSERT_TRUE(tab_proxy.get());
ASSERT_TRUE(tab_proxy->GetRedirectsFrom(first_url, &redirects));
if (!redirects.empty())
@@ -113,7 +113,7 @@ TEST_F(RedirectTest, ClientCancelled) {
NavigateToURL(first_url);
PlatformThread::Sleep(action_timeout_ms());
- scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
+ scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
ASSERT_TRUE(tab_proxy.get());
std::vector<GURL> redirects;
@@ -162,7 +162,7 @@ TEST_F(RedirectTest, DISABLED_ClientServerServer) {
for (int i = 0; i < 10; ++i) {
PlatformThread::Sleep(sleep_timeout_ms());
- scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
+ scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
ASSERT_TRUE(tab_proxy.get());
ASSERT_TRUE(tab_proxy->GetRedirectsFrom(first_url, &redirects));
if (!redirects.empty())
@@ -211,7 +211,7 @@ TEST_F(RedirectTest, NoHttpToFile) {
NavigateToURL(initial_url);
// UITest will check for crashes. We make sure the title doesn't match the
// title from the file, because the nav should not have taken place.
- scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
+ scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
ASSERT_TRUE(tab_proxy.get());
std::wstring actual_title;
tab_proxy->GetTabTitle(&actual_title);
@@ -233,7 +233,7 @@ TEST_F(RedirectTest, ClientFragments) {
NavigateToURL(first_url);
for (int i = 0; i < 10; ++i) {
PlatformThread::Sleep(sleep_timeout_ms());
- scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
+ scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
ASSERT_TRUE(tab_proxy.get());
ASSERT_TRUE(tab_proxy->GetRedirectsFrom(first_url, &redirects));
if (!redirects.empty())
@@ -281,7 +281,7 @@ TEST_F(RedirectTest,
// Wait till the final page has been loaded.
for (int i = 0; i < 10; ++i) {
PlatformThread::Sleep(sleep_timeout_ms());
- scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
+ scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
ASSERT_TRUE(tab_proxy.get());
ASSERT_TRUE(tab_proxy->GetTabTitle(&tab_title));
if (tab_title == final_url_title) {
diff --git a/chrome/browser/login_prompt_uitest.cc b/chrome/browser/login_prompt_uitest.cc
index 23f3687..01763eb 100644
--- a/chrome/browser/login_prompt_uitest.cc
+++ b/chrome/browser/login_prompt_uitest.cc
@@ -27,8 +27,8 @@ class LoginPromptTest : public UITest {
password_bad_(L"denyme") {
}
- TabProxy* GetActiveTabProxy() {
- scoped_ptr<BrowserProxy> window_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<TabProxy> GetActiveTabProxy() {
+ scoped_refptr<BrowserProxy> window_proxy(automation()->GetBrowserWindow(0));
EXPECT_TRUE(window_proxy.get());
int active_tab_index = 0;
@@ -41,7 +41,7 @@ class LoginPromptTest : public UITest {
}
void AppendTab(const GURL& url) {
- scoped_ptr<BrowserProxy> window_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window_proxy(automation()->GetBrowserWindow(0));
EXPECT_TRUE(window_proxy.get());
EXPECT_TRUE(window_proxy->AppendTab(url));
}
@@ -65,7 +65,7 @@ TEST_F(LoginPromptTest, TestBasicAuth) {
scoped_refptr<HTTPTestServer> server =
HTTPTestServer::CreateServer(kDocRoot, NULL);
ASSERT_TRUE(NULL != server.get());
- ::scoped_ptr<TabProxy> tab(GetActiveTabProxy());
+ scoped_refptr<TabProxy> tab(GetActiveTabProxy());
NavigateTab(tab.get(), server->TestServerPageW(L"auth-basic"));
EXPECT_TRUE(tab->NeedsAuth());
@@ -87,7 +87,7 @@ TEST_F(LoginPromptTest, TestDigestAuth) {
scoped_refptr<HTTPTestServer> server =
HTTPTestServer::CreateServer(kDocRoot, NULL);
ASSERT_TRUE(NULL != server.get());
- ::scoped_ptr<TabProxy> tab(GetActiveTabProxy());
+ scoped_refptr<TabProxy> tab(GetActiveTabProxy());
NavigateTab(tab.get(), server->TestServerPageW(L"auth-digest"));
EXPECT_TRUE(tab->NeedsAuth());
@@ -109,11 +109,11 @@ TEST_F(LoginPromptTest, TestTwoAuths) {
HTTPTestServer::CreateServer(kDocRoot, NULL);
ASSERT_TRUE(NULL != server.get());
- ::scoped_ptr<TabProxy> basic_tab(GetActiveTabProxy());
+ scoped_refptr<TabProxy> basic_tab(GetActiveTabProxy());
NavigateTab(basic_tab.get(), server->TestServerPageW(L"auth-basic"));
AppendTab(GURL("about:blank"));
- ::scoped_ptr<TabProxy> digest_tab(GetActiveTabProxy());
+ scoped_refptr<TabProxy> digest_tab(GetActiveTabProxy());
NavigateTab(digest_tab.get(), server->TestServerPageW(L"auth-digest"));
// TODO(devint): http://b/1158262 basic_tab is not active, so this logs in to
@@ -138,7 +138,7 @@ TEST_F(LoginPromptTest, TestCancelAuth) {
scoped_refptr<HTTPTestServer> server =
HTTPTestServer::CreateServer(kDocRoot, NULL);
ASSERT_TRUE(NULL != server.get());
- ::scoped_ptr<TabProxy> tab(GetActiveTabProxy());
+ scoped_refptr<TabProxy> tab(GetActiveTabProxy());
// First navigate to a test server page so we have something to go back to.
EXPECT_TRUE(tab->NavigateToURL(server->TestServerPageW(L"a")));
diff --git a/chrome/browser/metrics/metrics_service_uitest.cc b/chrome/browser/metrics/metrics_service_uitest.cc
index 9f208f0..7245a35 100644
--- a/chrome/browser/metrics/metrics_service_uitest.cc
+++ b/chrome/browser/metrics/metrics_service_uitest.cc
@@ -24,7 +24,7 @@
class MetricsServiceTest : public UITest {
public:
- MetricsServiceTest() : UITest(), window_(NULL) {
+ MetricsServiceTest() : UITest() {
// We need to show the window so web content type tabs load.
show_window_ = true;
}
@@ -32,7 +32,7 @@ class MetricsServiceTest : public UITest {
// Open a few tabs of random content
void OpenTabs() {
window_ = automation()->GetBrowserWindow(0);
- ASSERT_TRUE(window_);
+ ASSERT_TRUE(window_.get());
FilePath page1_path;
ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &page1_path));
@@ -57,12 +57,12 @@ class MetricsServiceTest : public UITest {
}
virtual void TearDown() {
- delete window_;
+ window_ = NULL;
UITest::TearDown();
}
protected:
- BrowserProxy* window_;
+ scoped_refptr<BrowserProxy> window_;
};
TEST_F(MetricsServiceTest, CloseRenderersNormally) {
@@ -88,7 +88,7 @@ TEST_F(MetricsServiceTest, CrashRenderers) {
OpenTabs();
// kill the process for one of the tabs
- scoped_ptr<TabProxy> tab(window_->GetTab(1));
+ scoped_refptr<TabProxy> tab(window_->GetTab(1));
ASSERT_TRUE(tab.get());
int process_id = 0;
ASSERT_TRUE(tab->GetProcessID(&process_id));
diff --git a/chrome/browser/printing/printing_layout_uitest.cc b/chrome/browser/printing/printing_layout_uitest.cc
index fe51136..71e29a1 100644
--- a/chrome/browser/printing/printing_layout_uitest.cc
+++ b/chrome/browser/printing/printing_layout_uitest.cc
@@ -219,7 +219,7 @@ class PrintingLayoutTest : public PrintingTest<UITest> {
protected:
void PrintNowTab() {
- scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
+ scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
ASSERT_TRUE(tab_proxy.get());
if (!tab_proxy.get())
return;
@@ -566,7 +566,7 @@ TEST_F(PrintingLayoutTest, DISABLED_Delayed) {
ASSERT_TRUE(NULL != server.get());
{
- scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
+ scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
ASSERT_TRUE(tab_proxy.get());
bool is_timeout = true;
GURL url = server->TestServerPage("files/printing/popup_delayed_print.htm");
@@ -601,7 +601,7 @@ TEST_F(PrintingLayoutTest, DISABLED_IFrame) {
ASSERT_TRUE(NULL != server.get());
{
- scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
+ scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
ASSERT_TRUE(tab_proxy.get());
GURL url = server->TestServerPage("files/printing/iframe.htm");
EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS,
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc b/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc
index ea12275..f9d51d7 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc
+++ b/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc
@@ -67,8 +67,8 @@ TEST_F(ResourceDispatcherTest, SniffNoContentTypeNoData) {
EXPECT_EQ(1, GetTabCount());
// Make sure the download shelf is not showing.
- scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
- scoped_ptr<TabProxy> dl_tab(browser->GetTab(0));
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ scoped_refptr<TabProxy> dl_tab(browser->GetTab(0));
ASSERT_TRUE(dl_tab.get());
bool visible = false;
@@ -91,9 +91,9 @@ TEST_F(ResourceDispatcherTest, SyncXMLHttpRequest) {
HTTPTestServer::CreateServer(kDocRoot, NULL);
ASSERT_TRUE(NULL != server.get());
- scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
EXPECT_TRUE(browser_proxy.get());
- scoped_ptr<TabProxy> tab(browser_proxy->GetActiveTab());
+ scoped_refptr<TabProxy> tab(browser_proxy->GetActiveTab());
tab->NavigateToURL(server->TestServerPageW(
L"files/sync_xmlhttprequest.html"));
@@ -111,9 +111,9 @@ TEST_F(ResourceDispatcherTest, SyncXMLHttpRequest_Disallowed) {
HTTPTestServer::CreateServer(kDocRoot, NULL);
ASSERT_TRUE(NULL != server.get());
- scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
EXPECT_TRUE(browser_proxy.get());
- scoped_ptr<TabProxy> tab(browser_proxy->GetActiveTab());
+ scoped_refptr<TabProxy> tab(browser_proxy->GetActiveTab());
tab->NavigateToURL(server->TestServerPageW(
L"files/sync_xmlhttprequest_disallowed.html"));
@@ -134,9 +134,9 @@ TEST_F(ResourceDispatcherTest, SyncXMLHttpRequest_DuringUnload) {
HTTPTestServer::CreateServer(kDocRoot, NULL);
ASSERT_TRUE(NULL != server.get());
- scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
EXPECT_TRUE(browser_proxy.get());
- scoped_ptr<TabProxy> tab(browser_proxy->GetActiveTab());
+ scoped_refptr<TabProxy> tab(browser_proxy->GetActiveTab());
tab->NavigateToURL(
server->TestServerPageW(L"files/sync_xmlhttprequest_during_unload.html"));
@@ -169,9 +169,9 @@ TEST_F(ResourceDispatcherTest, CrossSiteOnunloadCookie) {
HTTPTestServer::CreateServer(kDocRoot, NULL);
ASSERT_TRUE(NULL != server.get());
- scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
EXPECT_TRUE(browser_proxy.get());
- scoped_ptr<TabProxy> tab(browser_proxy->GetActiveTab());
+ scoped_refptr<TabProxy> tab(browser_proxy->GetActiveTab());
GURL url(server->TestServerPageW(L"files/onunload_cookie.html"));
tab->NavigateToURL(url);
@@ -209,9 +209,9 @@ TEST_F(ResourceDispatcherTest, CrossSiteAfterCrash) {
if (in_process_renderer())
return;
- scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
EXPECT_TRUE(browser_proxy.get());
- scoped_ptr<TabProxy> tab(browser_proxy->GetActiveTab());
+ scoped_refptr<TabProxy> tab(browser_proxy->GetActiveTab());
// Cause the renderer to crash.
expected_crashes_ = 1;
@@ -229,9 +229,9 @@ TEST_F(ResourceDispatcherTest, CrossSiteAfterCrash) {
// Tests that cross-site navigations work when the new page does not go through
// the BufferedEventHandler (e.g., non-http{s} URLs). (Bug 1225872)
TEST_F(ResourceDispatcherTest, CrossSiteNavigationNonBuffered) {
- scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
EXPECT_TRUE(browser_proxy.get());
- scoped_ptr<TabProxy> tab(browser_proxy->GetActiveTab());
+ scoped_refptr<TabProxy> tab(browser_proxy->GetActiveTab());
// Start with an HTTP page.
CheckTitleTest(L"content-sniffer-test0.html",
@@ -258,9 +258,9 @@ TEST_F(ResourceDispatcherTest, CrossSiteNavigationErrorPage) {
HTTPTestServer::CreateServer(kDocRoot, NULL);
ASSERT_TRUE(NULL != server.get());
- scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
EXPECT_TRUE(browser_proxy.get());
- scoped_ptr<TabProxy> tab(browser_proxy->GetActiveTab());
+ scoped_refptr<TabProxy> tab(browser_proxy->GetActiveTab());
GURL url(server->TestServerPageW(L"files/onunload_cookie.html"));
tab->NavigateToURL(url);
diff --git a/chrome/browser/session_history_uitest.cc b/chrome/browser/session_history_uitest.cc
index 7805173..88e6519 100644
--- a/chrome/browser/session_history_uitest.cc
+++ b/chrome/browser/session_history_uitest.cc
@@ -31,12 +31,12 @@ class SessionHistoryTest : public UITest {
virtual void SetUp() {
UITest::SetUp();
- window_.reset(automation()->GetBrowserWindow(0));
+ window_ = automation()->GetBrowserWindow(0);
ASSERT_TRUE(window_.get());
int active_tab_index = -1;
ASSERT_TRUE(window_->GetActiveTabIndex(&active_tab_index));
- tab_.reset(window_->GetTab(active_tab_index));
+ tab_ = window_->GetTab(active_tab_index);
ASSERT_TRUE(tab_.get());
}
@@ -98,8 +98,8 @@ class SessionHistoryTest : public UITest {
protected:
wstring url_prefix_;
- scoped_ptr<BrowserProxy> window_;
- scoped_ptr<TabProxy> tab_;
+ scoped_refptr<BrowserProxy> window_;
+ scoped_refptr<TabProxy> tab_;
};
TEST_F(SessionHistoryTest, BasicBackForward) {
diff --git a/chrome/browser/sessions/session_restore_uitest.cc b/chrome/browser/sessions/session_restore_uitest.cc
index e3710df..d828e69 100644
--- a/chrome/browser/sessions/session_restore_uitest.cc
+++ b/chrome/browser/sessions/session_restore_uitest.cc
@@ -40,14 +40,13 @@ class SessionRestoreUITest : public UITest {
}
void CloseWindow(int window_index, int initial_count) {
- scoped_ptr<BrowserProxy> browser_proxy(
+ scoped_refptr<BrowserProxy> browser_proxy(
automation()->GetBrowserWindow(window_index));
ASSERT_TRUE(browser_proxy.get());
ASSERT_TRUE(browser_proxy->RunCommand(IDC_CLOSE_WINDOW));
int window_count;
automation()->GetBrowserWindowCount(&window_count);
ASSERT_EQ(initial_count - 1, window_count);
- browser_proxy.reset();
}
void AssertOneWindowWithOneTab() {
@@ -59,7 +58,7 @@ class SessionRestoreUITest : public UITest {
}
void AssertWindowHasOneTab(int window_index, GURL* url) {
- scoped_ptr<BrowserProxy> browser_proxy(
+ scoped_refptr<BrowserProxy> browser_proxy(
automation()->GetBrowserWindow(window_index));
ASSERT_TRUE(browser_proxy.get());
@@ -71,7 +70,7 @@ class SessionRestoreUITest : public UITest {
ASSERT_TRUE(browser_proxy->GetActiveTabIndex(&active_tab_index));
ASSERT_EQ(0, active_tab_index);
- scoped_ptr<TabProxy> tab_proxy(browser_proxy->GetActiveTab());
+ scoped_refptr<TabProxy> tab_proxy(browser_proxy->GetActiveTab());
ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_timeout_ms()));
ASSERT_TRUE(tab_proxy->GetCurrentURL(url));
@@ -98,8 +97,8 @@ TEST_F(SessionRestoreUITest, Basic) {
int window_count;
ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count) &&
window_count == 1);
- scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
- scoped_ptr<TabProxy> tab_proxy(browser_proxy->GetTab(0));
+ scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<TabProxy> tab_proxy(browser_proxy->GetTab(0));
ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_timeout_ms()));
ASSERT_EQ(url2_, GetActiveTabURL());
@@ -112,7 +111,7 @@ TEST_F(SessionRestoreUITest, RestoresForwardAndBackwardNavs) {
NavigateToURL(url2_);
NavigateToURL(url3_);
- scoped_ptr<TabProxy> active_tab(GetActiveTab());
+ scoped_refptr<TabProxy> active_tab(GetActiveTab());
ASSERT_TRUE(active_tab->GoBack());
QuitBrowserAndRestore(1);
@@ -122,8 +121,8 @@ TEST_F(SessionRestoreUITest, RestoresForwardAndBackwardNavs) {
int window_count;
ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count) &&
window_count == 1);
- scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
- scoped_ptr<TabProxy> tab_proxy(browser_proxy->GetTab(0));
+ scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<TabProxy> tab_proxy(browser_proxy->GetTab(0));
ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_timeout_ms()));
ASSERT_TRUE(GetActiveTabURL() == url2_);
@@ -150,7 +149,7 @@ TEST_F(SessionRestoreUITest, RestoresCrossSiteForwardAndBackwardNavs) {
NavigateToURL(cross_site_url);
NavigateToURL(url2_);
- scoped_ptr<TabProxy> active_tab(GetActiveTab());
+ scoped_refptr<TabProxy> active_tab(GetActiveTab());
ASSERT_TRUE(active_tab->GoBack());
QuitBrowserAndRestore(1);
@@ -160,10 +159,10 @@ TEST_F(SessionRestoreUITest, RestoresCrossSiteForwardAndBackwardNavs) {
int window_count;
ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count) &&
window_count == 1);
- scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
int tab_count;
ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count) && tab_count == 1);
- scoped_ptr<TabProxy> tab_proxy(browser_proxy->GetTab(0));
+ scoped_refptr<TabProxy> tab_proxy(browser_proxy->GetTab(0));
ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_max_timeout_ms()));
// Check that back and forward work as expected.
@@ -192,17 +191,17 @@ TEST_F(SessionRestoreUITest, TwoTabsSecondSelected) {
int window_count;
ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count) &&
window_count == 1);
- scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
ASSERT_TRUE(browser_proxy->AppendTab(url2_));
QuitBrowserAndRestore(2);
- browser_proxy.reset();
+ browser_proxy = NULL;
ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count) &&
window_count == 1);
- browser_proxy.reset(automation()->GetBrowserWindow(0));
- scoped_ptr<TabProxy> tab_proxy(browser_proxy->GetTab(0));
+ browser_proxy = automation()->GetBrowserWindow(0);
+ scoped_refptr<TabProxy> tab_proxy(browser_proxy->GetTab(0));
int tab_count;
ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count));
@@ -212,13 +211,13 @@ TEST_F(SessionRestoreUITest, TwoTabsSecondSelected) {
ASSERT_TRUE(browser_proxy->GetActiveTabIndex(&active_tab_index));
ASSERT_EQ(1, active_tab_index);
- tab_proxy.reset(browser_proxy->GetActiveTab());
+ tab_proxy = browser_proxy->GetActiveTab();
ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_timeout_ms()));
ASSERT_TRUE(GetActiveTabURL() == url2_);
ASSERT_TRUE(browser_proxy->ActivateTab(0));
- tab_proxy.reset(browser_proxy->GetActiveTab());
+ tab_proxy = browser_proxy->GetActiveTab();
ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_timeout_ms()));
ASSERT_TRUE(GetActiveTabURL() == url1_);
@@ -233,17 +232,17 @@ TEST_F(SessionRestoreUITest, ClosedTabStaysClosed) {
int window_count;
ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count) &&
window_count == 1);
- scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
- scoped_ptr<TabProxy> tab_proxy(browser_proxy->GetTab(0));
+ scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<TabProxy> tab_proxy(browser_proxy->GetTab(0));
browser_proxy->AppendTab(url2_);
- scoped_ptr<TabProxy> active_tab(browser_proxy->GetActiveTab());
+ scoped_refptr<TabProxy> active_tab(browser_proxy->GetActiveTab());
active_tab->Close(true);
QuitBrowserAndRestore(1);
- browser_proxy.reset();
- tab_proxy.reset();
+ browser_proxy = NULL;
+ tab_proxy = NULL;
AssertOneWindowWithOneTab();
@@ -261,7 +260,7 @@ TEST_F(SessionRestoreUITest, DontRestoreWhileIncognito) {
ASSERT_TRUE(automation()->GetBrowserWindowCount(&initial_window_count) &&
initial_window_count == 1);
- scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
// Create an off the record window.
ASSERT_TRUE(browser_proxy->RunCommand(IDC_NEW_INCOGNITO_WINDOW));
@@ -271,7 +270,7 @@ TEST_F(SessionRestoreUITest, DontRestoreWhileIncognito) {
// Close the first window.
CloseWindow(0, 2);
- browser_proxy.reset();
+ browser_proxy = NULL;
// Launch the browser again. Note, this doesn't spawn a new process, instead
// it attaches to the current process.
@@ -285,9 +284,9 @@ TEST_F(SessionRestoreUITest, DontRestoreWhileIncognito) {
ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2, action_timeout_ms()));
// And it shouldn't have url1_ in it.
- browser_proxy.reset(automation()->GetBrowserWindow(1));
+ browser_proxy = automation()->GetBrowserWindow(1);
ASSERT_TRUE(browser_proxy.get());
- scoped_ptr<TabProxy> tab_proxy(browser_proxy->GetTab(0));
+ scoped_refptr<TabProxy> tab_proxy(browser_proxy->GetTab(0));
ASSERT_TRUE(tab_proxy.get());
ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_timeout_ms()));
GURL url;
@@ -367,7 +366,7 @@ TEST_F(SessionRestoreUITest, ShareProcessesOnRestore) {
return;
}
- scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
ASSERT_TRUE(browser_proxy.get() != NULL);
int tab_count;
ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count));
@@ -377,7 +376,7 @@ TEST_F(SessionRestoreUITest, ShareProcessesOnRestore) {
int new_tab_count;
ASSERT_TRUE(browser_proxy->GetTabCount(&new_tab_count));
ASSERT_EQ(++tab_count, new_tab_count);
- scoped_ptr<TabProxy> last_tab(browser_proxy->GetTab(tab_count - 1));
+ scoped_refptr<TabProxy> last_tab(browser_proxy->GetTab(tab_count - 1));
ASSERT_TRUE(last_tab.get() != NULL);
// Do a reload to ensure new tab page has loaded.
ASSERT_TRUE(last_tab->Reload());
@@ -385,7 +384,7 @@ TEST_F(SessionRestoreUITest, ShareProcessesOnRestore) {
ASSERT_TRUE(browser_proxy->RunCommand(IDC_NEW_TAB));
ASSERT_TRUE(browser_proxy->GetTabCount(&new_tab_count));
ASSERT_EQ(++tab_count, new_tab_count);
- last_tab.reset(browser_proxy->GetTab(tab_count - 1));
+ last_tab = browser_proxy->GetTab(tab_count - 1);
ASSERT_TRUE(last_tab.get() != NULL);
// Do a reload to ensure new tab page has loaded.
ASSERT_TRUE(last_tab->Reload());
@@ -394,21 +393,21 @@ TEST_F(SessionRestoreUITest, ShareProcessesOnRestore) {
int expected_tab_count = tab_count;
// Restart.
- browser_proxy.reset();
- last_tab.reset();
+ browser_proxy = NULL;
+ last_tab = NULL;
QuitBrowserAndRestore(3);
// Wait for each tab to finish being restored, then make sure the process
// count matches.
- browser_proxy.reset(automation()->GetBrowserWindow(0));
+ browser_proxy = automation()->GetBrowserWindow(0);
ASSERT_TRUE(browser_proxy.get() != NULL);
ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count));
ASSERT_EQ(expected_tab_count, tab_count);
- scoped_ptr<TabProxy> tab_proxy(browser_proxy->GetTab(tab_count - 2));
+ scoped_refptr<TabProxy> tab_proxy(browser_proxy->GetTab(tab_count - 2));
ASSERT_TRUE(tab_proxy.get() != NULL);
ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_timeout_ms()));
- tab_proxy.reset(browser_proxy->GetTab(tab_count - 1));
+ tab_proxy = browser_proxy->GetTab(tab_count - 1);
ASSERT_TRUE(tab_proxy.get() != NULL);
ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_timeout_ms()));
diff --git a/chrome/browser/ssl/ssl_uitest.cc b/chrome/browser/ssl/ssl_uitest.cc
index 33af008..dc01f42 100644
--- a/chrome/browser/ssl/ssl_uitest.cc
+++ b/chrome/browser/ssl/ssl_uitest.cc
@@ -25,8 +25,8 @@ class SSLUITest : public UITest {
dom_automation_enabled_ = true;
}
- TabProxy* GetActiveTabProxy() {
- scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<TabProxy> GetActiveTabProxy() {
+ scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
EXPECT_TRUE(browser_proxy.get());
return browser_proxy->GetActiveTab();
}
@@ -36,7 +36,7 @@ class SSLUITest : public UITest {
}
void AppendTab(const GURL& url) {
- scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
EXPECT_TRUE(browser_proxy.get());
EXPECT_TRUE(browser_proxy->AppendTab(url));
}
@@ -80,7 +80,7 @@ TEST_F(SSLUITest, TestHTTP) {
if (HasFailure())
return;
- scoped_ptr<TabProxy> tab(GetActiveTabProxy());
+ scoped_refptr<TabProxy> tab(GetActiveTabProxy());
NavigateTab(tab.get(), server->TestServerPageW(L"files/ssl/google.html"));
NavigationEntry::PageType page_type;
@@ -104,7 +104,7 @@ TEST_F(SSLUITest, TestHTTPWithBrokenHTTPSResource) {
scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
if (HasFailure())
return;
- scoped_ptr<TabProxy> tab(GetActiveTabProxy());
+ scoped_refptr<TabProxy> tab(GetActiveTabProxy());
NavigateTab(
tab.get(),
@@ -126,7 +126,7 @@ TEST_F(SSLUITest, TestOKHTTPS) {
scoped_refptr<HTTPSTestServer> https_server = GoodCertServer();
if (HasFailure())
return;
- scoped_ptr<TabProxy> tab(GetActiveTabProxy());
+ scoped_refptr<TabProxy> tab(GetActiveTabProxy());
NavigateTab(tab.get(),
https_server->TestServerPageW(L"files/ssl/google.html"));
@@ -149,7 +149,7 @@ TEST_F(SSLUITest, TestHTTPSExpiredCertAndProceed) {
scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
if (HasFailure())
return;
- scoped_ptr<TabProxy> tab(GetActiveTabProxy());
+ scoped_refptr<TabProxy> tab(GetActiveTabProxy());
NavigateTab(tab.get(),
bad_https_server->TestServerPageW(L"files/ssl/google.html"));
@@ -186,7 +186,7 @@ TEST_F(SSLUITest, TestHTTPSExpiredCertAndDontProceed) {
scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
if (HasFailure())
return;
- scoped_ptr<TabProxy> tab(GetActiveTabProxy());
+ scoped_refptr<TabProxy> tab(GetActiveTabProxy());
// First navigate to an OK page.
NavigateTab(tab.get(),
@@ -251,7 +251,7 @@ TEST_F(SSLUITest, TestMixedContents) {
// Load a page with mixed-content, the default behavior is to show the mixed
// content.
- scoped_ptr<TabProxy> tab(GetActiveTabProxy());
+ scoped_refptr<TabProxy> tab(GetActiveTabProxy());
NavigateTab(
tab.get(),
https_server->TestServerPageW(
@@ -279,14 +279,14 @@ TEST_F(SSLUITest, TestMixedContentsFilterAll) {
return;
// Now select the block mixed-content pref and reload the page.
- scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
EXPECT_TRUE(browser_proxy.get());
EXPECT_TRUE(browser_proxy->SetIntPreference(prefs::kMixedContentFiltering,
FilterPolicy::FILTER_ALL));
// Load a page with mixed-content, we've overridden our filtering policy so
// we won't load the mixed content by default.
- scoped_ptr<TabProxy> tab(GetActiveTabProxy());
+ scoped_refptr<TabProxy> tab(GetActiveTabProxy());
NavigateTab(
tab.get(),
https_server->TestServerPageW(
@@ -346,7 +346,7 @@ TEST_F(SSLUITest, TestMixedContentsRandomizeHash) {
if (HasFailure())
return;
- scoped_ptr<TabProxy> tab(GetActiveTabProxy());
+ scoped_refptr<TabProxy> tab(GetActiveTabProxy());
NavigateTab(
tab.get(),
https_server->TestServerPageW(
@@ -374,7 +374,7 @@ TEST_F(SSLUITest, TestUnsafeContents) {
if (HasFailure())
return;
- scoped_ptr<TabProxy> tab(GetActiveTabProxy());
+ scoped_refptr<TabProxy> tab(GetActiveTabProxy());
NavigateTab(tab.get(),
good_https_server->TestServerPageW(
L"files/ssl/page_with_unsafe_contents.html"));
@@ -426,7 +426,7 @@ TEST_F(SSLUITest, TestMixedContentsLoadedFromJS) {
if (HasFailure())
return;
- scoped_ptr<TabProxy> tab(GetActiveTabProxy());
+ scoped_refptr<TabProxy> tab(GetActiveTabProxy());
NavigateTab(tab.get(), https_server->TestServerPageW(
L"files/ssl/page_with_dynamic_mixed_contents.html"));
NavigationEntry::PageType page_type;
@@ -468,7 +468,7 @@ TEST_F(SSLUITest, TestMixedContentsTwoTabs) {
if (HasFailure())
return;
- scoped_ptr<TabProxy> tab1(GetActiveTabProxy());
+ scoped_refptr<TabProxy> tab1(GetActiveTabProxy());
NavigateTab(
tab1.get(),
https_server->TestServerPageW(
@@ -487,12 +487,12 @@ TEST_F(SSLUITest, TestMixedContentsTwoTabs) {
EXPECT_EQ(0, cert_status & net::CERT_STATUS_ALL_ERRORS);
EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state);
- scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
EXPECT_TRUE(browser_proxy.get());
EXPECT_TRUE(browser_proxy->AppendTab(
https_server->TestServerPageW(L"files/ssl/page_with_http_script.html")));
- scoped_ptr<TabProxy> tab2(GetActiveTabProxy());
+ scoped_refptr<TabProxy> tab2(GetActiveTabProxy());
EXPECT_TRUE(tab2->GetPageType(&page_type));
EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type);
@@ -521,7 +521,7 @@ TEST_F(SSLUITest, TestCachedMixedContents) {
if (HasFailure())
return;
- scoped_ptr<TabProxy> tab(GetActiveTabProxy());
+ scoped_refptr<TabProxy> tab(GetActiveTabProxy());
NavigateTab(tab.get(), http_server->TestServerPageW(
L"files/ssl/page_with_mixed_contents.html"));
@@ -564,7 +564,7 @@ TEST_F(SSLUITest, DISABLED_TestCNInvalidStickiness) {
// First we hit the server with hostname, this generates an invalid policy
// error.
- scoped_ptr<TabProxy> tab(GetActiveTabProxy());
+ scoped_refptr<TabProxy> tab(GetActiveTabProxy());
NavigateTab(tab.get(), https_server->TestServerPageW(
L"files/ssl/google.html"));
@@ -629,7 +629,7 @@ TEST_F(SSLUITest, TestRefNavigation) {
scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
if (HasFailure())
return;
- scoped_ptr<TabProxy> tab(GetActiveTabProxy());
+ scoped_refptr<TabProxy> tab(GetActiveTabProxy());
NavigateTab(
tab.get(),
bad_https_server->TestServerPageW(L"files/ssl/page_with_refs.html"));
@@ -677,7 +677,7 @@ TEST_F(SSLUITest, DISABLED_TestCloseTabWithUnsafePopup) {
if (HasFailure())
return;
- scoped_ptr<TabProxy> tab(GetActiveTabProxy());
+ scoped_refptr<TabProxy> tab(GetActiveTabProxy());
NavigateTab(tab.get(),
http_server->TestServerPageW(
L"files/ssl/page_with_unsafe_popup.html"));
@@ -688,7 +688,7 @@ TEST_F(SSLUITest, DISABLED_TestCloseTabWithUnsafePopup) {
// Let's add another tab to make sure the browser does not exit when we close
// the first tab.
- scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
EXPECT_TRUE(browser_proxy.get());
browser_proxy->AppendTab(
http_server->TestServerPageW(L"files/ssl/google.html"));
@@ -704,7 +704,7 @@ TEST_F(SSLUITest, TestRedirectBadToGoodHTTPS) {
if (HasFailure())
return;
- scoped_ptr<TabProxy> tab(GetActiveTabProxy());
+ scoped_refptr<TabProxy> tab(GetActiveTabProxy());
GURL url1 = bad_https_server->TestServerPageW(L"server-redirect?");
GURL url2 = good_https_server->TestServerPageW(L"files/ssl/google.html");
NavigateTab(tab.get(), GURL(url1.spec() + url2.spec()));
@@ -739,7 +739,7 @@ TEST_F(SSLUITest, TestRedirectGoodToBadHTTPS) {
if (HasFailure())
return;
- scoped_ptr<TabProxy> tab(GetActiveTabProxy());
+ scoped_refptr<TabProxy> tab(GetActiveTabProxy());
GURL url1 = good_https_server->TestServerPageW(L"server-redirect?");
GURL url2 = bad_https_server->TestServerPageW(L"files/ssl/google.html");
NavigateTab(tab.get(), GURL(url1.spec() + url2.spec()));
@@ -771,7 +771,7 @@ TEST_F(SSLUITest, TestRedirectHTTPToHTTPS) {
return;
// HTTP redirects to good HTTPS.
- scoped_ptr<TabProxy> tab(GetActiveTabProxy());
+ scoped_refptr<TabProxy> tab(GetActiveTabProxy());
GURL http_url = http_server->TestServerPageW(L"server-redirect?");
GURL good_https_url =
good_https_server->TestServerPageW(L"files/ssl/google.html");
@@ -814,7 +814,7 @@ TEST_F(SSLUITest, TestRedirectHTTPSToHTTP) {
if (HasFailure())
return;
- scoped_ptr<TabProxy> tab(GetActiveTabProxy());
+ scoped_refptr<TabProxy> tab(GetActiveTabProxy());
GURL https_url = https_server->TestServerPageW(L"server-redirect?");
GURL http_url = http_server->TestServerPageW(L"files/ssl/google.html");
NavigateTab(tab.get(), GURL(https_url.spec() + http_url.spec()));
@@ -832,7 +832,7 @@ TEST_F(SSLUITest, TestRedirectHTTPSToHTTP) {
// Visits a page to which we could not connect (bad port) over http and https
// and make sure the security style is correct.
TEST_F(SSLUITest, TestConnectToBadPort) {
- scoped_ptr<TabProxy> tab(GetActiveTabProxy());
+ scoped_refptr<TabProxy> tab(GetActiveTabProxy());
GURL http_url("http://localhost:17");
NavigateTab(tab.get(), http_url);
@@ -873,7 +873,7 @@ TEST_F(SSLUITest, TestGoodFrameNavigation) {
if (HasFailure())
return;
- scoped_ptr<TabProxy> tab(GetActiveTabProxy());
+ scoped_refptr<TabProxy> tab(GetActiveTabProxy());
NavigateTab(tab.get(),
good_https_server->TestServerPageW(L"files/ssl/top_frame.html"));
@@ -970,7 +970,7 @@ TEST_F(SSLUITest, TestBadFrameNavigation) {
if (HasFailure())
return;
- scoped_ptr<TabProxy> tab(GetActiveTabProxy());
+ scoped_refptr<TabProxy> tab(GetActiveTabProxy());
NavigateTab(tab.get(),
bad_https_server->TestServerPageW(L"files/ssl/top_frame.html"));
@@ -1015,7 +1015,7 @@ TEST_F(SSLUITest, TestUnauthenticatedFrameNavigation) {
if (HasFailure())
return;
- scoped_ptr<TabProxy> tab(GetActiveTabProxy());
+ scoped_refptr<TabProxy> tab(GetActiveTabProxy());
NavigateTab(tab.get(),
http_server->TestServerPageW(L"files/ssl/top_frame.html"));
diff --git a/chrome/browser/tab_contents/view_source_uitest.cc b/chrome/browser/tab_contents/view_source_uitest.cc
index 79e199c..dd01e49 100644
--- a/chrome/browser/tab_contents/view_source_uitest.cc
+++ b/chrome/browser/tab_contents/view_source_uitest.cc
@@ -19,7 +19,7 @@ class ViewSourceTest : public UITest {
}
bool IsPageMenuCommandEnabled(int command) {
- scoped_ptr<BrowserProxy> window_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window_proxy(automation()->GetBrowserWindow(0));
if (!window_proxy.get())
return false;
@@ -45,7 +45,7 @@ TEST_F(ViewSourceTest, DoesBrowserRenderInViewSource) {
// First we navigate to our view-source test page
GURL url = server->TestServerPageW(test_html_);
url = GURL("view-source:" + url.spec());
- scoped_ptr<TabProxy> tab(GetActiveTab());
+ scoped_refptr<TabProxy> tab(GetActiveTab());
tab->NavigateToURL(url);
PlatformThread::Sleep(sleep_timeout_ms());
diff --git a/chrome/browser/tab_restore_uitest.cc b/chrome/browser/tab_restore_uitest.cc
index d5d1239..bf399fb 100644
--- a/chrome/browser/tab_restore_uitest.cc
+++ b/chrome/browser/tab_restore_uitest.cc
@@ -45,13 +45,12 @@ class TabRestoreUITest : public UITest {
ASSERT_GT(window_count, 0);
bool expect_new_window = (expected_window_index == window_count);
- scoped_ptr<BrowserProxy> browser_proxy;
+ scoped_refptr<BrowserProxy> browser_proxy;
if (expect_new_window) {
- browser_proxy.reset(automation()->GetBrowserWindow(0));
+ browser_proxy = automation()->GetBrowserWindow(0);
} else {
ASSERT_GT(window_count, expected_window_index);
- browser_proxy.reset(
- automation()->GetBrowserWindow(expected_window_index));
+ browser_proxy = automation()->GetBrowserWindow(expected_window_index);
}
ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count));
ASSERT_GT(tab_count, 0);
@@ -63,8 +62,7 @@ class TabRestoreUITest : public UITest {
int new_window_count = 0;
ASSERT_TRUE(automation()->GetBrowserWindowCount(&new_window_count));
EXPECT_EQ(++window_count, new_window_count);
- browser_proxy.reset(automation()->
- GetBrowserWindow(expected_window_index));
+ browser_proxy = automation()->GetBrowserWindow(expected_window_index);
} else {
int new_tab_count = 0;
ASSERT_TRUE(browser_proxy->GetTabCount(&new_tab_count));
@@ -74,7 +72,7 @@ class TabRestoreUITest : public UITest {
// Get a handle to the restored tab.
ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count));
ASSERT_GT(tab_count, expected_tabstrip_index);
- scoped_ptr<TabProxy> restored_tab_proxy(
+ scoped_refptr<TabProxy> restored_tab_proxy(
browser_proxy->GetTab(expected_tabstrip_index));
// Wait for the restored tab to finish loading.
ASSERT_TRUE(restored_tab_proxy->WaitForTabToBeRestored(
@@ -115,7 +113,7 @@ class TabRestoreUITest : public UITest {
return;
bool is_active = false;
- scoped_ptr<WindowProxy> window_proxy(browser->GetWindow());
+ scoped_refptr<WindowProxy> window_proxy(browser->GetWindow());
ASSERT_TRUE(window_proxy->IsActive(&is_active));
// The check for is_active may fail if other apps are active while running
// the tests, because Chromium won't be the foremost application at all.
@@ -136,19 +134,19 @@ class TabRestoreUITest : public UITest {
// Close the end tab in the current window, then restore it. The tab should be
// in its original position, and active.
TEST_F(TabRestoreUITest, Basic) {
- scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
int starting_tab_count;
ASSERT_TRUE(browser_proxy->GetTabCount(&starting_tab_count));
int tab_count = AddSomeTabs(browser_proxy.get(), 1);
int closed_tab_index = tab_count - 1;
- scoped_ptr<TabProxy> new_tab(browser_proxy->GetTab(closed_tab_index));
+ scoped_refptr<TabProxy> new_tab(browser_proxy->GetTab(closed_tab_index));
// Make sure we're at url.
new_tab->NavigateToURL(url1_);
// Close the tab.
new_tab->Close(true);
- new_tab.reset();
+ new_tab = NULL;
ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count));
EXPECT_EQ(starting_tab_count, tab_count);
@@ -164,7 +162,7 @@ TEST_F(TabRestoreUITest, Basic) {
// Close a tab not at the end of the current window, then restore it. The tab
// should be in its original position, and active.
TEST_F(TabRestoreUITest, MiddleTab) {
- scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
int starting_tab_count;
ASSERT_TRUE(browser_proxy->GetTabCount(&starting_tab_count));
@@ -172,12 +170,12 @@ TEST_F(TabRestoreUITest, MiddleTab) {
// Close one in the middle
int closed_tab_index = starting_tab_count + 1;
- scoped_ptr<TabProxy> new_tab(browser_proxy->GetTab(closed_tab_index));
+ scoped_refptr<TabProxy> new_tab(browser_proxy->GetTab(closed_tab_index));
// Make sure we're at url.
new_tab->NavigateToURL(url1_);
// Close the tab.
new_tab->Close(true);
- new_tab.reset();
+ new_tab = NULL;
ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count));
EXPECT_EQ(starting_tab_count + 2, tab_count);
@@ -193,7 +191,7 @@ TEST_F(TabRestoreUITest, MiddleTab) {
// Close a tab, switch windows, then restore the tab. The tab should be in its
// original window and position, and active.
TEST_F(TabRestoreUITest, RestoreToDifferentWindow) {
- scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
// This call is virtually guaranteed to pass, assuming that Chromium is the
// active application, which will establish a baseline for later calls to
@@ -206,12 +204,12 @@ TEST_F(TabRestoreUITest, RestoreToDifferentWindow) {
// Close one in the middle
int closed_tab_index = starting_tab_count + 1;
- scoped_ptr<TabProxy> new_tab(browser_proxy->GetTab(closed_tab_index));
+ scoped_refptr<TabProxy> new_tab(browser_proxy->GetTab(closed_tab_index));
// Make sure we're at url.
new_tab->NavigateToURL(url1_);
// Close the tab.
new_tab->Close(true);
- new_tab.reset();
+ new_tab = NULL;
ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count));
EXPECT_EQ(starting_tab_count + 2, tab_count);
@@ -237,7 +235,7 @@ TEST_F(TabRestoreUITest, RestoreToDifferentWindow) {
// Close a tab, open a new window, close the first window, then restore the
// tab. It should be in a new window.
TEST_F(TabRestoreUITest, BasicRestoreFromClosedWindow) {
- scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
CheckActiveWindow(browser_proxy.get());
int tab_count;
@@ -245,13 +243,13 @@ TEST_F(TabRestoreUITest, BasicRestoreFromClosedWindow) {
// Close tabs until we only have one open.
while (tab_count > 1) {
- scoped_ptr<TabProxy> tab_to_close(browser_proxy->GetTab(0));
+ scoped_refptr<TabProxy> tab_to_close(browser_proxy->GetTab(0));
tab_to_close->Close(true);
ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count));
}
// Navigate to url1 then url2.
- scoped_ptr<TabProxy> tab_proxy(browser_proxy->GetTab(0));
+ scoped_refptr<TabProxy> tab_proxy(browser_proxy->GetTab(0));
tab_proxy->NavigateToURL(url1_);
tab_proxy->NavigateToURL(url2_);
@@ -268,15 +266,15 @@ TEST_F(TabRestoreUITest, BasicRestoreFromClosedWindow) {
1, action_max_timeout_ms()));
// Tab and browser are no longer valid.
- tab_proxy.reset();
- browser_proxy.reset();
+ tab_proxy = NULL;
+ browser_proxy = NULL;
RestoreTab(1, 0);
// Tab should be in a new window.
- browser_proxy.reset(automation()->GetBrowserWindow(1));
+ browser_proxy = automation()->GetBrowserWindow(1);
CheckActiveWindow(browser_proxy.get());
- tab_proxy.reset(browser_proxy->GetActiveTab());
+ tab_proxy = browser_proxy->GetActiveTab();
// And make sure the URLs matches.
EXPECT_EQ(url2_, GetActiveTabURL(1));
EXPECT_TRUE(tab_proxy->GoBack());
@@ -286,7 +284,7 @@ TEST_F(TabRestoreUITest, BasicRestoreFromClosedWindow) {
// Open a window with multiple tabs, close a tab, then close the window.
// Restore both and make sure the tab goes back into the window.
TEST_F(TabRestoreUITest, RestoreWindowAndTab) {
- scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
CheckActiveWindow(browser_proxy.get());
int starting_tab_count;
@@ -295,12 +293,12 @@ TEST_F(TabRestoreUITest, RestoreWindowAndTab) {
// Close one in the middle
int closed_tab_index = starting_tab_count + 1;
- scoped_ptr<TabProxy> new_tab(browser_proxy->GetTab(closed_tab_index));
+ scoped_refptr<TabProxy> new_tab(browser_proxy->GetTab(closed_tab_index));
// Make sure we're at url.
new_tab->NavigateToURL(url1_);
// Close the tab.
new_tab->Close(true);
- new_tab.reset();
+ new_tab = NULL;
ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count));
EXPECT_EQ(starting_tab_count + 2, tab_count);
@@ -319,12 +317,12 @@ TEST_F(TabRestoreUITest, RestoreWindowAndTab) {
EXPECT_EQ(1, window_count);
// Browser is no longer valid.
- browser_proxy.reset();
+ browser_proxy = NULL;
// Restore the first window. The expected_tabstrip_index (second argument)
// indicates the expected active tab.
RestoreTab(1, starting_tab_count + 1);
- browser_proxy.reset(automation()->GetBrowserWindow(1));
+ browser_proxy = automation()->GetBrowserWindow(1);
CheckActiveWindow(browser_proxy.get());
ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count));
EXPECT_EQ(starting_tab_count + 2, tab_count);
@@ -340,7 +338,7 @@ TEST_F(TabRestoreUITest, RestoreWindowAndTab) {
// Open a window with two tabs, close both (closing the window), then restore
// both. Make sure both restored tabs are in the same window.
TEST_F(TabRestoreUITest, RestoreIntoSameWindow) {
- scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
CheckActiveWindow(browser_proxy.get());
int starting_tab_count;
@@ -348,7 +346,7 @@ TEST_F(TabRestoreUITest, RestoreIntoSameWindow) {
int tab_count = AddSomeTabs(browser_proxy.get(), 2);
// Navigate the rightmost one to url2_ for easier identification.
- scoped_ptr<TabProxy> tab_proxy(browser_proxy->GetTab(tab_count - 1));
+ scoped_refptr<TabProxy> tab_proxy(browser_proxy->GetTab(tab_count - 1));
tab_proxy->NavigateToURL(url2_);
// Create a new browser.
@@ -360,22 +358,22 @@ TEST_F(TabRestoreUITest, RestoreIntoSameWindow) {
// Close all but one tab in the first browser, left to right.
while (tab_count > 1) {
- scoped_ptr<TabProxy> tab_to_close(browser_proxy->GetTab(0));
+ scoped_refptr<TabProxy> tab_to_close(browser_proxy->GetTab(0));
tab_to_close->Close(true);
ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count));
}
// Close the last tab, closing the browser.
- tab_proxy.reset(browser_proxy->GetTab(0));
+ tab_proxy = browser_proxy->GetTab(0);
EXPECT_TRUE(tab_proxy->Close(true));
ASSERT_TRUE(automation()->WaitForWindowCountToBecome(
1, action_max_timeout_ms()));
- browser_proxy.reset();
- tab_proxy.reset();
+ browser_proxy = NULL;
+ tab_proxy = NULL;
// Restore the last-closed tab into a new window.
RestoreTab(1, 0);
- browser_proxy.reset(automation()->GetBrowserWindow(1));
+ browser_proxy = automation()->GetBrowserWindow(1);
CheckActiveWindow(browser_proxy.get());
ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count));
EXPECT_EQ(1, tab_count);
@@ -399,7 +397,7 @@ TEST_F(TabRestoreUITest, RestoreWithExistingSiteInstance) {
GURL http_url1(server->TestServerPageW(L"files/title1.html"));
GURL http_url2(server->TestServerPageW(L"files/title2.html"));
- scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
int tab_count;
ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count));
@@ -408,14 +406,14 @@ TEST_F(TabRestoreUITest, RestoreWithExistingSiteInstance) {
int new_tab_count;
ASSERT_TRUE(browser_proxy->GetTabCount(&new_tab_count));
EXPECT_EQ(++tab_count, new_tab_count);
- scoped_ptr<TabProxy> tab(browser_proxy->GetTab(tab_count - 1));
+ scoped_refptr<TabProxy> tab(browser_proxy->GetTab(tab_count - 1));
// Navigate to another same-site URL.
tab->NavigateToURL(http_url2);
// Close the tab.
tab->Close(true);
- tab.reset();
+ tab = NULL;
// Create a new tab to the original site. Assuming process-per-site is
// enabled, this will ensure that the SiteInstance used by the restored tab
@@ -424,7 +422,7 @@ TEST_F(TabRestoreUITest, RestoreWithExistingSiteInstance) {
// Restore the closed tab.
RestoreTab(0, tab_count - 1);
- tab.reset(browser_proxy->GetActiveTab());
+ tab = browser_proxy->GetActiveTab();
// And make sure the URLs match.
EXPECT_EQ(http_url2, GetActiveTabURL());
@@ -443,7 +441,7 @@ TEST_F(TabRestoreUITest, RestoreCrossSiteWithExistingSiteInstance) {
GURL http_url1(server->TestServerPageW(L"files/title1.html"));
GURL http_url2(server->TestServerPageW(L"files/title2.html"));
- scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
int tab_count;
ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count));
@@ -452,7 +450,7 @@ TEST_F(TabRestoreUITest, RestoreCrossSiteWithExistingSiteInstance) {
int new_tab_count;
ASSERT_TRUE(browser_proxy->GetTabCount(&new_tab_count));
EXPECT_EQ(++tab_count, new_tab_count);
- scoped_ptr<TabProxy> tab(browser_proxy->GetTab(tab_count - 1));
+ scoped_refptr<TabProxy> tab(browser_proxy->GetTab(tab_count - 1));
// Navigate to more URLs, then a cross-site URL.
tab->NavigateToURL(http_url2);
@@ -461,7 +459,7 @@ TEST_F(TabRestoreUITest, RestoreCrossSiteWithExistingSiteInstance) {
// Close the tab.
tab->Close(true);
- tab.reset();
+ tab = NULL;
// Create a new tab to the original site. Assuming process-per-site is
// enabled, this will ensure that the SiteInstance will already exist when
@@ -470,7 +468,7 @@ TEST_F(TabRestoreUITest, RestoreCrossSiteWithExistingSiteInstance) {
// Restore the closed tab.
RestoreTab(0, tab_count - 1);
- tab.reset(browser_proxy->GetActiveTab());
+ tab = browser_proxy->GetActiveTab();
// And make sure the URLs match.
EXPECT_EQ(url1_, GetActiveTabURL());
@@ -494,47 +492,46 @@ TEST_F(TabRestoreUITest, RestoreWindow) {
EXPECT_EQ(++window_count, new_window_count);
// Create two more tabs, one with url1, the other url2.
- scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
int initial_tab_count;
ASSERT_TRUE(browser_proxy->GetTabCount(&initial_tab_count));
browser_proxy->AppendTab(url1_);
ASSERT_TRUE(browser_proxy->WaitForTabCountToBecome(initial_tab_count + 1,
action_max_timeout_ms()));
- scoped_ptr<TabProxy> new_tab(browser_proxy->GetTab(initial_tab_count));
+ scoped_refptr<TabProxy> new_tab(browser_proxy->GetTab(initial_tab_count));
new_tab->NavigateToURL(url1_);
browser_proxy->AppendTab(url2_);
ASSERT_TRUE(browser_proxy->WaitForTabCountToBecome(initial_tab_count + 2,
action_max_timeout_ms()));
- new_tab.reset(browser_proxy->GetTab(initial_tab_count + 1));
+ new_tab = browser_proxy->GetTab(initial_tab_count + 1);
new_tab->NavigateToURL(url2_);
// Close the window.
ASSERT_TRUE(browser_proxy->RunCommand(IDC_CLOSE_WINDOW));
- browser_proxy.reset();
- new_tab.reset();
+ browser_proxy = NULL;
+ new_tab = NULL;
ASSERT_TRUE(automation()->GetBrowserWindowCount(&new_window_count));
EXPECT_EQ(window_count - 1, new_window_count);
// Restore the window.
- browser_proxy.reset(automation()->GetBrowserWindow(0));
+ browser_proxy = automation()->GetBrowserWindow(0);
ASSERT_TRUE(browser_proxy->RunCommand(IDC_RESTORE_TAB));
ASSERT_TRUE(automation()->GetBrowserWindowCount(&new_window_count));
EXPECT_EQ(window_count, new_window_count);
- browser_proxy.reset(automation()->GetBrowserWindow(1));
+ browser_proxy = automation()->GetBrowserWindow(1);
int tab_count;
EXPECT_TRUE(browser_proxy->GetTabCount(&tab_count));
EXPECT_EQ(initial_tab_count + 2, tab_count);
- scoped_ptr<TabProxy> restored_tab_proxy(
+ scoped_refptr<TabProxy> restored_tab_proxy(
browser_proxy->GetTab(initial_tab_count));
ASSERT_TRUE(restored_tab_proxy->WaitForTabToBeRestored(action_timeout_ms()));
GURL url;
ASSERT_TRUE(restored_tab_proxy->GetCurrentURL(&url));
EXPECT_TRUE(url == url1_);
- restored_tab_proxy.reset(
- browser_proxy->GetTab(initial_tab_count + 1));
+ restored_tab_proxy = browser_proxy->GetTab(initial_tab_count + 1);
ASSERT_TRUE(restored_tab_proxy->WaitForTabToBeRestored(action_timeout_ms()));
ASSERT_TRUE(restored_tab_proxy->GetCurrentURL(&url));
EXPECT_TRUE(url == url2_);
diff --git a/chrome/browser/unload_uitest.cc b/chrome/browser/unload_uitest.cc
index baaa496..dd2a56c 100644
--- a/chrome/browser/unload_uitest.cc
+++ b/chrome/browser/unload_uitest.cc
@@ -146,7 +146,7 @@ class UnloadTest : public UITest {
void LoadUrlAndQuitBrowser(const std::string& html_content,
const std::wstring& expected_title = L"") {
- scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
NavigateToDataURL(html_content, expected_title);
bool application_closed = false;
EXPECT_TRUE(CloseBrowser(browser.get(), &application_closed));
@@ -239,7 +239,7 @@ TEST_F(UnloadTest, BrowserCloseUnload) {
// Tests closing the browser with a beforeunload handler and clicking
// OK in the beforeunload confirm dialog.
TEST_F(UnloadTest, BrowserCloseBeforeUnloadOK) {
- scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
NavigateToDataURL(BEFORE_UNLOAD_HTML, L"beforeunload");
CloseBrowserAsync(browser.get());
@@ -251,7 +251,7 @@ TEST_F(UnloadTest, BrowserCloseBeforeUnloadOK) {
// Tests closing the browser with a beforeunload handler and clicking
// CANCEL in the beforeunload confirm dialog.
TEST_F(UnloadTest, BrowserCloseBeforeUnloadCancel) {
- scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
NavigateToDataURL(BEFORE_UNLOAD_HTML, L"beforeunload");
CloseBrowserAsync(browser.get());
@@ -336,26 +336,26 @@ TEST_F(UnloadTest, BrowserCloseTabWhenOtherTabHasListener) {
automation()->GetBrowserWindowCount(&window_count);
ASSERT_EQ(2, window_count);
- scoped_ptr<BrowserProxy> popup_browser_proxy(
+ scoped_refptr<BrowserProxy> popup_browser_proxy(
automation()->GetBrowserWindow(1));
ASSERT_TRUE(popup_browser_proxy.get());
int popup_tab_count;
EXPECT_TRUE(popup_browser_proxy->GetTabCount(&popup_tab_count));
EXPECT_EQ(1, popup_tab_count);
- scoped_ptr<TabProxy> popup_tab(popup_browser_proxy->GetActiveTab());
+ scoped_refptr<TabProxy> popup_tab(popup_browser_proxy->GetActiveTab());
std::wstring popup_title;
ASSERT_TRUE(popup_tab.get() != NULL);
EXPECT_TRUE(popup_tab->GetTabTitle(&popup_title));
EXPECT_EQ(std::wstring(L"popup"), popup_title);
EXPECT_TRUE(popup_tab->Close(true));
- scoped_ptr<BrowserProxy> main_browser_proxy(
+ scoped_refptr<BrowserProxy> main_browser_proxy(
automation()->GetBrowserWindow(0));
ASSERT_TRUE(main_browser_proxy.get());
int main_tab_count;
EXPECT_TRUE(main_browser_proxy->GetTabCount(&main_tab_count));
EXPECT_EQ(1, main_tab_count);
- scoped_ptr<TabProxy> main_tab(main_browser_proxy->GetActiveTab());
+ scoped_refptr<TabProxy> main_tab(main_browser_proxy->GetActiveTab());
std::wstring main_title;
ASSERT_TRUE(main_tab.get() != NULL);
EXPECT_TRUE(main_tab->GetTabTitle(&main_title));
diff --git a/chrome/browser/views/constrained_window_impl_interactive_uitest.cc b/chrome/browser/views/constrained_window_impl_interactive_uitest.cc
index 3faf68a..df8dd60 100644
--- a/chrome/browser/views/constrained_window_impl_interactive_uitest.cc
+++ b/chrome/browser/views/constrained_window_impl_interactive_uitest.cc
@@ -27,13 +27,13 @@ class InteractiveConstrainedWindowTest : public UITest {
virtual void SetUp() {
UITest::SetUp();
- browser_.reset(automation()->GetBrowserWindow(0));
+ browser_ = automation()->GetBrowserWindow(0);
ASSERT_TRUE(browser_.get());
- window_.reset(browser_->GetWindow());
+ window_ = browser_->GetWindow();
ASSERT_TRUE(window_.get());
- tab_.reset(browser_->GetTab(0));
+ tab_ = browser_->GetTab(0);
ASSERT_TRUE(tab_.get());
}
@@ -44,7 +44,7 @@ class InteractiveConstrainedWindowTest : public UITest {
ASSERT_TRUE(tab_->NavigateToURL(net::FilePathToFileURL(filename)));
}
- void SimulateClickInCenterOf(const scoped_ptr<WindowProxy>& window) {
+ void SimulateClickInCenterOf(const scoped_refptr<WindowProxy>& window) {
gfx::Rect tab_view_bounds;
ASSERT_TRUE(window->GetViewBounds(VIEW_ID_TAB_CONTAINER,
&tab_view_bounds, true));
@@ -57,9 +57,9 @@ class InteractiveConstrainedWindowTest : public UITest {
views::Event::EF_LEFT_BUTTON_DOWN));
}
- scoped_ptr<BrowserProxy> browser_;
- scoped_ptr<WindowProxy> window_;
- scoped_ptr<TabProxy> tab_;
+ scoped_refptr<BrowserProxy> browser_;
+ scoped_refptr<WindowProxy> window_;
+ scoped_refptr<TabProxy> tab_;
};
TEST_F(InteractiveConstrainedWindowTest, TestOpenAndResizeTo) {
@@ -68,9 +68,9 @@ TEST_F(InteractiveConstrainedWindowTest, TestOpenAndResizeTo) {
ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2, 1000));
- scoped_ptr<BrowserProxy> popup_browser(automation()->GetBrowserWindow(1));
+ scoped_refptr<BrowserProxy> popup_browser(automation()->GetBrowserWindow(1));
ASSERT_TRUE(popup_browser != NULL);
- scoped_ptr<WindowProxy> popup_window(popup_browser->GetWindow());
+ scoped_refptr<WindowProxy> popup_window(popup_browser->GetWindow());
ASSERT_TRUE(popup_window != NULL);
// Make sure we were created with the correct width and height.
@@ -127,16 +127,16 @@ TEST_F(InteractiveConstrainedWindowTest, DontSpawnEndlessPopups) {
ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2, 1000));
- scoped_ptr<BrowserProxy> popup_browser(automation()->GetBrowserWindow(1));
+ scoped_refptr<BrowserProxy> popup_browser(automation()->GetBrowserWindow(1));
ASSERT_TRUE(popup_browser.get());
- scoped_ptr<TabProxy> popup_tab(popup_browser->GetTab(0));
+ scoped_refptr<TabProxy> popup_tab(popup_browser->GetTab(0));
ASSERT_TRUE(popup_tab.get());
int constrained_window_count = 0;
ASSERT_TRUE(popup_tab->WaitForChildWindowCountToChange(
0, &constrained_window_count, 10000));
ASSERT_EQ(1, constrained_window_count);
- scoped_ptr<ConstrainedWindowProxy> constrained_window(
+ scoped_refptr<ConstrainedWindowProxy> constrained_window(
popup_tab->GetConstrainedWindow(0));
ASSERT_TRUE(constrained_window.get());
@@ -183,13 +183,13 @@ TEST_F(InteractiveConstrainedWindowTest, WindowOpenWindowClosePopup) {
PlatformThread::Sleep(1000);
// Make sure we have a blocked popup notification
- scoped_ptr<BrowserProxy> popup_browser(automation()->GetBrowserWindow(1));
+ scoped_refptr<BrowserProxy> popup_browser(automation()->GetBrowserWindow(1));
ASSERT_TRUE(popup_browser.get());
- scoped_ptr<WindowProxy> popup_window(popup_browser->GetWindow());
+ scoped_refptr<WindowProxy> popup_window(popup_browser->GetWindow());
ASSERT_TRUE(popup_window.get());
- scoped_ptr<TabProxy> popup_tab(popup_browser->GetTab(0));
+ scoped_refptr<TabProxy> popup_tab(popup_browser->GetTab(0));
ASSERT_TRUE(popup_tab.get());
- scoped_ptr<ConstrainedWindowProxy> popup_notification(
+ scoped_refptr<ConstrainedWindowProxy> popup_notification(
popup_tab->GetConstrainedWindow(0));
ASSERT_TRUE(popup_notification.get());
std::wstring title;
@@ -214,7 +214,7 @@ TEST_F(InteractiveConstrainedWindowTest, BlockAlertFromBlockedPopup) {
ASSERT_EQ(1, browser_window_count);
// Ensure one blocked popup window: the popup didn't escape.
- scoped_ptr<ConstrainedWindowProxy> popup_notification(
+ scoped_refptr<ConstrainedWindowProxy> popup_notification(
tab_->GetConstrainedWindow(0));
ASSERT_TRUE(popup_notification.get());
std::wstring title;
@@ -230,11 +230,11 @@ TEST_F(InteractiveConstrainedWindowTest, ShowAlertFromNormalPopup) {
ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2, 5000));
- scoped_ptr<BrowserProxy> popup_browser(automation()->GetBrowserWindow(1));
+ scoped_refptr<BrowserProxy> popup_browser(automation()->GetBrowserWindow(1));
ASSERT_TRUE(popup_browser.get());
- scoped_ptr<WindowProxy> popup_window(popup_browser->GetWindow());
+ scoped_refptr<WindowProxy> popup_window(popup_browser->GetWindow());
ASSERT_TRUE(popup_window.get());
- scoped_ptr<TabProxy> popup_tab(popup_browser->GetTab(0));
+ scoped_refptr<TabProxy> popup_tab(popup_browser->GetTab(0));
ASSERT_TRUE(popup_tab.get());
SimulateClickInCenterOf(popup_window);
diff --git a/chrome/browser/views/find_bar_win_interactive_uitest.cc b/chrome/browser/views/find_bar_win_interactive_uitest.cc
index 21d2db0..43ad35c 100644
--- a/chrome/browser/views/find_bar_win_interactive_uitest.cc
+++ b/chrome/browser/views/find_bar_win_interactive_uitest.cc
@@ -56,21 +56,21 @@ TEST_F(FindInPageTest, CrashEscHandlers) {
HTTPTestServer::CreateServer(kDocRoot, NULL);
ASSERT_TRUE(NULL != server.get());
- scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
ASSERT_TRUE(browser.get() != NULL);
- scoped_ptr<WindowProxy> window(browser->GetWindow());
+ scoped_refptr<WindowProxy> window(browser->GetWindow());
ASSERT_TRUE(window.get() != NULL);
// First we navigate to our test page (tab A).
GURL url = server->TestServerPageW(kSimplePage);
- scoped_ptr<TabProxy> tabA(GetActiveTab());
+ scoped_refptr<TabProxy> tabA(GetActiveTab());
EXPECT_NE(AUTOMATION_MSG_NAVIGATION_ERROR, tabA->NavigateToURL(url));
EXPECT_TRUE(browser->OpenFindInPage());
// Open another tab (tab B).
EXPECT_TRUE(browser->AppendTab(url));
- scoped_ptr<TabProxy> tabB(GetActiveTab());
+ scoped_refptr<TabProxy> tabB(GetActiveTab());
EXPECT_TRUE(browser->OpenFindInPage());
diff --git a/chrome/browser/views/find_bar_win_uitest.cc b/chrome/browser/views/find_bar_win_uitest.cc
index 6ec3200..5982e9e 100644
--- a/chrome/browser/views/find_bar_win_uitest.cc
+++ b/chrome/browser/views/find_bar_win_uitest.cc
@@ -25,11 +25,11 @@ TEST_F(FindInPageControllerTest, FindMovesOnTabClose_Issue1343052) {
ASSERT_TRUE(NULL != server.get());
GURL url = server->TestServerPageW(kSimplePage);
- scoped_ptr<TabProxy> tabA(GetActiveTab());
+ scoped_refptr<TabProxy> tabA(GetActiveTab());
ASSERT_TRUE(tabA->NavigateToURL(url));
WaitUntilTabCount(1);
- scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
ASSERT_TRUE(browser.get() != NULL);
// Toggle the bookmark bar state.
@@ -46,7 +46,7 @@ TEST_F(FindInPageControllerTest, FindMovesOnTabClose_Issue1343052) {
// Open another tab (tab B).
EXPECT_TRUE(browser->AppendTab(url));
- scoped_ptr<TabProxy> tabB(GetActiveTab());
+ scoped_refptr<TabProxy> tabB(GetActiveTab());
// Close tab B.
EXPECT_TRUE(tabB->Close(true));
@@ -67,7 +67,7 @@ TEST_F(FindInPageControllerTest, FindMovesOnTabClose_Issue1343052) {
// Open another tab (tab C).
EXPECT_TRUE(browser->AppendTab(url));
- scoped_ptr<TabProxy> tabC(GetActiveTab());
+ scoped_refptr<TabProxy> tabC(GetActiveTab());
// Close it.
EXPECT_TRUE(tabC->Close(true));
diff --git a/chrome/browser/views/tabs/tab_dragging_test.cc b/chrome/browser/views/tabs/tab_dragging_test.cc
index 18226a1..e187e71 100644
--- a/chrome/browser/views/tabs/tab_dragging_test.cc
+++ b/chrome/browser/views/tabs/tab_dragging_test.cc
@@ -29,9 +29,9 @@ protected:
// the position of Tab_2.
// Disabled as per http://crbug.com/10941
TEST_F(TabDraggingTest, DISABLED_Tab1Tab2) {
- scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
ASSERT_TRUE(browser.get());
- scoped_ptr<WindowProxy> window(browser->GetWindow());
+ scoped_refptr<WindowProxy> window(browser->GetWindow());
ASSERT_TRUE(window.get());
// Get initial tab count.
@@ -40,7 +40,7 @@ TEST_F(TabDraggingTest, DISABLED_Tab1Tab2) {
ASSERT_TRUE(1 == initial_tab_count);
// Get Tab_1 which comes with the browser window.
- scoped_ptr<TabProxy> tab1(browser->GetTab(0));
+ scoped_refptr<TabProxy> tab1(browser->GetTab(0));
ASSERT_TRUE(tab1.get());
GURL tab1_url;
ASSERT_TRUE(tab1->GetCurrentURL(&tab1_url));
@@ -48,13 +48,13 @@ TEST_F(TabDraggingTest, DISABLED_Tab1Tab2) {
// Add Tab_2.
GURL tab2_url("about:");
ASSERT_TRUE(browser->AppendTab(tab2_url));
- scoped_ptr<TabProxy> tab2(browser->GetTab(1));
+ scoped_refptr<TabProxy> tab2(browser->GetTab(1));
ASSERT_TRUE(tab2.get());
// Add Tab_3.
GURL tab3_url("about:plugins");
ASSERT_TRUE(browser->AppendTab(tab3_url));
- scoped_ptr<TabProxy> tab3(browser->GetTab(2));
+ scoped_refptr<TabProxy> tab3(browser->GetTab(2));
ASSERT_TRUE(tab3.get());
// Make sure 3 tabs are open.
@@ -113,12 +113,12 @@ TEST_F(TabDraggingTest, DISABLED_Tab1Tab2) {
false));
// Now check for expected results.
- tab1.reset(browser->GetTab(0));
+ tab1 = browser->GetTab(0);
ASSERT_TRUE(tab1.get());
GURL tab1_new_url;
ASSERT_TRUE(tab1->GetCurrentURL(&tab1_new_url));
- tab2.reset(browser->GetTab(1));
+ tab2 = browser->GetTab(1);
ASSERT_TRUE(tab2.get());
GURL tab2_new_url;
ASSERT_TRUE(tab2->GetCurrentURL(&tab2_new_url));
@@ -130,9 +130,9 @@ TEST_F(TabDraggingTest, DISABLED_Tab1Tab2) {
// Drag Tab_1 into the position of Tab_3.
// Disabled as per http://crbug.com/10941
TEST_F(TabDraggingTest, DISABLED_Tab1Tab3) {
- scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
ASSERT_TRUE(browser.get());
- scoped_ptr<WindowProxy> window(browser->GetWindow());
+ scoped_refptr<WindowProxy> window(browser->GetWindow());
ASSERT_TRUE(window.get());
// Get initial tab count.
@@ -141,7 +141,7 @@ TEST_F(TabDraggingTest, DISABLED_Tab1Tab3) {
ASSERT_TRUE(1 == initial_tab_count);
// Get Tab_1 which comes with the browser window.
- scoped_ptr<TabProxy> tab1(browser->GetTab(0));
+ scoped_refptr<TabProxy> tab1(browser->GetTab(0));
ASSERT_TRUE(tab1.get());
GURL tab1_url;
ASSERT_TRUE(tab1->GetCurrentURL(&tab1_url));
@@ -149,13 +149,13 @@ TEST_F(TabDraggingTest, DISABLED_Tab1Tab3) {
// Add Tab_2.
GURL tab2_url("about:");
ASSERT_TRUE(browser->AppendTab(tab2_url));
- scoped_ptr<TabProxy> tab2(browser->GetTab(1));
+ scoped_refptr<TabProxy> tab2(browser->GetTab(1));
ASSERT_TRUE(tab2.get());
// Add Tab_3.
GURL tab3_url("about:plugins");
ASSERT_TRUE(browser->AppendTab(tab3_url));
- scoped_ptr<TabProxy> tab3(browser->GetTab(2));
+ scoped_refptr<TabProxy> tab3(browser->GetTab(2));
ASSERT_TRUE(tab3.get());
// Make sure 3 tabs are open.
@@ -214,17 +214,17 @@ TEST_F(TabDraggingTest, DISABLED_Tab1Tab3) {
false));
// Now check for expected results.
- tab1.reset(browser->GetTab(0));
+ tab1 = browser->GetTab(0);
ASSERT_TRUE(tab1.get());
GURL tab1_new_url;
ASSERT_TRUE(tab1->GetCurrentURL(&tab1_new_url));
- tab2.reset(browser->GetTab(1));
+ tab2 = browser->GetTab(1);
ASSERT_TRUE(tab2.get());
GURL tab2_new_url;
ASSERT_TRUE(tab2->GetCurrentURL(&tab2_new_url));
- tab3.reset(browser->GetTab(2));
+ tab3 = browser->GetTab(2);
ASSERT_TRUE(tab3.get());
GURL tab3_new_url;
ASSERT_TRUE(tab3->GetCurrentURL(&tab3_new_url));
@@ -237,9 +237,9 @@ TEST_F(TabDraggingTest, DISABLED_Tab1Tab3) {
// Drag Tab_1 into the position of Tab_3, and press ESCAPE before releasing the
// left mouse button.
TEST_F(TabDraggingTest, Tab1Tab3Escape) {
- scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
ASSERT_TRUE(browser.get());
- scoped_ptr<WindowProxy> window(browser->GetWindow());
+ scoped_refptr<WindowProxy> window(browser->GetWindow());
ASSERT_TRUE(window.get());
// Get initial tab count.
@@ -248,7 +248,7 @@ TEST_F(TabDraggingTest, Tab1Tab3Escape) {
ASSERT_TRUE(1 == initial_tab_count);
// Get Tab_1 which comes with the browser window.
- scoped_ptr<TabProxy> tab1(browser->GetTab(0));
+ scoped_refptr<TabProxy> tab1(browser->GetTab(0));
ASSERT_TRUE(tab1.get());
GURL tab1_url;
ASSERT_TRUE(tab1->GetCurrentURL(&tab1_url));
@@ -256,13 +256,13 @@ TEST_F(TabDraggingTest, Tab1Tab3Escape) {
// Add Tab_2.
GURL tab2_url("about:");
ASSERT_TRUE(browser->AppendTab(tab2_url));
- scoped_ptr<TabProxy> tab2(browser->GetTab(1));
+ scoped_refptr<TabProxy> tab2(browser->GetTab(1));
ASSERT_TRUE(tab2.get());
// Add Tab_3.
GURL tab3_url("about:plugins");
ASSERT_TRUE(browser->AppendTab(tab3_url));
- scoped_ptr<TabProxy> tab3(browser->GetTab(2));
+ scoped_refptr<TabProxy> tab3(browser->GetTab(2));
ASSERT_TRUE(tab3.get());
// Make sure 3 tabs are open.
@@ -324,17 +324,17 @@ TEST_F(TabDraggingTest, Tab1Tab3Escape) {
true));
// Now check for expected results.
- tab1.reset(browser->GetTab(0));
+ tab1 = browser->GetTab(0);
ASSERT_TRUE(tab1.get());
GURL tab1_new_url;
ASSERT_TRUE(tab1->GetCurrentURL(&tab1_new_url));
- tab2.reset(browser->GetTab(1));
+ tab2 = browser->GetTab(1);
ASSERT_TRUE(tab2.get());
GURL tab2_new_url;
ASSERT_TRUE(tab2->GetCurrentURL(&tab2_new_url));
- tab3.reset(browser->GetTab(2));
+ tab3 = browser->GetTab(2);
ASSERT_TRUE(tab3.get());
GURL tab3_new_url;
ASSERT_TRUE(tab3->GetCurrentURL(&tab3_new_url));
@@ -347,9 +347,9 @@ TEST_F(TabDraggingTest, Tab1Tab3Escape) {
// Drag Tab_2 out of the Tab strip. A new window should open with this tab.
TEST_F(TabDraggingTest, Tab2OutOfTabStrip) {
- scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
ASSERT_TRUE(browser.get());
- scoped_ptr<WindowProxy> window(browser->GetWindow());
+ scoped_refptr<WindowProxy> window(browser->GetWindow());
ASSERT_TRUE(window.get());
// Get initial tab count.
@@ -358,7 +358,7 @@ TEST_F(TabDraggingTest, Tab2OutOfTabStrip) {
ASSERT_TRUE(1 == initial_tab_count);
// Get Tab_1 which comes with the browser window.
- scoped_ptr<TabProxy> tab1(browser->GetTab(0));
+ scoped_refptr<TabProxy> tab1(browser->GetTab(0));
ASSERT_TRUE(tab1.get());
GURL tab1_url;
ASSERT_TRUE(tab1->GetCurrentURL(&tab1_url));
@@ -366,13 +366,13 @@ TEST_F(TabDraggingTest, Tab2OutOfTabStrip) {
// Add Tab_2.
GURL tab2_url("about:version");
ASSERT_TRUE(browser->AppendTab(tab2_url));
- scoped_ptr<TabProxy> tab2(browser->GetTab(1));
+ scoped_refptr<TabProxy> tab2(browser->GetTab(1));
ASSERT_TRUE(tab2.get());
// Add Tab_3.
GURL tab3_url("about:plugins");
ASSERT_TRUE(browser->AppendTab(tab3_url));
- scoped_ptr<TabProxy> tab3(browser->GetTab(2));
+ scoped_refptr<TabProxy> tab3(browser->GetTab(2));
ASSERT_TRUE(tab3.get());
// Make sure 3 tabs are opened.
@@ -451,12 +451,12 @@ TEST_F(TabDraggingTest, Tab2OutOfTabStrip) {
ASSERT_EQ(2, new_tab_count);
// Get the two tabs - they are called Tab_1 and Tab_2 in the old window.
- tab1.reset(browser->GetTab(0));
+ tab1 = browser->GetTab(0);
ASSERT_TRUE(tab1.get());
GURL tab1_new_url;
ASSERT_TRUE(tab1->GetCurrentURL(&tab1_new_url));
- tab2.reset(browser->GetTab(1));
+ tab2 = browser->GetTab(1);
ASSERT_TRUE(tab2.get());
GURL tab2_new_url;
ASSERT_TRUE(tab2->GetCurrentURL(&tab2_new_url));
@@ -467,9 +467,9 @@ TEST_F(TabDraggingTest, Tab2OutOfTabStrip) {
EXPECT_EQ(tab2_new_url.spec(), tab3_url.spec());
// Now check to make sure a new window has opened.
- scoped_ptr<BrowserProxy> browser2(automation()->GetBrowserWindow(1));
+ scoped_refptr<BrowserProxy> browser2(automation()->GetBrowserWindow(1));
ASSERT_TRUE(browser2.get());
- scoped_ptr<WindowProxy> window2(browser2->GetWindow());
+ scoped_refptr<WindowProxy> window2(browser2->GetWindow());
ASSERT_TRUE(window2.get());
// Make sure that the new window has only one tab.
@@ -478,7 +478,7 @@ TEST_F(TabDraggingTest, Tab2OutOfTabStrip) {
ASSERT_EQ(1, tab_count_window_2);
// Get Tab_1_2 which should be Tab_1 in Window 2.
- scoped_ptr<TabProxy> tab1_2(browser2->GetTab(0));
+ scoped_refptr<TabProxy> tab1_2(browser2->GetTab(0));
ASSERT_TRUE(tab1_2.get());
GURL tab1_2_url;
ASSERT_TRUE(tab1_2->GetCurrentURL(&tab1_2_url));
diff --git a/chrome/common/logging_chrome_uitest.cc b/chrome/common/logging_chrome_uitest.cc
index 737028a..1211f8c 100644
--- a/chrome/common/logging_chrome_uitest.cc
+++ b/chrome/common/logging_chrome_uitest.cc
@@ -108,7 +108,7 @@ TEST_F(RendererCrashTest, Crash) {
// in process mode doesn't do the crashing.
expected_crashes_ = 0;
} else {
- scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
ASSERT_TRUE(browser->WaitForTabCountToBecome(1, action_max_timeout_ms()));
expected_crashes_ = 1;
}
diff --git a/chrome/common/net/cache_uitest.cc b/chrome/common/net/cache_uitest.cc
index acff6a0..1754d5a 100644
--- a/chrome/common/net/cache_uitest.cc
+++ b/chrome/common/net/cache_uitest.cc
@@ -95,7 +95,7 @@ void CacheTest::RunCacheTest(const std::wstring &url,
// Appends a new tab to the test chrome window and loads the specified URL.
void CacheTest::GetNewTab(AutomationProxy* automationProxy,
const GURL& tab_url) {
- scoped_ptr<BrowserProxy> window_proxy(automationProxy->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window_proxy(automationProxy->GetBrowserWindow(0));
ASSERT_TRUE(window_proxy.get());
ASSERT_TRUE(window_proxy->AppendTab(tab_url));
}
diff --git a/chrome/common/pref_service_uitest.cc b/chrome/common/pref_service_uitest.cc
index a357af6..f9e0da2 100644
--- a/chrome/common/pref_service_uitest.cc
+++ b/chrome/common/pref_service_uitest.cc
@@ -91,9 +91,9 @@ TEST_F(PreferenceServiceTest, PreservedWindowPlacementIsLoaded) {
DictionaryValue* root_dict = static_cast<DictionaryValue*>(root.get());
// Retrieve the screen rect for the launched window
- scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
ASSERT_TRUE(browser.get());
- scoped_ptr<WindowProxy> window(browser->GetWindow());
+ scoped_refptr<WindowProxy> window(browser->GetWindow());
HWND hWnd;
ASSERT_TRUE(window->GetHWND(&hWnd));
diff --git a/chrome/test/accessibility/accessibility_tests.cc b/chrome/test/accessibility/accessibility_tests.cc
index 7393f85..8b0cafb 100644
--- a/chrome/test/accessibility/accessibility_tests.cc
+++ b/chrome/test/accessibility/accessibility_tests.cc
@@ -133,12 +133,12 @@ TEST_F(AccessibilityTest, DISABLED_TestBackBtnStatusOnNewTab) {
GetState(acc_obj));
// Now check Back status in different situations.
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
ASSERT_TRUE(window.get());
int tab_count = -1;
// Set URL and check button status.
- scoped_ptr<TabProxy> tab1(window->GetTab(0));
+ scoped_refptr<TabProxy> tab1(window->GetTab(0));
ASSERT_TRUE(tab1.get());
FilePath test_file1(test_data_directory_);
test_file1 = test_file1.AppendASCII("title1.html");
@@ -235,12 +235,12 @@ TEST_F(AccessibilityTest, DISABLED_TestForwardBtnStatusOnNewTab) {
}
// Now check Back status in different situations.
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
ASSERT_TRUE(window.get());
int tab_count = -1;
// Set URL and check button status.
- scoped_ptr<TabProxy> tab1(window->GetTab(0));
+ scoped_refptr<TabProxy> tab1(window->GetTab(0));
ASSERT_TRUE(tab1.get());
FilePath test_file1(test_data_directory_);
test_file1 = test_file1.AppendASCII("title1.html");
@@ -322,11 +322,11 @@ TEST_F(AccessibilityTest, DISABLED_TestStarBtnStatusOnNewTab) {
EXPECT_EQ(STATE_SYSTEM_FOCUSABLE, GetState(acc_obj));
// Now, check Star status in different situations.
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
ASSERT_TRUE(window.get());
// Set URL and check button status.
- scoped_ptr<TabProxy> tab1(window->GetTab(0));
+ scoped_refptr<TabProxy> tab1(window->GetTab(0));
ASSERT_TRUE(tab1.get());
FilePath test_file1(test_data_directory_);
test_file1 = test_file1.AppendASCII("title1.html");
diff --git a/chrome/test/automated_ui_tests/automated_ui_test_base.cc b/chrome/test/automated_ui_tests/automated_ui_test_base.cc
index abd0cf3..bb96fd32 100644
--- a/chrome/test/automated_ui_tests/automated_ui_test_base.cc
+++ b/chrome/test/automated_ui_tests/automated_ui_test_base.cc
@@ -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 @@ bool AutomatedUITestBase::CloseActiveWindow() {
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::GoOffTheRecord() {
}
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 @@ bool AutomatedUITestBase::OpenAndActivateNewBrowserWindow(
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 @@ bool AutomatedUITestBase::OpenAndActivateNewBrowserWindow(
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 @@ bool AutomatedUITestBase::RunCommand(int browser_command) {
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 @@ TabProxy* AutomatedUITestBase::GetActiveTab() {
}
bool did_timeout;
- TabProxy* tab =
+ scoped_refptr<TabProxy> tab =
browser->GetActiveTabWithTimeout(action_max_timeout_ms(), &did_timeout);
if (did_timeout)
return NULL;
diff --git a/chrome/test/automated_ui_tests/automated_ui_test_base.h b/chrome/test/automated_ui_tests/automated_ui_test_base.h
index 731bf40..4724f83 100644
--- a/chrome/test/automated_ui_tests/automated_ui_test_base.h
+++ b/chrome/test/automated_ui_tests/automated_ui_test_base.h
@@ -62,7 +62,8 @@ class AutomatedUITestBase : public UITest {
// If optional parameter previous_browser is passed in, it is set to be the
// previous browser window when new window is successfully created, and the
// caller owns previous_browser.
- bool OpenAndActivateNewBrowserWindow(BrowserProxy** previous_browser);
+ bool OpenAndActivateNewBrowserWindow(
+ scoped_refptr<BrowserProxy>* previous_browser);
// Reload the active tab.
// Returns true if successful, false otherwise.
@@ -89,7 +90,7 @@ class AutomatedUITestBase : public UITest {
bool RunCommand(int browser_command);
void set_active_browser(BrowserProxy* browser) {
- active_browser_.reset(browser);
+ active_browser_ = browser;
}
BrowserProxy* active_browser() const { return active_browser_.get(); }
@@ -97,9 +98,9 @@ class AutomatedUITestBase : public UITest {
// create a corresponding TabProxy and transfer the ownership to caller.
// If success return the pointer to the newly created TabProxy and the
// caller owns the TabProxy. Return NULL otherwise.
- TabProxy* GetActiveTab();
+ scoped_refptr<TabProxy> GetActiveTab();
private:
- scoped_ptr<BrowserProxy> active_browser_;
+ scoped_refptr<BrowserProxy> active_browser_;
DISALLOW_COPY_AND_ASSIGN(AutomatedUITestBase);
};
diff --git a/chrome/test/automated_ui_tests/automated_ui_test_test.cc b/chrome/test/automated_ui_tests/automated_ui_test_test.cc
index bbdd042..3110aae 100644
--- a/chrome/test/automated_ui_tests/automated_ui_test_test.cc
+++ b/chrome/test/automated_ui_tests/automated_ui_test_test.cc
@@ -104,9 +104,8 @@ TEST_F(AutomatedUITestBase, OpenBrowserWindow) {
active_browser()->GetTabCount(&tab_count);
ASSERT_EQ(1, tab_count);
- BrowserProxy* previous_browser;
- ASSERT_TRUE(OpenAndActivateNewBrowserWindow(&previous_browser));
- scoped_ptr<BrowserProxy>browser_1(previous_browser);
+ scoped_refptr<BrowserProxy> browser_1;
+ ASSERT_TRUE(OpenAndActivateNewBrowserWindow(&browser_1));
automation()->GetBrowserWindowCount(&num_browser_windows);
ASSERT_EQ(2, num_browser_windows);
active_browser()->GetTabCount(&tab_count);
@@ -117,8 +116,8 @@ TEST_F(AutomatedUITestBase, OpenBrowserWindow) {
active_browser()->GetTabCount(&tab_count);
ASSERT_EQ(2, tab_count);
- ASSERT_TRUE(OpenAndActivateNewBrowserWindow(&previous_browser));
- scoped_ptr<BrowserProxy>browser_2(previous_browser);
+ scoped_refptr<BrowserProxy> browser_2;
+ ASSERT_TRUE(OpenAndActivateNewBrowserWindow(&browser_2));
automation()->GetBrowserWindowCount(&num_browser_windows);
ASSERT_EQ(3, num_browser_windows);
active_browser()->GetTabCount(&tab_count);
diff --git a/chrome/test/automated_ui_tests/automated_ui_tests.cc b/chrome/test/automated_ui_tests/automated_ui_tests.cc
index d935387..23c1ae4 100644
--- a/chrome/test/automated_ui_tests/automated_ui_tests.cc
+++ b/chrome/test/automated_ui_tests/automated_ui_tests.cc
@@ -591,7 +591,7 @@ bool AutomatedUITest::FuzzyTestDialog(int num_actions) {
}
bool AutomatedUITest::ForceCrash() {
- scoped_ptr<TabProxy> tab(GetActiveTab());
+ scoped_refptr<TabProxy> tab(GetActiveTab());
GURL test_url("about:crash");
bool did_timeout;
tab->NavigateToURLWithTimeout(test_url, kDebuggingTimeoutMsec, &did_timeout);
@@ -609,7 +609,7 @@ bool AutomatedUITest::DragActiveTab(bool drag_right, bool drag_out) {
return false;
}
- scoped_ptr<WindowProxy> window(
+ scoped_refptr<WindowProxy> window(
GetAndActivateWindowForBrowser(browser));
if (window.get() == NULL) {
AddErrorAttribute("active_window_not_found");
@@ -688,7 +688,7 @@ bool AutomatedUITest::DragActiveTab(bool drag_right, bool drag_out) {
return true;
}
-WindowProxy* AutomatedUITest::GetAndActivateWindowForBrowser(
+scoped_refptr<WindowProxy> AutomatedUITest::GetAndActivateWindowForBrowser(
BrowserProxy* browser) {
bool did_timeout;
if (!browser->BringToFrontWithTimeout(action_max_timeout_ms(),
@@ -697,13 +697,12 @@ WindowProxy* AutomatedUITest::GetAndActivateWindowForBrowser(
return NULL;
}
- WindowProxy* window = browser->GetWindow();
- return window;
+ return browser->GetWindow();
}
bool AutomatedUITest::SimulateKeyPressInActiveWindow(wchar_t key, int flags) {
- scoped_ptr<WindowProxy> window(automation()->GetActiveWindow());
+ scoped_refptr<WindowProxy> window(automation()->GetActiveWindow());
if (window.get() == NULL) {
AddErrorAttribute("active_window_not_found");
return false;
diff --git a/chrome/test/automated_ui_tests/automated_ui_tests.h b/chrome/test/automated_ui_tests/automated_ui_tests.h
index 39c12c4..9b35349 100644
--- a/chrome/test/automated_ui_tests/automated_ui_tests.h
+++ b/chrome/test/automated_ui_tests/automated_ui_tests.h
@@ -342,7 +342,7 @@ class AutomatedUITest : public AutomatedUITestBase {
// Returns the WindowProxy associated with the given BrowserProxy
// (transferring ownership of the pointer to the caller) and brings that
// window to the top.
- WindowProxy* GetAndActivateWindowForBrowser(BrowserProxy* browser);
+ scoped_refptr<WindowProxy> GetAndActivateWindowForBrowser(BrowserProxy* browser);
// Calls SimulateOSKeyPress on the active window. Simulates a key press at
// the OS level. |key| is the key pressed and |flags| specifies which
diff --git a/chrome/test/automation/automation_handle_tracker.cc b/chrome/test/automation/automation_handle_tracker.cc
index b843218..db688cc 100644
--- a/chrome/test/automation/automation_handle_tracker.cc
+++ b/chrome/test/automation/automation_handle_tracker.cc
@@ -33,40 +33,36 @@ AutomationHandleTracker::~AutomationHandleTracker() {
}
void AutomationHandleTracker::Add(AutomationResourceProxy* proxy) {
+ AutoLock lock(map_lock_);
handle_to_object_.insert(MapEntry(proxy->handle(), proxy));
}
void AutomationHandleTracker::Remove(AutomationResourceProxy* proxy) {
+ AutoLock lock(map_lock_);
HandleToObjectMap::iterator iter = handle_to_object_.find(proxy->handle());
- if (iter == handle_to_object_.end())
- return;
-
- HandleToObjectMap::iterator end_of_matching_objects =
- handle_to_object_.upper_bound(proxy->handle());
-
- while(iter != end_of_matching_objects) {
- if (iter->second == proxy) {
- handle_to_object_.erase(iter);
-
- // If we have no more proxy objects using this handle, tell the
- // app that it can clean up that handle. If the proxy isn't valid,
- // that means that the app has already discarded this handle, and
- // thus doesn't need to be notified that the handle is unused.
- if (proxy->is_valid() && handle_to_object_.count(proxy->handle()) == 0) {
- sender_->Send(new AutomationMsg_HandleUnused(0, proxy->handle()));
- }
- return;
- }
- ++iter;
+ if (iter != handle_to_object_.end()) {
+ handle_to_object_.erase(iter);
+ sender_->Send(new AutomationMsg_HandleUnused(0, proxy->handle()));
}
}
void AutomationHandleTracker::InvalidateHandle(AutomationHandle handle) {
- HandleToObjectMap::iterator iter = handle_to_object_.lower_bound(handle);
- HandleToObjectMap::const_iterator end_of_matching_objects =
- handle_to_object_.upper_bound(handle);
-
- for (; iter != end_of_matching_objects; ++iter) {
+ // Called in background thread.
+ AutoLock lock(map_lock_);
+ HandleToObjectMap::iterator iter = handle_to_object_.find(handle);
+ if (iter != handle_to_object_.end()) {
iter->second->Invalidate();
}
}
+
+AutomationResourceProxy* AutomationHandleTracker::GetResource(
+ AutomationHandle handle) {
+ DCHECK(handle);
+ AutoLock lock(map_lock_);
+ HandleToObjectMap::iterator iter = handle_to_object_.find(handle);
+ if (iter == handle_to_object_.end())
+ return NULL;
+
+ iter->second->AddRef();
+ return iter->second;
+}
diff --git a/chrome/test/automation/automation_handle_tracker.h b/chrome/test/automation/automation_handle_tracker.h
index 44eacab..98a9fb9 100644
--- a/chrome/test/automation/automation_handle_tracker.h
+++ b/chrome/test/automation/automation_handle_tracker.h
@@ -11,6 +11,8 @@
#include <map>
#include "base/basictypes.h"
+#include "base/lock.h"
+#include "base/ref_counted.h"
// This represents a value that the app's AutomationProvider returns
// when asked for a resource (like a window or tab).
@@ -19,7 +21,8 @@ typedef int AutomationHandle;
class AutomationHandleTracker;
class AutomationMessageSender;
-class AutomationResourceProxy {
+class AutomationResourceProxy
+ : public base::RefCountedThreadSafe<AutomationResourceProxy> {
public:
AutomationResourceProxy(AutomationHandleTracker* tracker,
AutomationMessageSender* sender,
@@ -88,15 +91,16 @@ class AutomationHandleTracker {
// identified that resource.
void InvalidateHandle(AutomationHandle handle);
+ AutomationResourceProxy* GetResource(AutomationHandle handle);
private:
typedef
- std::multimap<AutomationHandle, AutomationResourceProxy*> HandleToObjectMap;
+ std::map<AutomationHandle, AutomationResourceProxy*> HandleToObjectMap;
typedef std::pair<AutomationHandle, AutomationResourceProxy*> MapEntry;
HandleToObjectMap handle_to_object_;
AutomationMessageSender* sender_;
-
+ Lock map_lock_;
DISALLOW_EVIL_CONSTRUCTORS(AutomationHandleTracker);
};
diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc
index 9fc8193..13e0957 100644
--- a/chrome/test/automation/automation_proxy.cc
+++ b/chrome/test/automation/automation_proxy.cc
@@ -75,6 +75,62 @@ class AutomationMessageFilter : public IPC::ChannelProxy::MessageFilter {
AutomationProxy* server_;
};
+class TabProxyNotificationMessageFilter
+ : public IPC::ChannelProxy::MessageFilter {
+ public:
+ TabProxyNotificationMessageFilter(AutomationHandleTracker* tracker)
+ : tracker_ (tracker) {
+ }
+
+ virtual bool OnMessageReceived(const IPC::Message& message) {
+ if (message.is_sync())
+ return false;
+
+ if (message.is_reply())
+ return false;
+
+ bool tab_message = IsTabNotifyMessage(message);
+ if (tab_message == false)
+ return false;
+
+ // Read tab handle from the message.
+ int tab_handle = 0;
+ void* iter = NULL;
+ if (!message.ReadInt(&iter, &tab_handle))
+ return false;
+
+ // Get AddRef-ed pointer to corresponding TabProxy object
+ TabProxy* tab = static_cast<TabProxy*>(tracker_->GetResource(tab_handle));
+ if (tab) {
+ tab->OnMessageReceived(message);
+ tab->Release();
+ }
+ return true;
+ }
+
+ static bool IsTabNotifyMessage(const IPC::Message& message) {
+ bool tab_message = true;
+ IPC_BEGIN_MESSAGE_MAP(TabProxyNotificationMessageFilter, message)
+ IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_NavigationStateChanged, )
+ IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_UpdateTargetUrl, )
+#if defined(OS_WIN)
+ IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_HandleAccelerator, )
+#endif
+ IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_TabbedOut, )
+ IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_OpenURL, )
+ IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_DidNavigate, )
+ IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_NavigationFailed, )
+ IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_TabLoaded, )
+ IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_ForwardMessageToExternalHost, )
+
+ IPC_MESSAGE_UNHANDLED(tab_message = false);
+ IPC_END_MESSAGE_MAP()
+ return tab_message;
+ }
+
+ private:
+ AutomationHandleTracker* tracker_;
+};
} // anonymous namespace
@@ -339,8 +395,8 @@ bool AutomationProxy::WaitForURLDisplayed(GURL url, int wait_timeout) {
return false;
for (int i = 0; i < window_count; i++) {
- BrowserProxy* window = GetBrowserWindow(i);
- if (!window)
+ scoped_refptr<BrowserProxy> window = GetBrowserWindow(i);
+ if (!window.get())
break;
int tab_count;
@@ -348,8 +404,8 @@ bool AutomationProxy::WaitForURLDisplayed(GURL url, int wait_timeout) {
continue;
for (int j = 0; j < tab_count; j++) {
- TabProxy* tab = window->GetTab(j);
- if (!tab)
+ scoped_refptr<TabProxy> tab = window->GetTab(j);
+ if (!tab.get())
break;
GURL tab_url;
@@ -388,7 +444,7 @@ void AutomationProxy::OnChannelError() {
DLOG(ERROR) << "Channel error in AutomationProxy.";
}
-WindowProxy* AutomationProxy::GetActiveWindow() {
+scoped_refptr<WindowProxy> AutomationProxy::GetActiveWindow() {
int handle = 0;
if (!SendWithTimeout(new AutomationMsg_ActiveWindow(0, &handle),
@@ -396,10 +452,11 @@ WindowProxy* AutomationProxy::GetActiveWindow() {
return NULL;
}
- return new WindowProxy(this, tracker_.get(), handle);
+ return ProxyObjectFromHandle<WindowProxy>(handle);
}
-BrowserProxy* AutomationProxy::GetBrowserWindow(int window_index) {
+scoped_refptr<BrowserProxy> AutomationProxy::GetBrowserWindow(
+ int window_index) {
int handle = 0;
if (!SendWithTimeout(new AutomationMsg_BrowserWindow(0, window_index,
@@ -409,14 +466,10 @@ BrowserProxy* AutomationProxy::GetBrowserWindow(int window_index) {
return NULL;
}
- if (handle == 0) {
- return NULL;
- }
-
- return new BrowserProxy(this, tracker_.get(), handle);
+ return ProxyObjectFromHandle<BrowserProxy>(handle);
}
-BrowserProxy* AutomationProxy::FindNormalBrowserWindow() {
+scoped_refptr<BrowserProxy> AutomationProxy::FindNormalBrowserWindow() {
int handle = 0;
if (!SendWithTimeout(new AutomationMsg_FindNormalBrowserWindow(0, &handle),
@@ -424,14 +477,10 @@ BrowserProxy* AutomationProxy::FindNormalBrowserWindow() {
return NULL;
}
- if (handle == 0) {
- return NULL;
- }
-
- return new BrowserProxy(this, tracker_.get(), handle);
+ return ProxyObjectFromHandle<BrowserProxy>(handle);
}
-BrowserProxy* AutomationProxy::GetLastActiveBrowserWindow() {
+scoped_refptr<BrowserProxy> AutomationProxy::GetLastActiveBrowserWindow() {
int handle = 0;
if (!SendWithTimeout(new AutomationMsg_LastActiveBrowserWindow(
@@ -441,7 +490,7 @@ BrowserProxy* AutomationProxy::GetLastActiveBrowserWindow() {
return NULL;
}
- return new BrowserProxy(this, tracker_.get(), handle);
+ return ProxyObjectFromHandle<BrowserProxy>(handle);
}
#if defined(OS_POSIX)
@@ -491,11 +540,9 @@ bool AutomationProxy::OpenNewBrowserWindow(bool show) {
#if defined(OS_WIN)
// TODO(port): Replace HWNDs.
-TabProxy* AutomationProxy::CreateExternalTab(HWND parent,
- const gfx::Rect& dimensions,
- unsigned int style,
- bool incognito,
- HWND* external_tab_container) {
+scoped_refptr<TabProxy> AutomationProxy::CreateExternalTab(HWND parent,
+ const gfx::Rect& dimensions, unsigned int style, bool incognito,
+ HWND* external_tab_container) {
IPC::Message* response = NULL;
int handle = 0;
@@ -509,7 +556,25 @@ TabProxy* AutomationProxy::CreateExternalTab(HWND parent,
}
DCHECK(IsWindow(*external_tab_container));
-
+ DCHECK(tracker_->GetResource(handle) == NULL);
return new TabProxy(this, tracker_.get(), handle);
}
#endif // defined(OS_WIN)
+
+template <class T> scoped_refptr<T> AutomationProxy::ProxyObjectFromHandle(
+ int handle) {
+ if (!handle)
+ return NULL;
+
+ // Get AddRef-ed pointer to the object if handle is already seen.
+ T* p = static_cast<T*>(tracker_->GetResource(handle));
+ if (!p) {
+ p = new T(this, tracker_.get(), handle);
+ p->AddRef();
+ }
+
+ // Since there is no scoped_refptr::attach.
+ scoped_refptr<T> result;
+ result.swap(&p);
+ return result;
+}
diff --git a/chrome/test/automation/automation_proxy.h b/chrome/test/automation/automation_proxy.h
index 75c76cd..ca193e9 100644
--- a/chrome/test/automation/automation_proxy.h
+++ b/chrome/test/automation/automation_proxy.h
@@ -120,13 +120,13 @@ class AutomationProxy : public IPC::Channel::Listener,
//
// Use GetBrowserWindowCount to see how many browser windows you can ask for.
// Window numbers are 0-based.
- BrowserProxy* GetBrowserWindow(int window_index);
+ scoped_refptr<BrowserProxy> GetBrowserWindow(int window_index);
// Finds the first browser window that is not incognito mode and of type
// TYPE_NORMAL, and returns its corresponding BrowserProxy, transferring
// ownership of the pointer to the caller.
// On failure, returns NULL.
- BrowserProxy* FindNormalBrowserWindow();
+ scoped_refptr<BrowserProxy> FindNormalBrowserWindow();
// Returns the BrowserProxy for the browser window which was last active,
// transferring ownership of the pointer to the caller.
@@ -134,12 +134,12 @@ class AutomationProxy : public IPC::Channel::Listener,
// browser window no longer exists (for example, if it was closed),
// returns GetBrowserWindow(0). See crbug.com/10501. As for now this
// function is flakey.
- BrowserProxy* GetLastActiveBrowserWindow();
+ scoped_refptr<BrowserProxy> GetLastActiveBrowserWindow();
// Returns the WindowProxy for the currently active window, transferring
// ownership of the pointer to the caller.
// On failure, returns NULL.
- WindowProxy* GetActiveWindow();
+ scoped_refptr<WindowProxy> GetActiveWindow();
// Tells the browser to enable or disable network request filtering. Returns
// false if the message fails to send to the browser.
@@ -192,9 +192,9 @@ class AutomationProxy : public IPC::Channel::Listener,
// Creates a tab that can hosted in an external process. The function
// returns a TabProxy representing the tab as well as a window handle
// that can be reparented in another process.
- TabProxy* CreateExternalTab(HWND parent, const gfx::Rect& dimensions,
- unsigned int style, bool incognito,
- HWND* external_tab_container);
+ scoped_refptr<TabProxy> CreateExternalTab(HWND parent,
+ const gfx::Rect& dimensions, unsigned int style, bool incognito,
+ HWND* external_tab_container);
#endif // defined(OS_WIN)
int command_execution_timeout_ms() const {
@@ -216,6 +216,7 @@ class AutomationProxy : public IPC::Channel::Listener,
}
private:
+ template <class T> scoped_refptr<T> ProxyObjectFromHandle(int handle);
void InitializeChannelID();
void InitializeThread();
void InitializeChannel();
diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc
index ef7001c..cefef1fd 100644
--- a/chrome/test/automation/automation_proxy_uitest.cc
+++ b/chrome/test/automation/automation_proxy_uitest.cc
@@ -44,17 +44,17 @@ TEST_F(AutomationProxyTest, GetBrowserWindowCount) {
TEST_F(AutomationProxyTest, GetBrowserWindow) {
{
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
ASSERT_TRUE(window.get());
}
{
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(-1));
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(-1));
ASSERT_FALSE(window.get());
}
{
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(1));
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(1));
ASSERT_FALSE(window.get());
}
};
@@ -64,12 +64,12 @@ TEST_F(AutomationProxyTest, GetBrowserWindow) {
#if defined(OS_WIN)
TEST_F(AutomationProxyVisibleTest, WindowGetViewBounds) {
{
- scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
ASSERT_TRUE(browser.get());
- scoped_ptr<WindowProxy> window(browser->GetWindow());
+ scoped_refptr<WindowProxy> window(browser->GetWindow());
ASSERT_TRUE(window.get());
- scoped_ptr<TabProxy> tab1(browser->GetTab(0));
+ scoped_refptr<TabProxy> tab1(browser->GetTab(0));
ASSERT_TRUE(tab1.get());
GURL tab1_url;
ASSERT_TRUE(tab1->GetCurrentURL(&tab1_url));
@@ -77,7 +77,7 @@ TEST_F(AutomationProxyVisibleTest, WindowGetViewBounds) {
// Add another tab so we can simulate dragging.
ASSERT_TRUE(browser->AppendTab(GURL("about:")));
- scoped_ptr<TabProxy> tab2(browser->GetTab(1));
+ scoped_refptr<TabProxy> tab2(browser->GetTab(1));
ASSERT_TRUE(tab2.get());
GURL tab2_url;
ASSERT_TRUE(tab2->GetCurrentURL(&tab2_url));
@@ -121,12 +121,12 @@ TEST_F(AutomationProxyVisibleTest, WindowGetViewBounds) {
views::Event::EF_LEFT_BUTTON_DOWN));
// Check to see that the drag event successfully swapped the two tabs.
- tab1.reset(browser->GetTab(0));
+ tab1 = browser->GetTab(0);
ASSERT_TRUE(tab1.get());
GURL tab1_new_url;
ASSERT_TRUE(tab1->GetCurrentURL(&tab1_new_url));
- tab2.reset(browser->GetTab(1));
+ tab2 = browser->GetTab(1);
ASSERT_TRUE(tab2.get());
GURL tab2_new_url;
ASSERT_TRUE(tab2->GetCurrentURL(&tab2_new_url));
@@ -140,7 +140,7 @@ TEST_F(AutomationProxyVisibleTest, WindowGetViewBounds) {
#endif // defined(OS_WIN)
TEST_F(AutomationProxyTest, GetTabCount) {
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
ASSERT_TRUE(window.get());
int tab_count = 0;
@@ -149,7 +149,7 @@ TEST_F(AutomationProxyTest, GetTabCount) {
}
TEST_F(AutomationProxyTest, GetActiveTabIndex) {
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
ASSERT_TRUE(window.get());
int active_tab_index = -1;
@@ -158,7 +158,7 @@ TEST_F(AutomationProxyTest, GetActiveTabIndex) {
}
TEST_F(AutomationProxyVisibleTest, AppendTab) {
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
ASSERT_TRUE(window.get());
int original_tab_count;
@@ -187,7 +187,7 @@ TEST_F(AutomationProxyVisibleTest, AppendTab) {
// Append tab will also be active tab
ASSERT_TRUE(window->GetActiveTabIndex(&appended_tab_index));
- scoped_ptr<TabProxy> tab(window->GetTab(appended_tab_index));
+ scoped_refptr<TabProxy> tab(window->GetTab(appended_tab_index));
ASSERT_TRUE(tab.get());
std::wstring title;
ASSERT_TRUE(tab->GetTabTitle(&title));
@@ -195,7 +195,7 @@ TEST_F(AutomationProxyVisibleTest, AppendTab) {
}
TEST_F(AutomationProxyTest, ActivateTab) {
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
ASSERT_TRUE(window.get());
ASSERT_TRUE(window->AppendTab(GURL("about:blank")));
@@ -214,10 +214,10 @@ TEST_F(AutomationProxyTest, ActivateTab) {
TEST_F(AutomationProxyTest, GetTab) {
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
ASSERT_TRUE(window.get());
{
- scoped_ptr<TabProxy> tab(window->GetTab(0));
+ scoped_refptr<TabProxy> tab(window->GetTab(0));
ASSERT_TRUE(tab.get());
std::wstring title;
ASSERT_TRUE(tab->GetTabTitle(&title));
@@ -230,16 +230,15 @@ TEST_F(AutomationProxyTest, GetTab) {
}
{
- scoped_ptr<TabProxy> tab;
- tab.reset(window->GetTab(1));
+ scoped_refptr<TabProxy> tab(window->GetTab(1));
ASSERT_FALSE(tab.get());
}
};
TEST_F(AutomationProxyTest, NavigateToURL) {
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
ASSERT_TRUE(window.get());
- scoped_ptr<TabProxy> tab(window->GetTab(0));
+ scoped_refptr<TabProxy> tab(window->GetTab(0));
ASSERT_TRUE(tab.get());
std::wstring title;
@@ -258,9 +257,9 @@ TEST_F(AutomationProxyTest, NavigateToURL) {
}
TEST_F(AutomationProxyTest, NavigateToURLWithTimeout1) {
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
ASSERT_TRUE(window.get());
- scoped_ptr<TabProxy> tab(window->GetTab(0));
+ scoped_refptr<TabProxy> tab(window->GetTab(0));
ASSERT_TRUE(tab.get());
FilePath filename(test_data_directory_);
@@ -281,10 +280,9 @@ TEST_F(AutomationProxyTest, NavigateToURLWithTimeout1) {
}
TEST_F(AutomationProxyTest, NavigateToURLWithTimeout2) {
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
ASSERT_TRUE(window.get());
- scoped_ptr<TabProxy> tab(window->GetTab(0));
- tab.reset(window->GetTab(0));
+ scoped_refptr<TabProxy> tab(window->GetTab(0));
ASSERT_TRUE(tab.get());
FilePath filename1(test_data_directory_);
@@ -303,9 +301,9 @@ TEST_F(AutomationProxyTest, NavigateToURLWithTimeout2) {
}
TEST_F(AutomationProxyTest, GoBackForward) {
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
ASSERT_TRUE(window.get());
- scoped_ptr<TabProxy> tab(window->GetTab(0));
+ scoped_refptr<TabProxy> tab(window->GetTab(0));
ASSERT_TRUE(tab.get());
std::wstring title;
@@ -338,9 +336,9 @@ TEST_F(AutomationProxyTest, GoBackForward) {
}
TEST_F(AutomationProxyTest, GetCurrentURL) {
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
ASSERT_TRUE(window.get());
- scoped_ptr<TabProxy> tab(window->GetTab(0));
+ scoped_refptr<TabProxy> tab(window->GetTab(0));
ASSERT_TRUE(tab.get());
GURL url;
ASSERT_TRUE(tab->GetCurrentURL(&url));
@@ -371,7 +369,7 @@ class AutomationProxyTest2 : public AutomationProxyVisibleTest {
};
TEST_F(AutomationProxyTest2, GetActiveTabIndex) {
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
ASSERT_TRUE(window.get());
int active_tab_index = -1;
@@ -386,15 +384,15 @@ TEST_F(AutomationProxyTest2, GetActiveTabIndex) {
}
TEST_F(AutomationProxyTest2, GetTabTitle) {
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
ASSERT_TRUE(window.get());
- scoped_ptr<TabProxy> tab(window->GetTab(0));
+ scoped_refptr<TabProxy> tab(window->GetTab(0));
ASSERT_TRUE(tab.get());
std::wstring title;
ASSERT_TRUE(tab->GetTabTitle(&title));
ASSERT_STREQ(L"title1.html", title.c_str());
- tab.reset(window->GetTab(1));
+ tab = window->GetTab(1);
ASSERT_TRUE(tab.get());
ASSERT_TRUE(tab->GetTabTitle(&title));
ASSERT_STREQ(L"Title Of Awesomeness", title.c_str());
@@ -404,10 +402,10 @@ TEST_F(AutomationProxyTest, Cookies) {
GURL url("http://mojo.jojo.google.com");
std::string value_result;
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
ASSERT_TRUE(window.get());
- scoped_ptr<TabProxy> tab(window->GetTab(0));
+ scoped_refptr<TabProxy> tab(window->GetTab(0));
ASSERT_TRUE(tab.get());
// test setting the cookie:
@@ -436,9 +434,9 @@ TEST_F(AutomationProxyTest, Cookies) {
// TODO(port): Determine what tests need this and port.
#if defined(OS_WIN)
TEST_F(AutomationProxyTest, GetHWND) {
- scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
ASSERT_TRUE(browser.get());
- scoped_ptr<WindowProxy> window(browser->GetWindow());
+ scoped_refptr<WindowProxy> window(browser->GetWindow());
ASSERT_TRUE(window.get());
HWND handle;
@@ -449,9 +447,9 @@ TEST_F(AutomationProxyTest, GetHWND) {
TEST_F(AutomationProxyTest, NavigateToURLAsync) {
AutomationProxy* automation_object = automation();
- scoped_ptr<BrowserProxy> window(automation_object->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window(automation_object->GetBrowserWindow(0));
ASSERT_TRUE(window.get());
- scoped_ptr<TabProxy> tab(window->GetTab(0));
+ scoped_refptr<TabProxy> tab(window->GetTab(0));
ASSERT_TRUE(tab.get());
FilePath filename(test_data_directory_);
@@ -465,7 +463,7 @@ TEST_F(AutomationProxyTest, NavigateToURLAsync) {
}
TEST_F(AutomationProxyTest, AcceleratorNewTab) {
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
int tab_count = -1;
ASSERT_TRUE(window->GetTabCount(&tab_count));
@@ -474,7 +472,7 @@ TEST_F(AutomationProxyTest, AcceleratorNewTab) {
ASSERT_TRUE(window->RunCommand(IDC_NEW_TAB));
ASSERT_TRUE(window->GetTabCount(&tab_count));
EXPECT_EQ(2, tab_count);
- scoped_ptr<TabProxy> tab(window->GetTab(tab_count - 1));
+ scoped_refptr<TabProxy> tab(window->GetTab(tab_count - 1));
ASSERT_TRUE(tab.get());
}
@@ -494,10 +492,10 @@ std::wstring CreateJSString(const std::wstring& value) {
}
TEST_F(AutomationProxyTest4, StringValueIsEchoedByDomAutomationController) {
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
ASSERT_TRUE(window.get());
- scoped_ptr<TabProxy> tab(window->GetTab(0));
+ scoped_refptr<TabProxy> tab(window->GetTab(0));
ASSERT_TRUE(tab.get());
std::wstring expected(L"string");
@@ -516,10 +514,10 @@ std::wstring BooleanToString(bool bool_value) {
}
TEST_F(AutomationProxyTest4, BooleanValueIsEchoedByDomAutomationController) {
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
ASSERT_TRUE(window.get());
- scoped_ptr<TabProxy> tab(window->GetTab(0));
+ scoped_refptr<TabProxy> tab(window->GetTab(0));
ASSERT_TRUE(tab.get());
bool expected = true;
@@ -530,10 +528,10 @@ TEST_F(AutomationProxyTest4, BooleanValueIsEchoedByDomAutomationController) {
}
TEST_F(AutomationProxyTest4, NumberValueIsEchoedByDomAutomationController) {
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
ASSERT_TRUE(window.get());
- scoped_ptr<TabProxy> tab(window->GetTab(0));
+ scoped_refptr<TabProxy> tab(window->GetTab(0));
ASSERT_TRUE(tab.get());
int expected = 1;
@@ -571,10 +569,10 @@ std::wstring CreateJSStringForDOMQuery(const std::wstring& id) {
}
TEST_F(AutomationProxyTest3, FrameDocumentCanBeAccessed) {
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
ASSERT_TRUE(window.get());
- scoped_ptr<TabProxy> tab(window->GetTab(0));
+ scoped_refptr<TabProxy> tab(window->GetTab(0));
ASSERT_TRUE(tab.get());
std::wstring actual;
@@ -600,7 +598,7 @@ TEST_F(AutomationProxyTest3, FrameDocumentCanBeAccessed) {
#if 0
// Open a new Destinations tab to execute script inside.
window->RunCommand(IDC_NEWTAB);
- tab.reset(window->GetTab(1));
+ tab = window->GetTab(1);
ASSERT_TRUE(tab.get());
ASSERT_TRUE(window->ActivateTab(1));
@@ -611,11 +609,10 @@ TEST_F(AutomationProxyTest3, FrameDocumentCanBeAccessed) {
// TODO(port): Need to port constrained_window_proxy.* first.
#if defined(OS_WIN)
TEST_F(AutomationProxyTest, ConstrainedWindowTest) {
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
ASSERT_TRUE(window.get());
- scoped_ptr<TabProxy> tab(window->GetTab(0));
- tab.reset(window->GetTab(0));
+ scoped_refptr<TabProxy> tab(window->GetTab(0));
ASSERT_TRUE(tab.get());
FilePath filename(test_data_directory_);
@@ -629,22 +626,20 @@ TEST_F(AutomationProxyTest, ConstrainedWindowTest) {
ASSERT_EQ(1, count);
- ConstrainedWindowProxy* cwindow = tab->GetConstrainedWindow(0);
- ASSERT_TRUE(cwindow);
+ scoped_refptr<ConstrainedWindowProxy> cwindow = tab->GetConstrainedWindow(0);
+ ASSERT_TRUE(cwindow.get());
std::wstring title;
ASSERT_TRUE(cwindow->GetTitle(&title));
std::wstring window_title = L"Pop-ups Blocked: 2";
ASSERT_STREQ(window_title.c_str(), title.c_str());
- delete cwindow;
}
TEST_F(AutomationProxyTest, CantEscapeByOnloadMoveto) {
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
ASSERT_TRUE(window.get());
- scoped_ptr<TabProxy> tab(window->GetTab(0));
- tab.reset(window->GetTab(0));
+ scoped_refptr<TabProxy> tab(window->GetTab(0));
ASSERT_TRUE(tab.get());
FilePath filename(test_data_directory_);
@@ -658,8 +653,8 @@ TEST_F(AutomationProxyTest, CantEscapeByOnloadMoveto) {
ASSERT_EQ(1, count);
- ConstrainedWindowProxy* cwindow = tab->GetConstrainedWindow(0);
- ASSERT_TRUE(cwindow);
+ scoped_refptr<ConstrainedWindowProxy> cwindow = tab->GetConstrainedWindow(0);
+ ASSERT_TRUE(cwindow.get());
gfx::Rect rect;
bool is_timeout = false;
@@ -803,7 +798,7 @@ void AutomationProxyForExternalTab::OnForwardMessageToExternalHost(
TEST_F(ExternalTabTestType, CreateExternalTab) {
HWND external_tab_container = NULL;
- scoped_ptr<TabProxy> tab(automation()->CreateExternalTab(NULL, gfx::Rect(),
+ scoped_refptr<TabProxy> tab(automation()->CreateExternalTab(NULL, gfx::Rect(),
WS_POPUP, false, &external_tab_container));
EXPECT_TRUE(tab != NULL);
EXPECT_NE(FALSE, ::IsWindow(external_tab_container));
@@ -822,21 +817,21 @@ TEST_F(ExternalTabTestType, IncognitoMode) {
std::string value_result;
// Create incognito tab
- scoped_ptr<TabProxy> tab(automation()->CreateExternalTab(NULL, gfx::Rect(),
+ scoped_refptr<TabProxy> tab(automation()->CreateExternalTab(NULL, gfx::Rect(),
WS_POPUP, true, &external_tab_container));
EXPECT_TRUE(tab->SetCookie(url, "robert=burton; "
"expires=Thu, 13 Oct 2011 05:04:03 UTC;"));
EXPECT_TRUE(tab->GetCookieByName(url, "robert", &value_result));
EXPECT_EQ("burton", value_result);
- tab.reset(NULL);
+ tab = NULL;
CloseBrowserAndServer();
value_result.empty();
clear_profile_ = false;
external_tab_container = NULL;
LaunchBrowserAndServer();
- tab.reset(automation()->CreateExternalTab(NULL, gfx::Rect(),
- WS_POPUP, false, &external_tab_container));
+ tab = automation()->CreateExternalTab(NULL, gfx::Rect(),
+ WS_POPUP, false, &external_tab_container);
EXPECT_TRUE(tab->GetCookieByName(url, "robert", &value_result));
EXPECT_EQ("", value_result);
}
@@ -846,7 +841,7 @@ TEST_F(ExternalTabTestType, ExternalTabPostMessage) {
static_cast<AutomationProxyForExternalTab*>(automation());
HWND external_tab_container = NULL;
- scoped_ptr<TabProxy> tab(proxy->CreateExternalTab(NULL, gfx::Rect(),
+ scoped_refptr<TabProxy> tab(proxy->CreateExternalTab(NULL, gfx::Rect(),
WS_POPUP, false, &external_tab_container));
EXPECT_TRUE(tab != NULL);
EXPECT_NE(FALSE, ::IsWindow(external_tab_container));
@@ -880,9 +875,9 @@ TEST_F(ExternalTabTestType, ExternalTabPostMessage) {
// TODO(port): Need to port autocomplete_edit_proxy.* first.
#if defined(OS_WIN) || defined(OS_LINUX)
TEST_F(AutomationProxyTest, AutocompleteGetSetText) {
- scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
ASSERT_TRUE(browser.get());
- scoped_ptr<AutocompleteEditProxy> edit(
+ scoped_refptr<AutocompleteEditProxy> edit(
browser->GetAutocompleteEdit());
ASSERT_TRUE(edit.get());
EXPECT_TRUE(edit->is_valid());
@@ -891,22 +886,22 @@ TEST_F(AutomationProxyTest, AutocompleteGetSetText) {
EXPECT_TRUE(edit->SetText(text_to_set));
EXPECT_TRUE(edit->GetText(&actual_text));
EXPECT_EQ(text_to_set, actual_text);
- scoped_ptr<AutocompleteEditProxy> edit2(
+ scoped_refptr<AutocompleteEditProxy> edit2(
browser->GetAutocompleteEdit());
EXPECT_TRUE(edit2->GetText(&actual_text));
EXPECT_EQ(text_to_set, actual_text);
}
TEST_F(AutomationProxyTest, AutocompleteParallelProxy) {
- scoped_ptr<BrowserProxy> browser1(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser1(automation()->GetBrowserWindow(0));
ASSERT_TRUE(browser1.get());
- scoped_ptr<AutocompleteEditProxy> edit1(
+ scoped_refptr<AutocompleteEditProxy> edit1(
browser1->GetAutocompleteEdit());
ASSERT_TRUE(edit1.get());
EXPECT_TRUE(browser1->RunCommand(IDC_NEW_WINDOW));
- scoped_ptr<BrowserProxy> browser2(automation()->GetBrowserWindow(1));
+ scoped_refptr<BrowserProxy> browser2(automation()->GetBrowserWindow(1));
ASSERT_TRUE(browser2.get());
- scoped_ptr<AutocompleteEditProxy> edit2(
+ scoped_refptr<AutocompleteEditProxy> edit2(
browser2->GetAutocompleteEdit());
ASSERT_TRUE(edit2.get());
EXPECT_TRUE(browser2->GetTab(0)->WaitForTabToBeRestored(
@@ -923,9 +918,9 @@ TEST_F(AutomationProxyTest, AutocompleteParallelProxy) {
}
TEST_F(AutomationProxyVisibleTest, AutocompleteMatchesTest) {
- scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
ASSERT_TRUE(browser.get());
- scoped_ptr<AutocompleteEditProxy> edit(
+ scoped_refptr<AutocompleteEditProxy> edit(
browser->GetAutocompleteEdit());
ASSERT_TRUE(edit.get());
EXPECT_TRUE(browser->ApplyAccelerator(IDC_FOCUS_LOCATION));
@@ -943,10 +938,9 @@ TEST_F(AutomationProxyVisibleTest, AutocompleteMatchesTest) {
// Disabled because flaky see bug #5314.
TEST_F(AutomationProxyTest, DISABLED_AppModalDialogTest) {
- scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
ASSERT_TRUE(browser.get());
- scoped_ptr<TabProxy> tab(browser->GetTab(0));
- tab.reset(browser->GetTab(0));
+ scoped_refptr<TabProxy> tab(browser->GetTab(0));
ASSERT_TRUE(tab.get());
bool modal_dialog_showing = false;
@@ -1039,10 +1033,10 @@ class AutomationProxyTest5 : public UITest {
};
TEST_F(AutomationProxyTest5, TestLifetimeOfDomAutomationController) {
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
ASSERT_TRUE(window.get());
- scoped_ptr<TabProxy> tab(window->GetTab(0));
+ scoped_refptr<TabProxy> tab(window->GetTab(0));
ASSERT_TRUE(tab.get());
FilePath filename(test_data_directory_);
diff --git a/chrome/test/automation/browser_proxy.cc b/chrome/test/automation/browser_proxy.cc
index 03a1e51..28dd022 100644
--- a/chrome/test/automation/browser_proxy.cc
+++ b/chrome/test/automation/browser_proxy.cc
@@ -112,25 +112,34 @@ bool BrowserProxy::GetActiveTabIndexWithTimeout(int* active_tab_index,
return succeeded;
}
-TabProxy* BrowserProxy::GetTab(int tab_index) const {
+scoped_refptr<TabProxy> BrowserProxy::GetTab(int tab_index) const {
if (!is_valid())
return NULL;
- int handle = 0;
+ int tab_handle = 0;
- sender_->Send(new AutomationMsg_Tab(0, handle_, tab_index, &handle));
- if (!handle)
+ sender_->Send(new AutomationMsg_Tab(0, handle_, tab_index, &tab_handle));
+ if (!tab_handle)
return NULL;
- return new TabProxy(sender_, tracker_, handle);
+ TabProxy* tab = static_cast<TabProxy*>(tracker_->GetResource(tab_handle));
+ if (!tab) {
+ tab = new TabProxy(sender_, tracker_, tab_handle);
+ tab->AddRef();
+ }
+
+ // Since there is no scoped_refptr::attach.
+ scoped_refptr<TabProxy> result;
+ result.swap(&tab);
+ return result;
}
-TabProxy* BrowserProxy::GetActiveTab() const {
+scoped_refptr<TabProxy> BrowserProxy::GetActiveTab() const {
return GetActiveTabWithTimeout(base::kNoTimeout, NULL);
}
-TabProxy* BrowserProxy::GetActiveTabWithTimeout(uint32 timeout_ms,
- bool* is_timeout) const {
+scoped_refptr<TabProxy> BrowserProxy::GetActiveTabWithTimeout(uint32 timeout_ms,
+ bool* is_timeout) const {
int active_tab_index;
if (!GetActiveTabIndexWithTimeout(&active_tab_index, timeout_ms, is_timeout))
return NULL;
@@ -365,9 +374,9 @@ bool BrowserProxy::SetBooleanPreference(const std::wstring& name,
return result;
}
-WindowProxy* BrowserProxy::GetWindow() const {
+scoped_refptr<WindowProxy> BrowserProxy::GetWindow() const {
if (!is_valid())
- return false;
+ return NULL;
bool handle_ok = false;
int window_handle = 0;
@@ -377,10 +386,20 @@ WindowProxy* BrowserProxy::GetWindow() const {
if (!handle_ok)
return NULL;
- return new WindowProxy(sender_, tracker_, window_handle);
+ WindowProxy* window =
+ static_cast<WindowProxy*>(tracker_->GetResource(window_handle));
+ if (!window) {
+ window = new WindowProxy(sender_, tracker_, window_handle);
+ window->AddRef();
+ }
+
+ // Since there is no scoped_refptr::attach.
+ scoped_refptr<WindowProxy> result;
+ result.swap(&window);
+ return result;
}
-AutocompleteEditProxy* BrowserProxy::GetAutocompleteEdit() {
+scoped_refptr<AutocompleteEditProxy> BrowserProxy::GetAutocompleteEdit() {
if (!is_valid())
return NULL;
@@ -393,5 +412,16 @@ AutocompleteEditProxy* BrowserProxy::GetAutocompleteEdit() {
if (!handle_ok)
return NULL;
- return new AutocompleteEditProxy(sender_, tracker_, autocomplete_edit_handle);
+ AutocompleteEditProxy* p = static_cast<AutocompleteEditProxy*>(
+ tracker_->GetResource(autocomplete_edit_handle));
+
+ if (!p) {
+ p = new AutocompleteEditProxy(sender_, tracker_, autocomplete_edit_handle);
+ p->AddRef();
+ }
+
+ // Since there is no scoped_refptr::attach.
+ scoped_refptr<AutocompleteEditProxy> result;
+ result.swap(&p);
+ return result;
}
diff --git a/chrome/test/automation/browser_proxy.h b/chrome/test/automation/browser_proxy.h
index 7f69681..98e64de 100644
--- a/chrome/test/automation/browser_proxy.h
+++ b/chrome/test/automation/browser_proxy.h
@@ -34,7 +34,6 @@ class BrowserProxy : public AutomationResourceProxy {
AutomationHandleTracker* tracker,
int handle)
: AutomationResourceProxy(tracker, sender, handle) {}
- virtual ~BrowserProxy() {}
// Activates the tab corresponding to (zero-based) tab_index. Returns true if
// successful.
@@ -89,26 +88,27 @@ class BrowserProxy : public AutomationResourceProxy {
//
// Use GetTabCount to see how many windows you can ask for. Tab numbers
// are 0-based.
- TabProxy* GetTab(int tab_index) const;
+ scoped_refptr<TabProxy> GetTab(int tab_index) const;
// Returns the TabProxy for the currently active tab, transferring
// ownership of the pointer to the caller. On failure, returns NULL.
- TabProxy* GetActiveTab() const;
+ scoped_refptr<TabProxy> GetActiveTab() const;
// Like GetActiveTab, but returns NULL if no response is received before
// the specified timout.
- TabProxy* GetActiveTabWithTimeout(uint32 timeout_ms, bool* is_timeout) const;
+ scoped_refptr<TabProxy> GetActiveTabWithTimeout(uint32 timeout_ms,
+ bool* is_timeout) const;
// Returns the WindowProxy for this browser's window. It can be used to
// retreive view bounds, simulate clicks and key press events. The caller
// owns the returned WindowProxy.
// On failure, returns NULL.
- WindowProxy* GetWindow() const;
+ scoped_refptr<WindowProxy> GetWindow() const;
// Returns an AutocompleteEdit for this browser's window. It can be used to
// manipulate the omnibox. The caller owns the returned pointer.
// On failure, returns NULL.
- AutocompleteEditProxy* GetAutocompleteEdit();
+ scoped_refptr<AutocompleteEditProxy> GetAutocompleteEdit();
// Apply the accelerator with given id (IDC_BACK, IDC_NEWTAB ...)
// The list can be found at chrome/app/chrome_dll_resource.h
@@ -198,6 +198,8 @@ class BrowserProxy : public AutomationResourceProxy {
// Sets the boolean value of the specified preference.
bool SetBooleanPreference(const std::wstring& name, bool value);
+ protected:
+ virtual ~BrowserProxy() {}
private:
DISALLOW_COPY_AND_ASSIGN(BrowserProxy);
};
diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc
index 2b27e0d..207efac 100644
--- a/chrome/test/automation/tab_proxy.cc
+++ b/chrome/test/automation/tab_proxy.cc
@@ -337,19 +337,31 @@ bool TabProxy::GetConstrainedWindowCount(int* count) const {
0, handle_, count));
}
-ConstrainedWindowProxy* TabProxy::GetConstrainedWindow(
+scoped_refptr<ConstrainedWindowProxy> TabProxy::GetConstrainedWindow(
int window_index) const {
if (!is_valid())
return NULL;
int handle = 0;
- if (sender_->Send(new AutomationMsg_ConstrainedWindow(0, handle_,
+ if (!sender_->Send(new AutomationMsg_ConstrainedWindow(0, handle_,
window_index,
- &handle))) {
- return new ConstrainedWindowProxy(sender_, tracker_, handle);
+ &handle)))
+ return NULL;
+
+ if (handle == 0)
+ return NULL;
+
+ ConstrainedWindowProxy* w = static_cast<ConstrainedWindowProxy*>(
+ tracker_->GetResource(handle));
+ if (!w) {
+ w = new ConstrainedWindowProxy(sender_, tracker_, handle);
+ w->AddRef();
}
- return NULL;
+ // Since there is no scoped_refptr::attach.
+ scoped_refptr<ConstrainedWindowProxy> result;
+ result.swap(&w);
+ return result;
}
bool TabProxy::WaitForChildWindowCountToChange(int count, int* new_count,
@@ -637,3 +649,20 @@ void TabProxy::Reposition(HWND window, HWND window_insert_after, int left,
}
#endif // defined(OS_WIN)
+
+void TabProxy::AddObserver(TabProxyDelegate* observer) {
+ AutoLock lock(list_lock_);
+ observers_list_.AddObserver(observer);
+}
+
+void TabProxy::RemoveObserver(TabProxyDelegate* observer) {
+ AutoLock lock(list_lock_);
+ observers_list_.RemoveObserver(observer);
+}
+
+// Called on Channel background thread, if TabMessages filter is installed.
+void TabProxy::OnMessageReceived(const IPC::Message& message) {
+ AutoLock lock(list_lock_);
+ FOR_EACH_OBSERVER(TabProxyDelegate, observers_list_,
+ OnMessageReceived(this, message));
+}
diff --git a/chrome/test/automation/tab_proxy.h b/chrome/test/automation/tab_proxy.h
index 8f071bb..81c72a8 100644
--- a/chrome/test/automation/tab_proxy.h
+++ b/chrome/test/automation/tab_proxy.h
@@ -14,6 +14,7 @@
#include <string>
#include <vector>
+#include "base/observer_list.h"
#include "chrome/browser/download/save_package.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/security_style.h"
@@ -23,19 +24,23 @@
class ConstrainedWindowProxy;
class GURL;
class Value;
+class IPC::Message;
enum FindInPageDirection { BACK = 0, FWD = 1 };
enum FindInPageCase { IGNORE_CASE = 0, CASE_SENSITIVE = 1 };
class TabProxy : public AutomationResourceProxy {
public:
+ class TabProxyDelegate {
+ public:
+ virtual void OnMessageReceived(TabProxy* tab, const IPC::Message& msg) {}
+ };
+
TabProxy(AutomationMessageSender* sender,
AutomationHandleTracker* tracker,
int handle)
: AutomationResourceProxy(tracker, sender, handle) {}
- virtual ~TabProxy() {}
-
// Gets the current url of the tab.
bool GetCurrentURL(GURL* url) const;
@@ -51,7 +56,8 @@ class TabProxy : public AutomationResourceProxy {
// Gets the proxy object for constrained window within this tab. Ownership
// for the returned object is transfered to the caller. Returns NULL on
// failure.
- ConstrainedWindowProxy* GetConstrainedWindow(int window_index) const;
+ scoped_refptr<ConstrainedWindowProxy> GetConstrainedWindow(
+ int window_index) const;
// Executes a javascript in a frame's context whose xpath is provided as the
// first parameter and extract the values from the resulting json string.
@@ -295,7 +301,15 @@ class TabProxy : public AutomationResourceProxy {
int width, int height, int flags, HWND parent_window);
#endif // defined(OS_WIN)
+ // Calls delegates
+ void AddObserver(TabProxyDelegate* observer);
+ void RemoveObserver(TabProxyDelegate* observer);
+ void OnMessageReceived(const IPC::Message& message);
+ protected:
+ virtual ~TabProxy() {}
private:
+ Lock list_lock_; // Protects the observers_list_.
+ ObserverList<TabProxyDelegate> observers_list_;
DISALLOW_COPY_AND_ASSIGN(TabProxy);
};
diff --git a/chrome/test/automation/window_proxy.cc b/chrome/test/automation/window_proxy.cc
index 7288595..6cced64 100644
--- a/chrome/test/automation/window_proxy.cc
+++ b/chrome/test/automation/window_proxy.cc
@@ -118,14 +118,14 @@ bool WindowProxy::GetFocusedViewID(int* view_id) {
view_id));
}
-BrowserProxy* WindowProxy::GetBrowser() {
+scoped_refptr<BrowserProxy> WindowProxy::GetBrowser() {
return GetBrowserWithTimeout(base::kNoTimeout, NULL);
}
-BrowserProxy* WindowProxy::GetBrowserWithTimeout(uint32 timeout_ms,
- bool* is_timeout) {
+scoped_refptr<BrowserProxy> WindowProxy::GetBrowserWithTimeout(
+ uint32 timeout_ms, bool* is_timeout) {
if (!is_valid())
- return false;
+ return NULL;
bool handle_ok = false;
int browser_handle = 0;
@@ -135,5 +135,15 @@ BrowserProxy* WindowProxy::GetBrowserWithTimeout(uint32 timeout_ms,
if (!handle_ok)
return NULL;
- return new BrowserProxy(sender_, tracker_, browser_handle);
+ BrowserProxy* browser =
+ static_cast<BrowserProxy*>(tracker_->GetResource(browser_handle));
+ if (!browser) {
+ browser = new BrowserProxy(sender_, tracker_, browser_handle);
+ browser->AddRef();
+ }
+
+ // Since there is no scoped_refptr::attach.
+ scoped_refptr<BrowserProxy> result;
+ result.swap(&browser);
+ return result;
}
diff --git a/chrome/test/automation/window_proxy.h b/chrome/test/automation/window_proxy.h
index 2935480..8beb158 100644
--- a/chrome/test/automation/window_proxy.h
+++ b/chrome/test/automation/window_proxy.h
@@ -34,7 +34,6 @@ class WindowProxy : public AutomationResourceProxy {
AutomationHandleTracker* tracker,
int handle)
: AutomationResourceProxy(tracker, sender, handle) {}
- virtual ~WindowProxy() {}
#if defined(OS_WIN)
// TODO(port): Use portable replacements for windowsisms.
@@ -89,12 +88,14 @@ class WindowProxy : public AutomationResourceProxy {
// Returns the browser this window corresponds to, or NULL if this window
// is not a browser. The caller owns the returned BrowserProxy.
- BrowserProxy* GetBrowser();
+ scoped_refptr<BrowserProxy> GetBrowser();
// Same as GetWindow except return NULL if response isn't received
// before the specified timeout.
- BrowserProxy* GetBrowserWithTimeout(uint32 timeout_ms, bool* is_timeout);
-
+ scoped_refptr<BrowserProxy> GetBrowserWithTimeout(uint32 timeout_ms,
+ bool* is_timeout);
+ protected:
+ virtual ~WindowProxy() {}
private:
DISALLOW_COPY_AND_ASSIGN(WindowProxy);
};
diff --git a/chrome/test/interactive_ui/npapi_interactive_test.cc b/chrome/test/interactive_ui/npapi_interactive_test.cc
index 95be3f6..24aa5d1 100644
--- a/chrome/test/interactive_ui/npapi_interactive_test.cc
+++ b/chrome/test/interactive_ui/npapi_interactive_test.cc
@@ -45,7 +45,7 @@ const int kShortWaitTimeout = 5 * 1000;
// a synchronous mousemove works correctly
TEST_F(NPAPIVisiblePluginTester, SelfDeletePluginInvokeInSynchronousMouseMove) {
if (!UITest::in_process_renderer()) {
- scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
+ scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
HWND tab_window = NULL;
tab_proxy->GetHWND(&tab_window);
diff --git a/chrome/test/memory_test/memory_test.cc b/chrome/test/memory_test/memory_test.cc
index ffddf51..e06727d 100644
--- a/chrome/test/memory_test/memory_test.cc
+++ b/chrome/test/memory_test/memory_test.cc
@@ -213,8 +213,8 @@ class MemoryTest : public UITest {
size_t start_size = GetSystemCommitCharge();
// Cycle through the URLs.
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
- scoped_ptr<TabProxy> tab(window->GetActiveTab());
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ scoped_refptr<TabProxy> tab(window->GetActiveTab());
int expected_tab_count = 1;
for (unsigned counter = 0; counter < arraysize(urls); ++counter) {
std::string url = urls[counter];
@@ -233,12 +233,12 @@ class MemoryTest : public UITest {
EXPECT_TRUE(window->AppendTab(GURL(url)));
expected_tab_count++;
WaitUntilTabCount(expected_tab_count);
- tab.reset(window->GetActiveTab());
+ tab = window->GetActiveTab();
continue;
}
int tab_index = counter % num_target_tabs; // A pseudo-random tab.
- tab.reset(window->GetTab(tab_index));
+ tab = window->GetTab(tab_index);
}
const int kMaxWaitTime = 5000;
diff --git a/chrome/test/page_cycler/page_cycler_test.cc b/chrome/test/page_cycler/page_cycler_test.cc
index 1158248..34bafe6 100644
--- a/chrome/test/page_cycler/page_cycler_test.cc
+++ b/chrome/test/page_cycler/page_cycler_test.cc
@@ -67,7 +67,7 @@ class PageCyclerTest : public UITest {
url_parse::Component(0, arraysize(query_string) - 1));
test_url = test_url.ReplaceComponents(replacements);
- scoped_ptr<TabProxy> tab(GetActiveTab());
+ scoped_refptr<TabProxy> tab(GetActiveTab());
tab->NavigateToURL(test_url);
// Wait for the test to finish.
diff --git a/chrome/test/plugin/plugin_test.cpp b/chrome/test/plugin/plugin_test.cpp
index 0faf2ca..5a5b844 100644
--- a/chrome/test/plugin/plugin_test.cpp
+++ b/chrome/test/plugin/plugin_test.cpp
@@ -116,7 +116,7 @@ class PluginTest : public UITest {
const int kMaxIntervals = wait_time / kSleepTime;
GURL url = GetTestUrl(L"done");
- scoped_ptr<TabProxy> tab(GetActiveTab());
+ scoped_refptr<TabProxy> tab(GetActiveTab());
std::string done_str;
for (int i = 0; i < kMaxIntervals; ++i) {
diff --git a/chrome/test/reliability/page_load_test.cc b/chrome/test/reliability/page_load_test.cc
index 277d6ca..774b7f0 100644
--- a/chrome/test/reliability/page_load_test.cc
+++ b/chrome/test/reliability/page_load_test.cc
@@ -168,7 +168,7 @@ class PageLoadTest : public UITest {
// assertion when page loading fails. We log the result instead.
{
// TabProxy should be released before Browser is closed.
- scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
+ scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
if (tab_proxy.get()) {
result = tab_proxy->NavigateToURLWithTimeout(url, timeout_ms,
&is_timeout);
@@ -177,9 +177,9 @@ class PageLoadTest : public UITest {
if (!is_timeout && result == AUTOMATION_MSG_NAVIGATION_SUCCESS) {
if (page_down) {
// Page down twice.
- scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
if (browser.get()) {
- scoped_ptr<WindowProxy> window(browser->GetWindow());
+ scoped_refptr<WindowProxy> window(browser->GetWindow());
if (window.get()) {
bool activation_timeout;
browser->BringToFrontWithTimeout(action_max_timeout_ms(),
@@ -372,7 +372,7 @@ class PageLoadTest : public UITest {
LaunchBrowserAndServer();
{
// TabProxy should be released before Browser is closed.
- scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
+ scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
if (tab_proxy.get()) {
tab_proxy->NavigateToURL(GURL(test_url_1));
}
diff --git a/chrome/test/selenium/selenium_test.cc b/chrome/test/selenium/selenium_test.cc
index 590d996..bf0be73 100644
--- a/chrome/test/selenium/selenium_test.cc
+++ b/chrome/test/selenium/selenium_test.cc
@@ -103,7 +103,7 @@ class SeleniumTest : public UITest {
file_util::AppendToPath(&test_path, L"TestRunner.html");
GURL test_url(net::FilePathToFileURL(FilePath::FromWStringHack(test_path)));
- scoped_ptr<TabProxy> tab(GetActiveTab());
+ scoped_refptr<TabProxy> tab(GetActiveTab());
tab->NavigateToURL(test_url);
// Wait for the test to finish.
diff --git a/chrome/test/startup/feature_startup_test.cc b/chrome/test/startup/feature_startup_test.cc
index e1cd0a7..6862d6a 100644
--- a/chrome/test/startup/feature_startup_test.cc
+++ b/chrome/test/startup/feature_startup_test.cc
@@ -59,8 +59,8 @@ class NewTabUIStartupTest : public UITest {
// Switch to the "new tab" tab, which should be any new tab after the
// first (the first is about:blank).
- BrowserProxy* window = automation()->GetBrowserWindow(0);
- ASSERT_TRUE(window);
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ ASSERT_TRUE(window.get());
int tab_count = -1;
ASSERT_TRUE(window->GetTabCount(&tab_count));
ASSERT_EQ(1, tab_count);
@@ -80,7 +80,7 @@ class NewTabUIStartupTest : public UITest {
timings[i] = TimeDelta::FromMilliseconds(load_time);
}
- delete window;
+ window = NULL;
UITest::TearDown();
}
diff --git a/chrome/test/tab_switching/tab_switching_test.cc b/chrome/test/tab_switching/tab_switching_test.cc
index d56be38..91423a6 100644
--- a/chrome/test/tab_switching/tab_switching_test.cc
+++ b/chrome/test/tab_switching/tab_switching_test.cc
@@ -39,7 +39,7 @@ class TabSwitchingUITest : public UITest {
void RunTabSwitchingUITest() {
// Create a browser proxy.
- browser_proxy_.reset(automation()->GetBrowserWindow(0));
+ browser_proxy_ = automation()->GetBrowserWindow(0);
// Open all the tabs.
int initial_tab_count = 0;
@@ -128,7 +128,7 @@ class TabSwitchingUITest : public UITest {
std::wstring path_prefix_;
int number_of_tabs_to_open_;
- scoped_ptr<BrowserProxy> browser_proxy_;
+ scoped_refptr<BrowserProxy> browser_proxy_;
private:
DISALLOW_EVIL_CONSTRUCTORS(TabSwitchingUITest);
diff --git a/chrome/test/ui/dom_checker_uitest.cc b/chrome/test/ui/dom_checker_uitest.cc
index aa8c49a..3342a29 100644
--- a/chrome/test/ui/dom_checker_uitest.cc
+++ b/chrome/test/ui/dom_checker_uitest.cc
@@ -199,7 +199,7 @@ class DomCheckerTest : public UITest {
test_url = net::FilePathToFileURL(test_path);
}
- scoped_ptr<TabProxy> tab(GetActiveTab());
+ scoped_refptr<TabProxy> tab(GetActiveTab());
tab->NavigateToURL(test_url);
// Wait for the test to finish.
diff --git a/chrome/test/ui/inspector_controller_uitest.cc b/chrome/test/ui/inspector_controller_uitest.cc
index 6bf9664..9f9cf0a 100644
--- a/chrome/test/ui/inspector_controller_uitest.cc
+++ b/chrome/test/ui/inspector_controller_uitest.cc
@@ -12,8 +12,8 @@
class InspectorControllerTest : public UITest {
protected:
- TabProxy* GetActiveTabProxy() {
- scoped_ptr<BrowserProxy> window_proxy(automation()->GetBrowserWindow(0));
+ scoped_refptr<TabProxy> GetActiveTabProxy() {
+ scoped_refptr<BrowserProxy> window_proxy(automation()->GetBrowserWindow(0));
EXPECT_TRUE(window_proxy.get());
int active_tab_index = 0;
@@ -36,7 +36,7 @@ TEST_F(InspectorControllerTest, DISABLED_InspectElement) {
HTTPTestServer::CreateServer(L"chrome/test/data", NULL);
ASSERT_TRUE(NULL != server.get());
- ::scoped_ptr<TabProxy> tab(GetActiveTabProxy());
+ scoped_refptr<TabProxy> tab(GetActiveTabProxy());
// We don't track resources until we've opened the inspector.
NavigateTab(tab.get(), server->TestServerPageW(
L"files/inspector/test1.html"));
diff --git a/chrome/test/ui/layout_plugin_uitest.cc b/chrome/test/ui/layout_plugin_uitest.cc
index 3f4ba9d..e5c10f4 100644
--- a/chrome/test/ui/layout_plugin_uitest.cc
+++ b/chrome/test/ui/layout_plugin_uitest.cc
@@ -63,7 +63,7 @@ TEST_F(LayoutPluginTester, UnloadNoCrash) {
NavigateToURL(net::FilePathToFileURL(path));
std::wstring title;
- TabProxy* tab = GetActiveTab();
+ scoped_refptr<TabProxy> tab = GetActiveTab();
ASSERT_TRUE(tab);
EXPECT_TRUE(tab->GetTabTitle(&title));
EXPECT_EQ(L"Layout Test Plugin Test", title);
@@ -71,6 +71,4 @@ TEST_F(LayoutPluginTester, UnloadNoCrash) {
ASSERT_TRUE(tab->GoBack());
EXPECT_TRUE(tab->GetTabTitle(&title));
EXPECT_EQ(L"", title);
-
- delete tab;
}
diff --git a/chrome/test/ui/npapi_uitest.cc b/chrome/test/ui/npapi_uitest.cc
index f8d5f47..76176a9 100644
--- a/chrome/test/ui/npapi_uitest.cc
+++ b/chrome/test/ui/npapi_uitest.cc
@@ -136,7 +136,7 @@ TEST_F(NPAPITester, DISABLED_SelfDeletePluginInvokeAlert) {
// Wait for the alert dialog and then close it.
automation()->WaitForAppModalDialog(5000);
- scoped_ptr<WindowProxy> window(automation()->GetActiveWindow());
+ scoped_refptr<WindowProxy> window(automation()->GetActiveWindow());
ASSERT_TRUE(window.get());
ASSERT_TRUE(window->SimulateOSKeyPress(VK_ESCAPE, 0));
diff --git a/chrome/test/ui/omnibox_uitest.cc b/chrome/test/ui/omnibox_uitest.cc
index 4620418..c5b27c3 100644
--- a/chrome/test/ui/omnibox_uitest.cc
+++ b/chrome/test/ui/omnibox_uitest.cc
@@ -74,9 +74,9 @@ bool OmniboxTest::IsMatch(const std::wstring& input_text,
void OmniboxTest::RunQueryChain(const std::wstring& input_text) {
// Get a handle on the omnibox and give it focus.
- scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
- scoped_ptr<WindowProxy> window(browser->GetWindow());
- scoped_ptr<AutocompleteEditProxy> autocomplete_edit(
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ scoped_refptr<WindowProxy> window(browser->GetWindow());
+ scoped_refptr<AutocompleteEditProxy> autocomplete_edit(
browser->GetAutocompleteEdit());
ASSERT_TRUE(browser->ApplyAccelerator(IDC_FOCUS_LOCATION));
diff --git a/chrome/test/ui/sunspider_uitest.cc b/chrome/test/ui/sunspider_uitest.cc
index 6ec89d6..6e7f510 100644
--- a/chrome/test/ui/sunspider_uitest.cc
+++ b/chrome/test/ui/sunspider_uitest.cc
@@ -38,7 +38,7 @@ class SunSpiderTest : public UITest {
test_path = test_path.Append(start_file);
GURL test_url(net::FilePathToFileURL(test_path));
- scoped_ptr<TabProxy> tab(GetActiveTab());
+ scoped_refptr<TabProxy> tab(GetActiveTab());
tab->NavigateToURL(test_url);
// Wait for the test to finish.
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc
index 85e97b0..1b15116 100644
--- a/chrome/test/ui/ui_test.cc
+++ b/chrome/test/ui/ui_test.cc
@@ -391,7 +391,7 @@ void UITest::LaunchBrowser(const CommandLine& arguments, bool clear_profile) {
}
void UITest::QuitBrowser() {
- typedef std::vector<BrowserProxy*> BrowserVector;
+ typedef std::vector<scoped_refptr<BrowserProxy> > BrowserVector;
// There's nothing to do here if the browser is not running.
if (IsBrowserRunning()) {
@@ -404,7 +404,8 @@ void UITest::QuitBrowser() {
EXPECT_TRUE(automation()->GetBrowserWindowCount(&window_count));
for (int i = 0; i < window_count; ++i) {
- BrowserProxy* browser_proxy = automation()->GetBrowserWindow(i);
+ scoped_refptr<BrowserProxy> browser_proxy =
+ automation()->GetBrowserWindow(i);
browsers.push_back(browser_proxy);
}
@@ -415,10 +416,11 @@ void UITest::QuitBrowser() {
iter != browsers.end(); ++iter) {
// Use ApplyAccelerator since it doesn't wait
(*iter)->ApplyAccelerator(IDC_CLOSE_WINDOW);
- delete (*iter);
}
#endif
+ browsers.clear();
+
// Now, drop the automation IPC channel so that the automation provider in
// the browser notices and drops its reference to the browser process.
server_->Disconnect();
@@ -455,13 +457,13 @@ void UITest::CleanupAppProcesses() {
AssertAppNotRunning(L"Unable to quit all browser processes.");
}
-TabProxy* UITest::GetActiveTab(int window_index) {
+scoped_refptr<TabProxy> UITest::GetActiveTab(int window_index) {
EXPECT_GE(window_index, 0);
int window_count;
// Use EXPECT rather than ASSERT here because ASSERT_* returns void.
EXPECT_TRUE(automation()->GetBrowserWindowCount(&window_count));
EXPECT_GT(window_count, window_index);
- scoped_ptr<BrowserProxy> window_proxy(automation()->
+ scoped_refptr<BrowserProxy> window_proxy(automation()->
GetBrowserWindow(window_index));
if (!window_proxy.get())
return NULL;
@@ -474,8 +476,12 @@ TabProxy* UITest::GetActiveTab(int window_index) {
return window_proxy->GetTab(active_tab_index);
}
+scoped_refptr<TabProxy> UITest::GetActiveTab() {
+ return GetActiveTab(0);
+}
+
void UITest::NavigateToURLAsync(const GURL& url) {
- scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
+ scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
ASSERT_TRUE(tab_proxy.get());
if (!tab_proxy.get())
return;
@@ -484,7 +490,7 @@ void UITest::NavigateToURLAsync(const GURL& url) {
}
void UITest::NavigateToURL(const GURL& url) {
- scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
+ scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
ASSERT_TRUE(tab_proxy.get());
if (!tab_proxy.get())
return;
@@ -549,7 +555,7 @@ bool UITest::WaitForBookmarkBarVisibilityChange(BrowserProxy* browser,
#endif // defined(OS_WIN)
GURL UITest::GetActiveTabURL(int window_index) {
- scoped_ptr<TabProxy> tab_proxy(GetActiveTab(window_index));
+ scoped_refptr<TabProxy> tab_proxy(GetActiveTab(window_index));
if (!tab_proxy.get())
return GURL();
@@ -561,7 +567,7 @@ GURL UITest::GetActiveTabURL(int window_index) {
std::wstring UITest::GetActiveTabTitle(int window_index) {
std::wstring title;
- scoped_ptr<TabProxy> tab_proxy(GetActiveTab(window_index));
+ scoped_refptr<TabProxy> tab_proxy(GetActiveTab(window_index));
if (!tab_proxy.get())
return title;
@@ -570,7 +576,7 @@ std::wstring UITest::GetActiveTabTitle(int window_index) {
}
int UITest::GetActiveTabIndex(int window_index) {
- scoped_ptr<TabProxy> tab_proxy(GetActiveTab(window_index));
+ scoped_refptr<TabProxy> tab_proxy(GetActiveTab(window_index));
if (!tab_proxy.get())
return -1;
@@ -624,7 +630,7 @@ DictionaryValue* UITest::GetDefaultProfilePreferences() {
#endif // OS_WIN
int UITest::GetTabCount() {
- scoped_ptr<BrowserProxy> first_window(automation()->GetBrowserWindow(0));
+ scoped_refptr<BrowserProxy> first_window(automation()->GetBrowserWindow(0));
if (!first_window.get())
return 0;
@@ -728,7 +734,7 @@ void UITest::WaitUntilTabCount(int tab_count) {
}
std::wstring UITest::GetDownloadDirectory() {
- scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
+ scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
if (!tab_proxy.get())
return false;
@@ -792,7 +798,7 @@ void UITest::WaitForFinish(const std::string &name,
cookie_name.append(".");
cookie_name.append(test_complete_cookie);
- scoped_ptr<TabProxy> tab(GetActiveTab());
+ scoped_refptr<TabProxy> tab(GetActiveTab());
bool test_result = WaitUntilCookieValue(tab.get(), url,
cookie_name.c_str(),
diff --git a/chrome/test/ui/ui_test.h b/chrome/test/ui/ui_test.h
index 543f1fd..69e3c507 100644
--- a/chrome/test/ui/ui_test.h
+++ b/chrome/test/ui/ui_test.h
@@ -427,10 +427,10 @@ class UITest : public testing::Test {
// tab or there was some kind of error. Only looks at the first window, for
// backward compatibility. The returned pointer MUST be deleted by the
// caller if non-NULL.
- TabProxy* GetActiveTab() { return GetActiveTab(0); }
+ scoped_refptr<TabProxy> GetActiveTab();
// Like above, but looks at the window at the given index.
- TabProxy* GetActiveTab(int window_index);
+ scoped_refptr<TabProxy> GetActiveTab(int window_index);
// ********* Member variables *********
diff --git a/chrome/test/ui/v8_benchmark_uitest.cc b/chrome/test/ui/v8_benchmark_uitest.cc
index 76deb22..5d16776 100644
--- a/chrome/test/ui/v8_benchmark_uitest.cc
+++ b/chrome/test/ui/v8_benchmark_uitest.cc
@@ -39,7 +39,7 @@ class V8BenchmarkTest : public UITest {
test_path = test_path.Append(start_file);
GURL test_url(net::FilePathToFileURL(test_path));
- scoped_ptr<TabProxy> tab(GetActiveTab());
+ scoped_refptr<TabProxy> tab(GetActiveTab());
tab->NavigateToURL(test_url);
// Wait for the test to finish.
diff --git a/chrome/test/url_fetch_test/url_fetch_test.cc b/chrome/test/url_fetch_test/url_fetch_test.cc
index bb773a5..b48ff96 100644
--- a/chrome/test/url_fetch_test/url_fetch_test.cc
+++ b/chrome/test/url_fetch_test/url_fetch_test.cc
@@ -27,7 +27,7 @@ class UrlFetchTest : public UITest {
void RunTest(const GURL& url, const char *waitCookieName,
const char *waitCookieValue, const wchar_t *varToFetch,
UrlFetchTestResult *result) {
- scoped_ptr<TabProxy> tab(GetActiveTab());
+ scoped_refptr<TabProxy> tab(GetActiveTab());
tab->NavigateToURL(url);
if (waitCookieName) {
diff --git a/chrome/worker/worker_uitest.cc b/chrome/worker/worker_uitest.cc
index 205b957..d4b5095 100644
--- a/chrome/worker/worker_uitest.cc
+++ b/chrome/worker/worker_uitest.cc
@@ -18,7 +18,7 @@ class WorkerTest : public UITest {
}
void RunTest(const std::wstring& test_case) {
- scoped_ptr<TabProxy> tab(GetActiveTab());
+ scoped_refptr<TabProxy> tab(GetActiveTab());
GURL url = GetTestUrl(L"workers", test_case);
ASSERT_TRUE(tab->NavigateToURL(url));