diff options
author | stoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-28 19:12:46 +0000 |
---|---|---|
committer | stoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-28 19:12:46 +0000 |
commit | 802376eb9aacca5284b76da93face73a9488bdb6 (patch) | |
tree | 705226a6750fed9a1429aaf07fe9c0a03303c759 /chrome/browser | |
parent | 319d4ae6c8b2236fa7e0acf218c533a5a93af5a6 (diff) | |
download | chromium_src-802376eb9aacca5284b76da93face73a9488bdb6.zip chromium_src-802376eb9aacca5284b76da93face73a9488bdb6.tar.gz chromium_src-802376eb9aacca5284b76da93face73a9488bdb6.tar.bz2 |
Make automation proxy objects to ref_counted. That allows to process async notifications directly in channel background thread. Add support for listener-less ChannelProxy.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/113722
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17093 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
20 files changed, 256 insertions, 260 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)); |