diff options
author | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-07 22:31:47 +0000 |
---|---|---|
committer | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-07 22:31:47 +0000 |
commit | 5c943180e410b2a4e76f93e1612985cdab407e8c (patch) | |
tree | 6aef67f089f4ecbd73fbdac524f7627ecfb6b6a2 /chrome/browser | |
parent | 23512f4ba83ab011aac513972290aa30b26785cd (diff) | |
download | chromium_src-5c943180e410b2a4e76f93e1612985cdab407e8c.zip chromium_src-5c943180e410b2a4e76f93e1612985cdab407e8c.tar.gz chromium_src-5c943180e410b2a4e76f93e1612985cdab407e8c.tar.bz2 |
Sprinkle some defensiveness into the UI tests so that they don't explode if the proxy doesn't respond (e.g., due to a timeout).
BUG=none
TEST=Hopefully the Mac valgrind bots will more reliably run all their tests (although there are likely more issues like this lurking).
Review URL: http://codereview.chromium.org/149281
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20096 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/browser_uitest.cc | 4 | ||||
-rw-r--r-- | chrome/browser/crash_recovery_uitest.cc | 2 | ||||
-rw-r--r-- | chrome/browser/download/download_uitest.cc | 6 | ||||
-rw-r--r-- | chrome/browser/download/save_page_uitest.cc | 5 | ||||
-rw-r--r-- | chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc | 7 | ||||
-rw-r--r-- | chrome/browser/sessions/session_restore_uitest.cc | 13 | ||||
-rw-r--r-- | chrome/browser/tab_contents/view_source_uitest.cc | 1 | ||||
-rw-r--r-- | chrome/browser/tab_restore_uitest.cc | 20 | ||||
-rw-r--r-- | chrome/browser/unload_uitest.cc | 4 | ||||
-rw-r--r-- | chrome/browser/views/find_bar_win_uitest.cc | 3 |
10 files changed, 57 insertions, 8 deletions
diff --git a/chrome/browser/browser_uitest.cc b/chrome/browser/browser_uitest.cc index 108273e..3b14290 100644 --- a/chrome/browser/browser_uitest.cc +++ b/chrome/browser/browser_uitest.cc @@ -198,6 +198,7 @@ TEST_F(BrowserTest, DISABLED_JavascriptAlertActivatesTab) { int javascript_tab_index; ASSERT_TRUE(window->GetActiveTabIndex(&javascript_tab_index)); scoped_refptr<TabProxy> javascript_tab = window->GetActiveTab(); + ASSERT_TRUE(javascript_tab.get()); // 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)); @@ -226,6 +227,7 @@ TEST_F(BrowserTest, NullOpenerRedirectForksProcess) { FilePath test_file(test_data_directory_); scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); scoped_refptr<TabProxy> tab(window->GetActiveTab()); + ASSERT_TRUE(tab.get()); // Start with a file:// url test_file = test_file.AppendASCII("title2.html"); @@ -268,6 +270,7 @@ TEST_F(BrowserTest, OtherRedirectsDontForkProcess) { FilePath test_file(test_data_directory_); scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); scoped_refptr<TabProxy> tab(window->GetActiveTab()); + ASSERT_TRUE(tab.get()); // Start with a file:// url test_file = test_file.AppendASCII("title2.html"); @@ -342,6 +345,7 @@ TEST_F(ShowModalDialogTest, BasicTest) { scoped_refptr<BrowserProxy> browser = automation()->GetBrowserWindow(1); scoped_refptr<TabProxy> tab = browser->GetActiveTab(); + ASSERT_TRUE(tab.get()); std::wstring title; ASSERT_TRUE(tab->GetTabTitle(&title)); diff --git a/chrome/browser/crash_recovery_uitest.cc b/chrome/browser/crash_recovery_uitest.cc index 42b2b1a..e016156 100644 --- a/chrome/browser/crash_recovery_uitest.cc +++ b/chrome/browser/crash_recovery_uitest.cc @@ -28,6 +28,7 @@ TEST_F(CrashRecoveryUITest, Reload) { std::wstring title1 = GetActiveTabTitle(); scoped_refptr<TabProxy> tab(GetActiveTab()); + ASSERT_TRUE(tab.get()); // Cause the renderer to crash. // TODO: Need to port crash_service.exe. @@ -65,6 +66,7 @@ TEST_F(CrashRecoveryUITest, LoadInNewTab) { EXPECT_EQ(title, GetActiveTabTitle()); scoped_refptr<TabProxy> tab(GetActiveTab()); + ASSERT_TRUE(tab.get()); // Cause the renderer to crash. // TODO: Need to port crash_service.exe. diff --git a/chrome/browser/download/download_uitest.cc b/chrome/browser/download/download_uitest.cc index c35bafc..8f588fc 100644 --- a/chrome/browser/download/download_uitest.cc +++ b/chrome/browser/download/download_uitest.cc @@ -313,7 +313,7 @@ TEST_F(DownloadTest, MAYBE_IncognitoDownload) { // count and shelf visibility. scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); int window_count = 0; - automation()->GetBrowserWindowCount(&window_count); + ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); ASSERT_EQ(1, window_count); EXPECT_EQ(1, GetTabCount()); bool is_shelf_visible; @@ -324,7 +324,7 @@ TEST_F(DownloadTest, MAYBE_IncognitoDownload) { ASSERT_TRUE(browser->RunCommand(IDC_NEW_INCOGNITO_WINDOW)); scoped_refptr<BrowserProxy> incognito(automation()->GetBrowserWindow(1)); scoped_refptr<TabProxy> tab(incognito->GetTab(0)); - automation()->GetBrowserWindowCount(&window_count); + ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); ASSERT_EQ(2, window_count); // Download something. @@ -339,7 +339,7 @@ TEST_F(DownloadTest, MAYBE_IncognitoDownload) { // Close the Incognito window and don't crash. ASSERT_TRUE(incognito->RunCommand(IDC_CLOSE_WINDOW)); - automation()->GetBrowserWindowCount(&window_count); + ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); ASSERT_EQ(1, window_count); // Verify that the regular window does not have a download shelf. diff --git a/chrome/browser/download/save_page_uitest.cc b/chrome/browser/download/save_page_uitest.cc index cbd10c1..fbef625 100644 --- a/chrome/browser/download/save_page_uitest.cc +++ b/chrome/browser/download/save_page_uitest.cc @@ -103,6 +103,7 @@ TEST_F(SavePageTest, MAYBE_SaveHTMLOnly) { GURL url = URLRequestMockHTTPJob::GetMockUrl( UTF8ToWide(std::string(kTestDir) + "/" + file_name)); scoped_refptr<TabProxy> tab(GetActiveTab()); + ASSERT_TRUE(tab.get()); ASSERT_TRUE(tab->NavigateToURL(url)); WaitUntilTabCount(1); @@ -125,6 +126,7 @@ TEST_F(SavePageTest, MAYBE_SaveCompleteHTML) { GURL url = URLRequestMockHTTPJob::GetMockUrl( UTF8ToWide(std::string(kTestDir) + "/" + file_name)); scoped_refptr<TabProxy> tab(GetActiveTab()); + ASSERT_TRUE(tab.get()); ASSERT_TRUE(tab->NavigateToURL(url)); WaitUntilTabCount(1); @@ -148,6 +150,7 @@ TEST_F(SavePageTest, NoSave) { FilePath dir = save_dir_.AppendASCII("c_files"); scoped_refptr<TabProxy> tab(GetActiveTab()); + ASSERT_TRUE(tab.get()); ASSERT_TRUE(tab->NavigateToURL(GURL("about:blank"))); WaitUntilTabCount(1); @@ -169,6 +172,7 @@ TEST_F(SavePageTest, MAYBE_FilenameFromPageTitle) { GURL url = URLRequestMockHTTPJob::GetMockUrl( UTF8ToWide(std::string(kTestDir) + "/" + file_name)); scoped_refptr<TabProxy> tab(GetActiveTab()); + ASSERT_TRUE(tab.get()); ASSERT_TRUE(tab->NavigateToURL(url)); WaitUntilTabCount(1); @@ -201,6 +205,7 @@ TEST_F(SavePageTest, CleanFilenameFromPageTitle) { GURL url = URLRequestMockHTTPJob::GetMockUrl( UTF8ToWide(std::string(kTestDir) + "/" + file_name)); scoped_refptr<TabProxy> tab(GetActiveTab()); + ASSERT_TRUE(tab.get()); ASSERT_TRUE(tab->NavigateToURL(url)); WaitUntilTabCount(1); diff --git a/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc b/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc index 99eff3c..3cd1f88 100644 --- a/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc +++ b/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc @@ -91,6 +91,7 @@ TEST_F(ResourceDispatcherTest, SyncXMLHttpRequest) { scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); EXPECT_TRUE(browser_proxy.get()); scoped_refptr<TabProxy> tab(browser_proxy->GetActiveTab()); + ASSERT_TRUE(tab.get()); tab->NavigateToURL(server->TestServerPageW( L"files/sync_xmlhttprequest.html")); @@ -111,6 +112,7 @@ TEST_F(ResourceDispatcherTest, SyncXMLHttpRequest_Disallowed) { scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); EXPECT_TRUE(browser_proxy.get()); scoped_refptr<TabProxy> tab(browser_proxy->GetActiveTab()); + ASSERT_TRUE(tab.get()); tab->NavigateToURL(server->TestServerPageW( L"files/sync_xmlhttprequest_disallowed.html")); @@ -134,6 +136,7 @@ TEST_F(ResourceDispatcherTest, SyncXMLHttpRequest_DuringUnload) { scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); EXPECT_TRUE(browser_proxy.get()); scoped_refptr<TabProxy> tab(browser_proxy->GetActiveTab()); + ASSERT_TRUE(tab.get()); tab->NavigateToURL( server->TestServerPageW(L"files/sync_xmlhttprequest_during_unload.html")); @@ -171,6 +174,7 @@ TEST_F(ResourceDispatcherTest, CrossSiteOnunloadCookie) { scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); EXPECT_TRUE(browser_proxy.get()); scoped_refptr<TabProxy> tab(browser_proxy->GetActiveTab()); + ASSERT_TRUE(tab.get()); GURL url(server->TestServerPageW(L"files/onunload_cookie.html")); tab->NavigateToURL(url); @@ -209,6 +213,7 @@ TEST_F(ResourceDispatcherTest, CrossSiteAfterCrash) { scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); EXPECT_TRUE(browser_proxy.get()); scoped_refptr<TabProxy> tab(browser_proxy->GetActiveTab()); + ASSERT_TRUE(tab.get()); // Cause the renderer to crash. // TODO(albertb): We need to disable this on Linux since @@ -233,6 +238,7 @@ TEST_F(ResourceDispatcherTest, CrossSiteNavigationNonBuffered) { scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); EXPECT_TRUE(browser_proxy.get()); scoped_refptr<TabProxy> tab(browser_proxy->GetActiveTab()); + ASSERT_TRUE(tab.get()); // Start with an HTTP page. CheckTitleTest(L"content-sniffer-test0.html", @@ -262,6 +268,7 @@ TEST_F(ResourceDispatcherTest, CrossSiteNavigationErrorPage) { scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); EXPECT_TRUE(browser_proxy.get()); scoped_refptr<TabProxy> tab(browser_proxy->GetActiveTab()); + ASSERT_TRUE(tab.get()); GURL url(server->TestServerPageW(L"files/onunload_cookie.html")); tab->NavigateToURL(url); diff --git a/chrome/browser/sessions/session_restore_uitest.cc b/chrome/browser/sessions/session_restore_uitest.cc index 6b4ea30..e1de219 100644 --- a/chrome/browser/sessions/session_restore_uitest.cc +++ b/chrome/browser/sessions/session_restore_uitest.cc @@ -45,7 +45,7 @@ class SessionRestoreUITest : public UITest { ASSERT_TRUE(browser_proxy.get()); ASSERT_TRUE(browser_proxy->RunCommand(IDC_CLOSE_WINDOW)); int window_count; - automation()->GetBrowserWindowCount(&window_count); + ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); ASSERT_EQ(initial_count - 1, window_count); } @@ -71,6 +71,7 @@ class SessionRestoreUITest : public UITest { ASSERT_EQ(0, active_tab_index); scoped_refptr<TabProxy> tab_proxy(browser_proxy->GetActiveTab()); + ASSERT_TRUE(tab_proxy.get()); ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_timeout_ms())); ASSERT_TRUE(tab_proxy->GetCurrentURL(url)); @@ -110,6 +111,7 @@ TEST_F(SessionRestoreUITest, RestoresForwardAndBackwardNavs) { NavigateToURL(url3_); scoped_refptr<TabProxy> active_tab(GetActiveTab()); + ASSERT_TRUE(active_tab.get()); ASSERT_TRUE(active_tab->GoBack()); QuitBrowserAndRestore(1); @@ -148,6 +150,7 @@ TEST_F(SessionRestoreUITest, RestoresCrossSiteForwardAndBackwardNavs) { NavigateToURL(url2_); scoped_refptr<TabProxy> active_tab(GetActiveTab()); + ASSERT_TRUE(active_tab.get()); ASSERT_TRUE(active_tab->GoBack()); QuitBrowserAndRestore(1); @@ -199,7 +202,6 @@ TEST_F(SessionRestoreUITest, TwoTabsSecondSelected) { ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count) && window_count == 1); browser_proxy = automation()->GetBrowserWindow(0); - scoped_refptr<TabProxy> tab_proxy(browser_proxy->GetTab(0)); int tab_count; ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count)); @@ -209,13 +211,15 @@ TEST_F(SessionRestoreUITest, TwoTabsSecondSelected) { ASSERT_TRUE(browser_proxy->GetActiveTabIndex(&active_tab_index)); ASSERT_EQ(1, active_tab_index); - tab_proxy = browser_proxy->GetActiveTab(); + scoped_refptr<TabProxy> tab_proxy(browser_proxy->GetActiveTab()); + ASSERT_TRUE(tab_proxy.get()); ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_timeout_ms())); ASSERT_TRUE(GetActiveTabURL() == url2_); ASSERT_TRUE(browser_proxy->ActivateTab(0)); tab_proxy = browser_proxy->GetActiveTab(); + ASSERT_TRUE(tab_proxy.get()); ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_timeout_ms())); ASSERT_TRUE(GetActiveTabURL() == url1_); @@ -236,6 +240,7 @@ TEST_F(SessionRestoreUITest, ClosedTabStaysClosed) { browser_proxy->AppendTab(url2_); scoped_refptr<TabProxy> active_tab(browser_proxy->GetActiveTab()); + ASSERT_TRUE(active_tab.get()); active_tab->Close(true); QuitBrowserAndRestore(1); @@ -263,7 +268,7 @@ TEST_F(SessionRestoreUITest, DontRestoreWhileIncognito) { // Create an off the record window. ASSERT_TRUE(browser_proxy->RunCommand(IDC_NEW_INCOGNITO_WINDOW)); int window_count; - automation()->GetBrowserWindowCount(&window_count); + ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); ASSERT_EQ(2, window_count); // Close the first window. diff --git a/chrome/browser/tab_contents/view_source_uitest.cc b/chrome/browser/tab_contents/view_source_uitest.cc index dd01e49..04499ff 100644 --- a/chrome/browser/tab_contents/view_source_uitest.cc +++ b/chrome/browser/tab_contents/view_source_uitest.cc @@ -46,6 +46,7 @@ TEST_F(ViewSourceTest, DoesBrowserRenderInViewSource) { GURL url = server->TestServerPageW(test_html_); url = GURL("view-source:" + url.spec()); scoped_refptr<TabProxy> tab(GetActiveTab()); + ASSERT_TRUE(tab.get()); 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 0cb8f829..679f910 100644 --- a/chrome/browser/tab_restore_uitest.cc +++ b/chrome/browser/tab_restore_uitest.cc @@ -81,6 +81,7 @@ class TabRestoreUITest : public UITest { ASSERT_GT(tab_count, expected_tabstrip_index); scoped_refptr<TabProxy> restored_tab_proxy( browser_proxy->GetTab(expected_tabstrip_index)); + ASSERT_TRUE(restored_tab_proxy.get()); // Wait for the restored tab to finish loading. ASSERT_TRUE(restored_tab_proxy->WaitForTabToBeRestored( action_max_timeout_ms())); @@ -149,6 +150,7 @@ TEST_F(TabRestoreUITest, Basic) { int closed_tab_index = tab_count - 1; scoped_refptr<TabProxy> new_tab(browser_proxy->GetTab(closed_tab_index)); + ASSERT_TRUE(new_tab.get()); // Make sure we're at url. new_tab->NavigateToURL(url1_); // Close the tab. @@ -178,6 +180,7 @@ TEST_F(TabRestoreUITest, MiddleTab) { // Close one in the middle int closed_tab_index = starting_tab_count + 1; scoped_refptr<TabProxy> new_tab(browser_proxy->GetTab(closed_tab_index)); + ASSERT_TRUE(new_tab.get()); // Make sure we're at url. new_tab->NavigateToURL(url1_); // Close the tab. @@ -213,6 +216,7 @@ TEST_F(TabRestoreUITest, DISABLED_RestoreToDifferentWindow) { // Close one in the middle int closed_tab_index = starting_tab_count + 1; scoped_refptr<TabProxy> new_tab(browser_proxy->GetTab(closed_tab_index)); + ASSERT_TRUE(new_tab.get()); // Make sure we're at url. new_tab->NavigateToURL(url1_); // Close the tab. @@ -252,12 +256,14 @@ TEST_F(TabRestoreUITest, MAYBE_BasicRestoreFromClosedWindow) { // Close tabs until we only have one open. while (tab_count > 1) { scoped_refptr<TabProxy> tab_to_close(browser_proxy->GetTab(0)); + ASSERT_TRUE(tab_to_close.get()); tab_to_close->Close(true); ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count)); } // Navigate to url1 then url2. scoped_refptr<TabProxy> tab_proxy(browser_proxy->GetTab(0)); + ASSERT_TRUE(tab_proxy.get()); tab_proxy->NavigateToURL(url1_); tab_proxy->NavigateToURL(url2_); @@ -283,6 +289,7 @@ TEST_F(TabRestoreUITest, MAYBE_BasicRestoreFromClosedWindow) { browser_proxy = automation()->GetBrowserWindow(1); CheckActiveWindow(browser_proxy.get()); tab_proxy = browser_proxy->GetActiveTab(); + ASSERT_TRUE(tab_proxy.get()); // And make sure the URLs matches. EXPECT_EQ(url2_, GetActiveTabURL(1)); EXPECT_TRUE(tab_proxy->GoBack()); @@ -306,6 +313,7 @@ TEST_F(TabRestoreUITest, DISABLED_DontLoadRestoredTab) { // Close one of them. scoped_refptr<TabProxy> tab_to_close(browser_proxy->GetTab(0)); + ASSERT_TRUE(tab_to_close.get()); tab_to_close->Close(true); ASSERT_TRUE(browser_proxy->GetTabCount(¤t_tab_count)); ASSERT_EQ(current_tab_count, starting_tab_count + 1); @@ -340,6 +348,7 @@ TEST_F(TabRestoreUITest, DISABLED_RestoreWindowAndTab) { // Close one in the middle int closed_tab_index = starting_tab_count + 1; scoped_refptr<TabProxy> new_tab(browser_proxy->GetTab(closed_tab_index)); + ASSERT_TRUE(new_tab.get()); // Make sure we're at url. new_tab->NavigateToURL(url1_); // Close the tab. @@ -393,6 +402,7 @@ TEST_F(TabRestoreUITest, RestoreIntoSameWindow) { // Navigate the rightmost one to url2_ for easier identification. scoped_refptr<TabProxy> tab_proxy(browser_proxy->GetTab(tab_count - 1)); + ASSERT_TRUE(tab_proxy.get()); tab_proxy->NavigateToURL(url2_); // Create a new browser. @@ -405,12 +415,14 @@ TEST_F(TabRestoreUITest, RestoreIntoSameWindow) { // Close all but one tab in the first browser, left to right. while (tab_count > 1) { scoped_refptr<TabProxy> tab_to_close(browser_proxy->GetTab(0)); + ASSERT_TRUE(tab_to_close.get()); tab_to_close->Close(true); ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count)); } // Close the last tab, closing the browser. tab_proxy = browser_proxy->GetTab(0); + ASSERT_TRUE(tab_proxy.get()); EXPECT_TRUE(tab_proxy->Close(true)); ASSERT_TRUE(automation()->WaitForWindowCountToBecome( 1, action_max_timeout_ms())); @@ -453,6 +465,7 @@ TEST_F(TabRestoreUITest, RestoreWithExistingSiteInstance) { ASSERT_TRUE(browser_proxy->GetTabCount(&new_tab_count)); EXPECT_EQ(++tab_count, new_tab_count); scoped_refptr<TabProxy> tab(browser_proxy->GetTab(tab_count - 1)); + ASSERT_TRUE(tab.get()); // Navigate to another same-site URL. tab->NavigateToURL(http_url2); @@ -469,6 +482,7 @@ TEST_F(TabRestoreUITest, RestoreWithExistingSiteInstance) { // Restore the closed tab. RestoreTab(0, tab_count - 1); tab = browser_proxy->GetActiveTab(); + ASSERT_TRUE(tab.get()); // And make sure the URLs match. EXPECT_EQ(http_url2, GetActiveTabURL()); @@ -497,6 +511,7 @@ TEST_F(TabRestoreUITest, RestoreCrossSiteWithExistingSiteInstance) { ASSERT_TRUE(browser_proxy->GetTabCount(&new_tab_count)); EXPECT_EQ(++tab_count, new_tab_count); scoped_refptr<TabProxy> tab(browser_proxy->GetTab(tab_count - 1)); + ASSERT_TRUE(tab.get()); // Navigate to more URLs, then a cross-site URL. tab->NavigateToURL(http_url2); @@ -515,6 +530,7 @@ TEST_F(TabRestoreUITest, RestoreCrossSiteWithExistingSiteInstance) { // Restore the closed tab. RestoreTab(0, tab_count - 1); tab = browser_proxy->GetActiveTab(); + ASSERT_TRUE(tab.get()); // And make sure the URLs match. EXPECT_EQ(url1_, GetActiveTabURL()); @@ -545,11 +561,13 @@ TEST_F(TabRestoreUITest, RestoreWindow) { ASSERT_TRUE(browser_proxy->WaitForTabCountToBecome(initial_tab_count + 1, action_max_timeout_ms())); scoped_refptr<TabProxy> new_tab(browser_proxy->GetTab(initial_tab_count)); + ASSERT_TRUE(new_tab.get()); new_tab->NavigateToURL(url1_); browser_proxy->AppendTab(url2_); ASSERT_TRUE(browser_proxy->WaitForTabCountToBecome(initial_tab_count + 2, action_max_timeout_ms())); new_tab = browser_proxy->GetTab(initial_tab_count + 1); + ASSERT_TRUE(new_tab.get()); new_tab->NavigateToURL(url2_); // Close the window. @@ -572,12 +590,14 @@ TEST_F(TabRestoreUITest, RestoreWindow) { scoped_refptr<TabProxy> restored_tab_proxy( browser_proxy->GetTab(initial_tab_count)); + ASSERT_TRUE(restored_tab_proxy.get()); 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 = browser_proxy->GetTab(initial_tab_count + 1); + ASSERT_TRUE(restored_tab_proxy.get()); 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 2015a23..1547ccb 100644 --- a/chrome/browser/unload_uitest.cc +++ b/chrome/browser/unload_uitest.cc @@ -336,7 +336,7 @@ TEST_F(UnloadTest, BrowserCloseTwoSecondBeforeUnloadAlert) { TEST_F(UnloadTest, DISABLED_BrowserCloseTabWhenOtherTabHasListener) { NavigateToDataURL(CLOSE_TAB_WHEN_OTHER_TAB_HAS_LISTENER, L"only_one_unload"); int window_count; - automation()->GetBrowserWindowCount(&window_count); + ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); ASSERT_EQ(2, window_count); scoped_refptr<BrowserProxy> popup_browser_proxy( @@ -346,6 +346,7 @@ TEST_F(UnloadTest, DISABLED_BrowserCloseTabWhenOtherTabHasListener) { EXPECT_TRUE(popup_browser_proxy->GetTabCount(&popup_tab_count)); EXPECT_EQ(1, popup_tab_count); scoped_refptr<TabProxy> popup_tab(popup_browser_proxy->GetActiveTab()); + ASSERT_TRUE(popup_tab.get()); std::wstring popup_title; ASSERT_TRUE(popup_tab.get() != NULL); EXPECT_TRUE(popup_tab->GetTabTitle(&popup_title)); @@ -359,6 +360,7 @@ TEST_F(UnloadTest, DISABLED_BrowserCloseTabWhenOtherTabHasListener) { EXPECT_TRUE(main_browser_proxy->GetTabCount(&main_tab_count)); EXPECT_EQ(1, main_tab_count); scoped_refptr<TabProxy> main_tab(main_browser_proxy->GetActiveTab()); + ASSERT_TRUE(main_tab.get()); std::wstring main_title; ASSERT_TRUE(main_tab.get() != NULL); EXPECT_TRUE(main_tab->GetTabTitle(&main_title)); diff --git a/chrome/browser/views/find_bar_win_uitest.cc b/chrome/browser/views/find_bar_win_uitest.cc index 5982e9e..9a4ea78 100644 --- a/chrome/browser/views/find_bar_win_uitest.cc +++ b/chrome/browser/views/find_bar_win_uitest.cc @@ -26,6 +26,7 @@ TEST_F(FindInPageControllerTest, FindMovesOnTabClose_Issue1343052) { GURL url = server->TestServerPageW(kSimplePage); scoped_refptr<TabProxy> tabA(GetActiveTab()); + ASSERT_TRUE(tabA.get()); ASSERT_TRUE(tabA->NavigateToURL(url)); WaitUntilTabCount(1); @@ -47,6 +48,7 @@ TEST_F(FindInPageControllerTest, FindMovesOnTabClose_Issue1343052) { // Open another tab (tab B). EXPECT_TRUE(browser->AppendTab(url)); scoped_refptr<TabProxy> tabB(GetActiveTab()); + ASSERT_TRUE(tabB.get()); // Close tab B. EXPECT_TRUE(tabB->Close(true)); @@ -68,6 +70,7 @@ TEST_F(FindInPageControllerTest, FindMovesOnTabClose_Issue1343052) { // Open another tab (tab C). EXPECT_TRUE(browser->AppendTab(url)); scoped_refptr<TabProxy> tabC(GetActiveTab()); + ASSERT_TRUE(tabC.get()); // Close it. EXPECT_TRUE(tabC->Close(true)); |