diff options
34 files changed, 368 insertions, 292 deletions
diff --git a/chrome/browser/browser_encoding_uitest.cc b/chrome/browser/browser_encoding_uitest.cc index 8d68314..c5c3eb7 100644 --- a/chrome/browser/browser_encoding_uitest.cc +++ b/chrome/browser/browser_encoding_uitest.cc @@ -242,7 +242,8 @@ TEST_F(BrowserEncodingTest, TestEncodingAutoDetect) { // Set the default charset to one of encodings not supported by the current // auto-detector (Please refer to the above comments) to make sure we // incorrectly decode the page. Now we use ISO-8859-4. - browser->SetStringPreference(prefs::kDefaultCharset, L"ISO-8859-4"); + ASSERT_TRUE(browser->SetStringPreference(prefs::kDefaultCharset, + L"ISO-8859-4")); scoped_refptr<TabProxy> tab(GetActiveTab()); ASSERT_TRUE(tab.get()); diff --git a/chrome/browser/browser_uitest.cc b/chrome/browser/browser_uitest.cc index 55cb332..324d3cc 100644 --- a/chrome/browser/browser_uitest.cc +++ b/chrome/browser/browser_uitest.cc @@ -39,7 +39,7 @@ class BrowserTest : public UITest { #elif defined(OS_POSIX) // There's nothing to do here if the browser is not running. if (IsBrowserRunning()) { - automation()->SetFilteredInet(false); + EXPECT_TRUE(automation()->SetFilteredInet(false)); int window_count = 0; EXPECT_TRUE(automation()->GetBrowserWindowCount(&window_count)); @@ -193,7 +193,8 @@ TEST_F(BrowserTest, MAYBE_OtherRedirectsDontForkProcess) { // Start with a file:// url test_file = test_file.AppendASCII("title2.html"); - tab->NavigateToURL(net::FilePathToFileURL(test_file)); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, + tab->NavigateToURL(net::FilePathToFileURL(test_file))); int orig_tab_count = -1; ASSERT_TRUE(window->GetTabCount(&orig_tab_count)); int orig_process_count = GetBrowserProcessCount(); diff --git a/chrome/browser/dom_ui/new_tab_ui_uitest.cc b/chrome/browser/dom_ui/new_tab_ui_uitest.cc index 2235bf9..21d7a20 100644 --- a/chrome/browser/dom_ui/new_tab_ui_uitest.cc +++ b/chrome/browser/dom_ui/new_tab_ui_uitest.cc @@ -38,7 +38,7 @@ TEST_F(NewTabUITest, NTPHasThumbnails) { ASSERT_EQ(1, tab_count); // Bring up a new tab page. - window->RunCommand(IDC_NEW_TAB); + ASSERT_TRUE(window->RunCommand(IDC_NEW_TAB)); ASSERT_TRUE(window->GetTabCount(&tab_count)); ASSERT_EQ(2, tab_count); int load_time; @@ -76,7 +76,7 @@ TEST_F(NewTabUITest, ChromeInternalLoadsNTP) { // Go to the "new tab page" using its old url, rather than chrome://newtab. scoped_refptr<TabProxy> tab = window->GetTab(0); ASSERT_TRUE(tab.get()); - tab->NavigateToURLAsync(GURL("chrome-internal:")); + ASSERT_TRUE(tab->NavigateToURLAsync(GURL("chrome-internal:"))); int load_time; ASSERT_TRUE(automation()->WaitForInitialNewTabUILoad(&load_time)); @@ -123,7 +123,7 @@ TEST_F(NewTabUITest, HomePageLink) { ASSERT_EQ(1, tab_count); // Bring up a new tab page. - browser->RunCommand(IDC_NEW_TAB); + ASSERT_TRUE(browser->RunCommand(IDC_NEW_TAB)); ASSERT_TRUE(browser->GetTabCount(&tab_count)); ASSERT_EQ(2, tab_count); int load_time; diff --git a/chrome/browser/download/download_uitest.cc b/chrome/browser/download/download_uitest.cc index 17aa989..2649364 100644 --- a/chrome/browser/download/download_uitest.cc +++ b/chrome/browser/download/download_uitest.cc @@ -274,11 +274,11 @@ TEST_F(DownloadTest, FLAKY_PerWindowShelf) { EXPECT_TRUE(WaitForDownloadShelfVisible(browser.get())); // Open a second tab - browser->AppendTab(GURL()); + ASSERT_TRUE(browser->AppendTab(GURL())); WaitUntilTabCount(2); // Hide shelf - browser->SetShelfVisible(false); + EXPECT_TRUE(browser->SetShelfVisible(false)); EXPECT_TRUE(WaitForDownloadShelfInvisible(browser.get())); // Go to first tab @@ -333,7 +333,7 @@ TEST_F(DownloadTest, FLAKY_IncognitoDownload) { ASSERT_EQ(1, window_count); EXPECT_EQ(1, GetTabCount()); bool is_shelf_visible; - browser->IsShelfVisible(&is_shelf_visible); + EXPECT_TRUE(browser->IsShelfVisible(&is_shelf_visible)); EXPECT_FALSE(is_shelf_visible); // Open an Incognito window. @@ -359,7 +359,7 @@ TEST_F(DownloadTest, FLAKY_IncognitoDownload) { ASSERT_EQ(1, window_count); // Verify that the regular window does not have a download shelf. - browser->IsShelfVisible(&is_shelf_visible); + EXPECT_TRUE(browser->IsShelfVisible(&is_shelf_visible)); EXPECT_FALSE(is_shelf_visible); CleanUpDownload(file); diff --git a/chrome/browser/history/redirect_uitest.cc b/chrome/browser/history/redirect_uitest.cc index 53c238d..976d91b 100644 --- a/chrome/browser/history/redirect_uitest.cc +++ b/chrome/browser/history/redirect_uitest.cc @@ -216,7 +216,7 @@ TEST_F(RedirectTest, NoHttpToFile) { scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); ASSERT_TRUE(tab_proxy.get()); std::wstring actual_title; - tab_proxy->GetTabTitle(&actual_title); + ASSERT_TRUE(tab_proxy->GetTabTitle(&actual_title)); EXPECT_NE(L"File!", actual_title); } diff --git a/chrome/browser/in_process_webkit/dom_storage_uitest.cc b/chrome/browser/in_process_webkit/dom_storage_uitest.cc index 8b8a66d..88cfa871 100644 --- a/chrome/browser/in_process_webkit/dom_storage_uitest.cc +++ b/chrome/browser/in_process_webkit/dom_storage_uitest.cc @@ -69,7 +69,7 @@ class DOMStorageTest : public UILayoutTest { ASSERT_TRUE(tab.get()); GURL url = GetTestUrl(L"layout_tests", L"clear_dom_storage.html"); - tab->SetCookie(url, ""); + ASSERT_TRUE(tab->SetCookie(url, "")); ASSERT_TRUE(tab->NavigateToURL(url)); WaitUntilCookieNonEmpty(tab.get(), url, "cleared", kTestIntervalMs, diff --git a/chrome/browser/metrics/metrics_service_uitest.cc b/chrome/browser/metrics/metrics_service_uitest.cc index d5f4524..9ae51eb 100644 --- a/chrome/browser/metrics/metrics_service_uitest.cc +++ b/chrome/browser/metrics/metrics_service_uitest.cc @@ -97,7 +97,7 @@ TEST_F(MetricsServiceTest, CrashRenderers) { #if defined(OS_WIN) expected_crashes_ = 1; #endif - tab->NavigateToURLAsync(GURL("about:crash")); + ASSERT_TRUE(tab->NavigateToURLAsync(GURL("about:crash"))); } // Give the browser a chance to notice the crashed tab. diff --git a/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc b/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc index 5b3bc5b..5e1d75a 100644 --- a/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc +++ b/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc @@ -86,8 +86,9 @@ TEST_F(ResourceDispatcherTest, SyncXMLHttpRequest) { ASSERT_TRUE(browser_proxy.get()); scoped_refptr<TabProxy> tab(browser_proxy->GetActiveTab()); ASSERT_TRUE(tab.get()); - tab->NavigateToURL(server->TestServerPageW( - L"files/sync_xmlhttprequest.html")); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, + tab->NavigateToURL(server->TestServerPageW( + L"files/sync_xmlhttprequest.html"))); // Let's check the XMLHttpRequest ran successfully. bool success = false; @@ -107,8 +108,9 @@ TEST_F(ResourceDispatcherTest, SyncXMLHttpRequest_Disallowed) { ASSERT_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")); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, + tab->NavigateToURL(server->TestServerPageW( + L"files/sync_xmlhttprequest_disallowed.html"))); // Let's check the XMLHttpRequest ran successfully. bool success = false; @@ -132,8 +134,9 @@ TEST_F(ResourceDispatcherTest, SyncXMLHttpRequest_DuringUnload) { scoped_refptr<TabProxy> tab(browser_proxy->GetActiveTab()); ASSERT_TRUE(tab.get()); - tab->NavigateToURL( - server->TestServerPageW(L"files/sync_xmlhttprequest_during_unload.html")); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, + tab->NavigateToURL(server->TestServerPageW( + L"files/sync_xmlhttprequest_during_unload.html"))); // Confirm that the page has loaded (since it changes its title during load). std::wstring tab_title; @@ -142,7 +145,8 @@ TEST_F(ResourceDispatcherTest, SyncXMLHttpRequest_DuringUnload) { // Navigate to a new page, to dispatch unload event and trigger xhr. // (the bug would make this step hang the renderer). - tab->NavigateToURL(server->TestServerPageW(L"files/title2.html")); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, + tab->NavigateToURL(server->TestServerPageW(L"files/title2.html"))); // Check that the new page got loaded, and that no download was triggered. EXPECT_TRUE(tab->GetTabTitle(&tab_title)); @@ -168,7 +172,7 @@ TEST_F(ResourceDispatcherTest, CrossSiteOnunloadCookie) { ASSERT_TRUE(tab.get()); GURL url(server->TestServerPageW(L"files/onunload_cookie.html")); - tab->NavigateToURL(url); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(url)); // Confirm that the page has loaded (since it changes its title during load). std::wstring tab_title; @@ -216,7 +220,7 @@ TEST_F(ResourceDispatcherTest, CrossSiteAfterCrash) { #if defined(OS_WIN) expected_crashes_ = 1; #endif - tab->NavigateToURLAsync(GURL("about:crash")); + ASSERT_TRUE(tab->NavigateToURLAsync(GURL("about:crash"))); // Wait for browser to notice the renderer crash. PlatformThread::Sleep(sleep_timeout_ms()); @@ -243,7 +247,8 @@ TEST_F(ResourceDispatcherTest, CrossSiteNavigationNonBuffered) { // Make sure that the page loads and displays a title, and doesn't get stuck. FilePath test_file(test_data_directory_); test_file = test_file.AppendASCII("title2.html"); - tab->NavigateToURL(net::FilePathToFileURL(test_file)); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, + tab->NavigateToURL(net::FilePathToFileURL(test_file))); EXPECT_EQ(L"Title Of Awesomeness", GetActiveTabTitle()); } @@ -262,7 +267,7 @@ TEST_F(ResourceDispatcherTest, CrossSiteNavigationErrorPage) { ASSERT_TRUE(tab.get()); GURL url(server->TestServerPageW(L"files/onunload_cookie.html")); - tab->NavigateToURL(url); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(url)); // Confirm that the page has loaded (since it changes its title during load). std::wstring tab_title; @@ -273,8 +278,9 @@ TEST_F(ResourceDispatcherTest, CrossSiteNavigationErrorPage) { // TODO(creis): If this causes crashes or hangs, it might be for the same // reason as ErrorPageTest::DNSError. See bug 1199491 and // http://crbug.com/22877. - tab->NavigateToURLBlockUntilNavigationsComplete( - GURL(URLRequestFailedDnsJob::kTestUrl), 2); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, + tab->NavigateToURLBlockUntilNavigationsComplete( + GURL(URLRequestFailedDnsJob::kTestUrl), 2)); EXPECT_NE(L"set cookie on unload", GetActiveTabTitle()); // Check that the cookie was set, meaning that the onunload handler ran. @@ -292,7 +298,8 @@ TEST_F(ResourceDispatcherTest, CrossSiteNavigationErrorPage) { GURL test_url(server->TestServerPageW(L"files/title2.html")); std::string redirect_url = "javascript:window.location='" + test_url.possibly_invalid_spec() + "'"; - tab->NavigateToURL(GURL(redirect_url)); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, + tab->NavigateToURL(GURL(redirect_url))); EXPECT_TRUE(tab->GetTabTitle(&tab_title)); EXPECT_EQ(L"Title Of Awesomeness", tab_title); } diff --git a/chrome/browser/sessions/session_restore_uitest.cc b/chrome/browser/sessions/session_restore_uitest.cc index 966717c..1947521 100644 --- a/chrome/browser/sessions/session_restore_uitest.cc +++ b/chrome/browser/sessions/session_restore_uitest.cc @@ -103,7 +103,7 @@ TEST_F(SessionRestoreUITest, Basic) { ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_timeout_ms())); ASSERT_EQ(url2_, GetActiveTabURL()); - tab_proxy->GoBack(); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab_proxy->GoBack()); ASSERT_EQ(url1_, GetActiveTabURL()); } @@ -246,11 +246,11 @@ TEST_F(SessionRestoreUITest, ClosedTabStaysClosed) { scoped_refptr<TabProxy> tab_proxy(browser_proxy->GetTab(0)); ASSERT_TRUE(tab_proxy.get()); - browser_proxy->AppendTab(url2_); + ASSERT_TRUE(browser_proxy->AppendTab(url2_)); scoped_refptr<TabProxy> active_tab(browser_proxy->GetActiveTab()); ASSERT_TRUE(active_tab.get()); - active_tab->Close(true); + ASSERT_TRUE(active_tab->Close(true)); QuitBrowserAndRestore(1); browser_proxy = NULL; @@ -285,7 +285,7 @@ TEST_F(SessionRestoreUITest, NormalAndPopup) { scoped_refptr<TabProxy> tab(popup->GetTab(0)); ASSERT_TRUE(tab.get()); - tab->NavigateToURL(url1_); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(url1_)); // Simulate an exit by shuting down the session service. If we don't do this // the first window close is treated as though the user closed the window diff --git a/chrome/browser/tab_contents/view_source_uitest.cc b/chrome/browser/tab_contents/view_source_uitest.cc index 60af8d6..e5d71b7 100644 --- a/chrome/browser/tab_contents/view_source_uitest.cc +++ b/chrome/browser/tab_contents/view_source_uitest.cc @@ -47,12 +47,12 @@ TEST_F(ViewSourceTest, DoesBrowserRenderInViewSource) { url = GURL("view-source:" + url.spec()); scoped_refptr<TabProxy> tab(GetActiveTab()); ASSERT_TRUE(tab.get()); - tab->NavigateToURL(url); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(url)); // Try to retrieve the cookie that the page sets // It should not be there (because we are in view-source mode std::string cookie_found; - tab->GetCookieByName(url, cookie, &cookie_found); + ASSERT_TRUE(tab->GetCookieByName(url, cookie, &cookie_found)); EXPECT_NE(cookie_data, cookie_found); } diff --git a/chrome/browser/tab_restore_uitest.cc b/chrome/browser/tab_restore_uitest.cc index f0725ca..c955eb3 100644 --- a/chrome/browser/tab_restore_uitest.cc +++ b/chrome/browser/tab_restore_uitest.cc @@ -102,7 +102,7 @@ class TabRestoreUITest : public UITest { EXPECT_TRUE(browser->GetTabCount(&starting_tab_count)); for (int i = 0; i < how_many; ++i) { - browser->AppendTab(url1_); + EXPECT_TRUE(browser->AppendTab(url1_)); int current_tab_count; EXPECT_TRUE(browser->GetTabCount(¤t_tab_count)); EXPECT_EQ(starting_tab_count + i + 1, current_tab_count); @@ -156,9 +156,9 @@ TEST_F(TabRestoreUITest, Basic) { 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_); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, new_tab->NavigateToURL(url1_)); // Close the tab. - new_tab->Close(true); + ASSERT_TRUE(new_tab->Close(true)); new_tab = NULL; ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count)); EXPECT_EQ(starting_tab_count, tab_count); @@ -187,9 +187,9 @@ TEST_F(TabRestoreUITest, MiddleTab) { 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_); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, new_tab->NavigateToURL(url1_)); // Close the tab. - new_tab->Close(true); + ASSERT_TRUE(new_tab->Close(true)); new_tab = NULL; ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count)); EXPECT_EQ(starting_tab_count + 2, tab_count); @@ -224,9 +224,9 @@ TEST_F(TabRestoreUITest, FLAKY_RestoreToDifferentWindow) { 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_); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, new_tab->NavigateToURL(url1_)); // Close the tab. - new_tab->Close(true); + ASSERT_TRUE(new_tab->Close(true)); new_tab = NULL; ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count)); EXPECT_EQ(starting_tab_count + 2, tab_count); @@ -264,15 +264,15 @@ TEST_F(TabRestoreUITest, MAYBE_BasicRestoreFromClosedWindow) { 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(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_); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab_proxy->NavigateToURL(url1_)); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab_proxy->NavigateToURL(url2_)); // Create a new browser. ASSERT_TRUE(automation()->OpenNewBrowserWindow(Browser::TYPE_NORMAL, false)); @@ -323,7 +323,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(tab_to_close->Close(true)); ASSERT_TRUE(browser_proxy->GetTabCount(¤t_tab_count)); ASSERT_EQ(current_tab_count, starting_tab_count + 1); @@ -358,9 +358,9 @@ TEST_F(TabRestoreUITest, FLAKY_RestoreWindowAndTab) { 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_); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, new_tab->NavigateToURL(url1_)); // Close the tab. - new_tab->Close(true); + ASSERT_TRUE(new_tab->Close(true)); new_tab = NULL; ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count)); EXPECT_EQ(starting_tab_count + 2, tab_count); @@ -413,7 +413,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_); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab_proxy->NavigateToURL(url2_)); // Create a new browser. ASSERT_TRUE(automation()->OpenNewBrowserWindow(Browser::TYPE_NORMAL, false)); @@ -426,7 +426,7 @@ TEST_F(TabRestoreUITest, RestoreIntoSameWindow) { 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(tab_to_close->Close(true)); ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count)); } @@ -472,7 +472,7 @@ TEST_F(TabRestoreUITest, RestoreWithExistingSiteInstance) { ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count)); // Add a tab - browser_proxy->AppendTab(http_url1); + ASSERT_TRUE(browser_proxy->AppendTab(http_url1)); int new_tab_count; ASSERT_TRUE(browser_proxy->GetTabCount(&new_tab_count)); EXPECT_EQ(++tab_count, new_tab_count); @@ -480,16 +480,16 @@ TEST_F(TabRestoreUITest, RestoreWithExistingSiteInstance) { ASSERT_TRUE(tab.get()); // Navigate to another same-site URL. - tab->NavigateToURL(http_url2); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(http_url2)); // Close the tab. - tab->Close(true); + ASSERT_TRUE(tab->Close(true)); 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 // will already exist when the restore happens. - browser_proxy->AppendTab(http_url2); + ASSERT_TRUE(browser_proxy->AppendTab(http_url2)); // Restore the closed tab. RestoreTab(0, tab_count - 1); @@ -519,7 +519,7 @@ TEST_F(TabRestoreUITest, RestoreCrossSiteWithExistingSiteInstance) { ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count)); // Add a tab - browser_proxy->AppendTab(http_url1); + ASSERT_TRUE(browser_proxy->AppendTab(http_url1)); int new_tab_count; ASSERT_TRUE(browser_proxy->GetTabCount(&new_tab_count)); EXPECT_EQ(++tab_count, new_tab_count); @@ -527,18 +527,18 @@ TEST_F(TabRestoreUITest, RestoreCrossSiteWithExistingSiteInstance) { ASSERT_TRUE(tab.get()); // Navigate to more URLs, then a cross-site URL. - tab->NavigateToURL(http_url2); - tab->NavigateToURL(http_url1); - tab->NavigateToURL(url1_); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(http_url2)); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(http_url1)); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(url1_)); // Close the tab. - tab->Close(true); + ASSERT_TRUE(tab->Close(true)); 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 // the user clicks Back in the restored tab. - browser_proxy->AppendTab(http_url2); + ASSERT_TRUE(browser_proxy->AppendTab(http_url2)); // Restore the closed tab. RestoreTab(0, tab_count - 1); @@ -552,7 +552,7 @@ TEST_F(TabRestoreUITest, RestoreCrossSiteWithExistingSiteInstance) { // Navigating to a new URL should clear the forward list, because the max // page ID of the renderer should have been updated when we restored the tab. - tab->NavigateToURL(http_url2); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(http_url2)); EXPECT_FALSE(tab->GoForward()); EXPECT_EQ(http_url2, GetActiveTabURL()); } @@ -571,18 +571,18 @@ TEST_F(TabRestoreUITest, RestoreWindow) { ASSERT_TRUE(browser_proxy.get()); int initial_tab_count; ASSERT_TRUE(browser_proxy->GetTabCount(&initial_tab_count)); - browser_proxy->AppendTab(url1_); + ASSERT_TRUE(browser_proxy->AppendTab(url1_)); 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_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, new_tab->NavigateToURL(url1_)); + ASSERT_TRUE(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_); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, new_tab->NavigateToURL(url2_)); // Close the window. ASSERT_TRUE(browser_proxy->RunCommand(IDC_CLOSE_WINDOW)); diff --git a/chrome/test/automated_ui_tests/automated_ui_test_base.cc b/chrome/test/automated_ui_tests/automated_ui_test_base.cc index 884110b..946f3da 100644 --- a/chrome/test/automated_ui_tests/automated_ui_test_base.cc +++ b/chrome/test/automated_ui_tests/automated_ui_test_base.cc @@ -39,9 +39,12 @@ bool AutomatedUITestBase::CloseActiveTab() { BrowserProxy* browser = active_browser(); int tab_count; bool is_timeout; - browser->GetTabCountWithTimeout(&tab_count, - action_max_timeout_ms(), - &is_timeout); + if (!browser->GetTabCountWithTimeout(&tab_count, + action_max_timeout_ms(), + &is_timeout)) { + LogErrorMessage("get_tab_count_with_timeout_failed"); + return false; + } if (is_timeout) { LogInfoMessage("get_tab_count_timed_out"); @@ -101,9 +104,12 @@ bool AutomatedUITestBase::DragTabOut() { bool is_timeout; int tab_count; - browser->GetTabCountWithTimeout(&tab_count, - action_max_timeout_ms(), - &is_timeout); + if (!browser->GetTabCountWithTimeout(&tab_count, + action_max_timeout_ms(), + &is_timeout)) { + LogErrorMessage("get_tab_count_with_timeout_failed"); + return false; + } if (tab_count < 2) { LogWarningMessage("not_enough_tabs_to_drag_out"); @@ -176,9 +182,12 @@ bool AutomatedUITestBase::DragActiveTab(bool drag_right) { bool is_timeout; int tab_count; - browser->GetTabCountWithTimeout(&tab_count, - action_max_timeout_ms(), - &is_timeout); + if (!browser->GetTabCountWithTimeout(&tab_count, + action_max_timeout_ms(), + &is_timeout)) { + LogErrorMessage("get_tab_cound_with_timeout_failed"); + return false; + } if (tab_count < 2) { LogWarningMessage("not_enough_tabs_to_drag_around"); @@ -302,10 +311,13 @@ bool AutomatedUITestBase::Navigate(const GURL& url) { return false; } bool did_timeout = false; - tab->NavigateToURLWithTimeout(url, - 1, - command_execution_timeout_ms(), - &did_timeout); + AutomationMsg_NavigationResponseValues result = + tab->NavigateToURLWithTimeout(url, 1, command_execution_timeout_ms(), + &did_timeout); + if (result != AUTOMATION_MSG_NAVIGATION_SUCCESS) { + LogErrorMessage("navigation_failed"); + return false; + } if (did_timeout) { LogWarningMessage("timeout"); diff --git a/chrome/test/automated_ui_tests/automated_ui_test_interactive_test.cc b/chrome/test/automated_ui_tests/automated_ui_test_interactive_test.cc index 328ec13..b3952b2 100644 --- a/chrome/test/automated_ui_tests/automated_ui_test_interactive_test.cc +++ b/chrome/test/automated_ui_tests/automated_ui_test_interactive_test.cc @@ -15,7 +15,7 @@ TEST_F(AutomatedUITestBase, DragOut) { PlatformThread::Sleep(sleep_timeout_ms()); ASSERT_TRUE(DragTabOut()); int window_count; - automation()->GetBrowserWindowCount(&window_count); + ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); ASSERT_EQ(2, window_count); } diff --git a/chrome/test/automated_ui_tests/automated_ui_test_test.cc b/chrome/test/automated_ui_tests/automated_ui_test_test.cc index bf29fca..393a9cc 100644 --- a/chrome/test/automated_ui_tests/automated_ui_test_test.cc +++ b/chrome/test/automated_ui_tests/automated_ui_test_test.cc @@ -64,43 +64,44 @@ TEST_F(AutomatedUITestBase, Home) { TEST_F(AutomatedUITestBase, OpenNewTab) { int tab_count; - active_browser()->GetTabCount(&tab_count); + ASSERT_TRUE(active_browser()->GetTabCount(&tab_count)); ASSERT_EQ(1, tab_count); NewTab(); - active_browser()->GetTabCount(&tab_count); + ASSERT_TRUE(active_browser()->GetTabCount(&tab_count)); ASSERT_EQ(2, tab_count); NewTab(); - active_browser()->GetTabCount(&tab_count); + ASSERT_TRUE(active_browser()->GetTabCount(&tab_count)); ASSERT_EQ(3, tab_count); } TEST_F(AutomatedUITestBase, DuplicateTab) { int tab_count; - active_browser()->GetTabCount(&tab_count); + ASSERT_TRUE(active_browser()->GetTabCount(&tab_count)); ASSERT_EQ(1, tab_count); DuplicateTab(); - active_browser()->GetTabCount(&tab_count); + ASSERT_TRUE(active_browser()->GetTabCount(&tab_count)); ASSERT_EQ(2, tab_count); DuplicateTab(); - active_browser()->GetTabCount(&tab_count); + ASSERT_TRUE(active_browser()->GetTabCount(&tab_count)); ASSERT_EQ(3, tab_count); } TEST_F(AutomatedUITestBase, DISABLED_RestoreTab) { int tab_count; - active_browser()->GetTabCount(&tab_count); + ASSERT_TRUE(active_browser()->GetTabCount(&tab_count)); ASSERT_EQ(1, tab_count); NewTab(); - active_browser()->GetTabCount(&tab_count); + ASSERT_TRUE(active_browser()->GetTabCount(&tab_count)); ASSERT_EQ(2, tab_count); FilePath path_prefix(test_data_directory_.AppendASCII("session_history")); GURL test_url = net::FilePathToFileURL(path_prefix.AppendASCII("bot1.html")); - GetActiveTab()->NavigateToURL(test_url); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, + GetActiveTab()->NavigateToURL(test_url)); CloseActiveTab(); - active_browser()->GetTabCount(&tab_count); + ASSERT_TRUE(active_browser()->GetTabCount(&tab_count)); ASSERT_EQ(1, tab_count); RestoreTab(); - active_browser()->GetTabCount(&tab_count); + ASSERT_TRUE(active_browser()->GetTabCount(&tab_count)); ASSERT_EQ(2, tab_count); } @@ -111,22 +112,22 @@ TEST_F(AutomatedUITestBase, FLAKY_CloseTab) { NewTab(); ASSERT_TRUE(automation()->GetBrowserWindowCount(&num_browser_windows)); ASSERT_EQ(1, num_browser_windows); - active_browser()->GetTabCount(&tab_count); + ASSERT_TRUE(active_browser()->GetTabCount(&tab_count)); ASSERT_EQ(2, tab_count); ASSERT_TRUE(OpenAndActivateNewBrowserWindow(NULL)); NewTab(); NewTab(); - active_browser()->GetTabCount(&tab_count); + ASSERT_TRUE(active_browser()->GetTabCount(&tab_count)); ASSERT_EQ(3, tab_count); ASSERT_TRUE(automation()->GetBrowserWindowCount(&num_browser_windows)); ASSERT_EQ(2, num_browser_windows); ASSERT_TRUE(CloseActiveTab()); - active_browser()->GetTabCount(&tab_count); + ASSERT_TRUE(active_browser()->GetTabCount(&tab_count)); ASSERT_EQ(2, tab_count); ASSERT_TRUE(CloseActiveTab()); - active_browser()->GetTabCount(&tab_count); + ASSERT_TRUE(active_browser()->GetTabCount(&tab_count)); ASSERT_EQ(1, tab_count); num_browser_windows = 0; ASSERT_TRUE(automation()->GetBrowserWindowCount(&num_browser_windows)); @@ -137,15 +138,15 @@ TEST_F(AutomatedUITestBase, FLAKY_CloseTab) { ASSERT_TRUE(automation()->GetBrowserWindowCount(&num_browser_windows)); ASSERT_EQ(1, num_browser_windows); // Active_browser_ is now the first created window. - active_browser()->GetTabCount(&tab_count); + ASSERT_TRUE(active_browser()->GetTabCount(&tab_count)); ASSERT_EQ(2, tab_count); ASSERT_TRUE(CloseActiveTab()); - active_browser()->GetTabCount(&tab_count); + ASSERT_TRUE(active_browser()->GetTabCount(&tab_count)); ASSERT_EQ(1, tab_count); // The last tab should not be closed. ASSERT_FALSE(CloseActiveTab()); - active_browser()->GetTabCount(&tab_count); + ASSERT_TRUE(active_browser()->GetTabCount(&tab_count)); ASSERT_EQ(1, tab_count); } @@ -154,34 +155,34 @@ TEST_F(AutomatedUITestBase, OpenBrowserWindow) { int tab_count; ASSERT_TRUE(automation()->GetBrowserWindowCount(&num_browser_windows)); ASSERT_EQ(1, num_browser_windows); - active_browser()->GetTabCount(&tab_count); + ASSERT_TRUE(active_browser()->GetTabCount(&tab_count)); ASSERT_EQ(1, tab_count); scoped_refptr<BrowserProxy> browser_1; ASSERT_TRUE(OpenAndActivateNewBrowserWindow(&browser_1)); ASSERT_TRUE(automation()->GetBrowserWindowCount(&num_browser_windows)); ASSERT_EQ(2, num_browser_windows); - active_browser()->GetTabCount(&tab_count); + ASSERT_TRUE(active_browser()->GetTabCount(&tab_count)); ASSERT_EQ(1, tab_count); NewTab(); - browser_1->GetTabCount(&tab_count); + ASSERT_TRUE(browser_1->GetTabCount(&tab_count)); ASSERT_EQ(1, tab_count); - active_browser()->GetTabCount(&tab_count); + ASSERT_TRUE(active_browser()->GetTabCount(&tab_count)); ASSERT_EQ(2, tab_count); scoped_refptr<BrowserProxy> browser_2; ASSERT_TRUE(OpenAndActivateNewBrowserWindow(&browser_2)); ASSERT_TRUE(automation()->GetBrowserWindowCount(&num_browser_windows)); ASSERT_EQ(3, num_browser_windows); - active_browser()->GetTabCount(&tab_count); + ASSERT_TRUE(active_browser()->GetTabCount(&tab_count)); ASSERT_EQ(1, tab_count); NewTab(); NewTab(); - browser_1->GetTabCount(&tab_count); + ASSERT_TRUE(browser_1->GetTabCount(&tab_count)); ASSERT_EQ(1, tab_count); - browser_2->GetTabCount(&tab_count); + ASSERT_TRUE(browser_2->GetTabCount(&tab_count)); ASSERT_EQ(2, tab_count); - active_browser()->GetTabCount(&tab_count); + ASSERT_TRUE(active_browser()->GetTabCount(&tab_count)); ASSERT_EQ(3, tab_count); bool application_closed; @@ -199,33 +200,33 @@ TEST_F(AutomatedUITestBase, OpenBrowserWindow) { TEST_F(AutomatedUITestBase, FLAKY_CloseBrowserWindow) { int tab_count; NewTab(); - active_browser()->GetTabCount(&tab_count); + ASSERT_TRUE(active_browser()->GetTabCount(&tab_count)); ASSERT_EQ(2, tab_count); ASSERT_TRUE(OpenAndActivateNewBrowserWindow(NULL)); NewTab(); NewTab(); - active_browser()->GetTabCount(&tab_count); + ASSERT_TRUE(active_browser()->GetTabCount(&tab_count)); ASSERT_EQ(3, tab_count); ASSERT_TRUE(OpenAndActivateNewBrowserWindow(NULL)); NewTab(); NewTab(); NewTab(); - active_browser()->GetTabCount(&tab_count); + ASSERT_TRUE(active_browser()->GetTabCount(&tab_count)); ASSERT_EQ(4, tab_count); ASSERT_TRUE(CloseActiveWindow()); - active_browser()->GetTabCount(&tab_count); + ASSERT_TRUE(active_browser()->GetTabCount(&tab_count)); if (tab_count == 2) { ASSERT_TRUE(CloseActiveWindow()); - active_browser()->GetTabCount(&tab_count); + ASSERT_TRUE(active_browser()->GetTabCount(&tab_count)); ASSERT_EQ(3, tab_count); } else { ASSERT_EQ(3, tab_count); ASSERT_TRUE(CloseActiveWindow()); - active_browser()->GetTabCount(&tab_count); + ASSERT_TRUE(active_browser()->GetTabCount(&tab_count)); ASSERT_EQ(2, tab_count); } @@ -237,21 +238,24 @@ TEST_F(AutomatedUITestBase, MAYBE_IncognitoWindow) { int num_normal_browser_windows; ASSERT_TRUE(automation()->GetBrowserWindowCount(&num_browser_windows)); ASSERT_EQ(1, num_browser_windows); - automation()->GetNormalBrowserWindowCount(&num_normal_browser_windows); + ASSERT_TRUE( + automation()->GetNormalBrowserWindowCount(&num_normal_browser_windows)); ASSERT_EQ(1, num_normal_browser_windows); ASSERT_TRUE(GoOffTheRecord()); ASSERT_TRUE(GoOffTheRecord()); ASSERT_TRUE(automation()->GetBrowserWindowCount(&num_browser_windows)); ASSERT_EQ(3, num_browser_windows); - automation()->GetNormalBrowserWindowCount(&num_normal_browser_windows); + ASSERT_TRUE( + automation()->GetNormalBrowserWindowCount(&num_normal_browser_windows)); ASSERT_EQ(1, num_normal_browser_windows); // There is only one normal window so it will not be closed. ASSERT_FALSE(CloseActiveWindow()); ASSERT_TRUE(automation()->GetBrowserWindowCount(&num_browser_windows)); ASSERT_EQ(3, num_browser_windows); - automation()->GetNormalBrowserWindowCount(&num_normal_browser_windows); + ASSERT_TRUE( + automation()->GetNormalBrowserWindowCount(&num_normal_browser_windows)); ASSERT_EQ(1, num_normal_browser_windows); set_active_browser(automation()->GetBrowserWindow(0)); diff --git a/chrome/test/automated_ui_tests/automated_ui_tests.cc b/chrome/test/automated_ui_tests/automated_ui_tests.cc index f8b912e..9d9d0f0 100644 --- a/chrome/test/automated_ui_tests/automated_ui_tests.cc +++ b/chrome/test/automated_ui_tests/automated_ui_tests.cc @@ -594,8 +594,13 @@ bool AutomatedUITest::ForceCrash() { scoped_refptr<TabProxy> tab(GetActiveTab()); GURL test_url(chrome::kAboutCrashURL); bool did_timeout; - tab->NavigateToURLWithTimeout(test_url, 1, kDebuggingTimeoutMsec, - &did_timeout); + AutomationMsg_NavigationResponseValues result = + tab->NavigateToURLWithTimeout(test_url, 1, kDebuggingTimeoutMsec, + &did_timeout); + if (result != AUTOMATION_MSG_NAVIGATION_SUCCESS) { + AddErrorAttribute("navigation_failed"); + return false; + } if (!did_timeout) { AddInfoAttribute("expected_crash"); return false; diff --git a/chrome/test/automation/automation_proxy.h b/chrome/test/automation/automation_proxy.h index 281de66..35c6d6e 100644 --- a/chrome/test/automation/automation_proxy.h +++ b/chrome/test/automation/automation_proxy.h @@ -10,6 +10,7 @@ #include "app/message_box_flags.h" #include "app/gfx/native_widget_types.h" #include "base/basictypes.h" +#include "base/compiler_specific.h" #include "base/process_util.h" #include "base/scoped_ptr.h" #include "base/time.h" @@ -80,54 +81,57 @@ class AutomationProxy : public IPC::Channel::Listener, // Waits for any initial page loads to complete. // NOTE: this only fires once for a run of the application. // Returns true if the load is successful - bool WaitForInitialLoads(); + bool WaitForInitialLoads() WARN_UNUSED_RESULT; // Waits for the initial destinations tab to report that it has finished // querying. |load_time| is filled in with how long it took, in milliseconds. // NOTE: this only fires once for a run of the application. // Returns true if the load is successful. - bool WaitForInitialNewTabUILoad(int* load_time); + bool WaitForInitialNewTabUILoad(int* load_time) WARN_UNUSED_RESULT; // Open a new browser window of type |type|, returning true on success. |show| // identifies whether the window should be shown. Returns true on success. - bool OpenNewBrowserWindow(Browser::Type type, bool show); + bool OpenNewBrowserWindow(Browser::Type type, bool show) WARN_UNUSED_RESULT; // Fills the number of open browser windows into the given variable, returning // true on success. False likely indicates an IPC error. - bool GetBrowserWindowCount(int* num_windows); + bool GetBrowserWindowCount(int* num_windows) WARN_UNUSED_RESULT; // Block the thread until the window count becomes the provided value. // Returns true on success. - bool WaitForWindowCountToBecome(int target_count, int wait_timeout); + bool WaitForWindowCountToBecome(int target_count, + int wait_timeout) WARN_UNUSED_RESULT; // Fills the number of open normal browser windows (normal type and // non-incognito mode) into the given variable, returning true on success. // False likely indicates an IPC error. - bool GetNormalBrowserWindowCount(int* num_windows); + bool GetNormalBrowserWindowCount(int* num_windows) WARN_UNUSED_RESULT; // Gets the locale of the chrome browser, currently all browsers forked from // the main chrome share the same UI locale, returning true on success. // False likely indicates an IPC error. - bool GetBrowserLocale(string16* locale); + bool GetBrowserLocale(string16* locale) WARN_UNUSED_RESULT; // Returns whether an app modal dialog window is showing right now (i.e., a // javascript alert), and what buttons it contains. bool GetShowingAppModalDialog(bool* showing_app_modal_dialog, - MessageBoxFlags::DialogButton* button); + MessageBoxFlags::DialogButton* button) WARN_UNUSED_RESULT; // Simulates a click on a dialog button. - bool ClickAppModalDialogButton(MessageBoxFlags::DialogButton button); + bool ClickAppModalDialogButton( + MessageBoxFlags::DialogButton button) WARN_UNUSED_RESULT; // Block the thread until a modal dialog is displayed. Returns true on // success. - bool WaitForAppModalDialog(int wait_timeout); + bool WaitForAppModalDialog(int wait_timeout) WARN_UNUSED_RESULT; // Returns true if one of the tabs in any window displays given url. - bool IsURLDisplayed(GURL url); + bool IsURLDisplayed(GURL url) WARN_UNUSED_RESULT; // Get the duration of the last |event_name| in the browser. Returns // false if the IPC failed to send. - bool GetMetricEventDuration(const std::string& event_name, int* duration_ms); + bool GetMetricEventDuration(const std::string& event_name, + int* duration_ms) WARN_UNUSED_RESULT; // Returns the BrowserProxy for the browser window at the given index, // transferring ownership of the pointer to the caller. @@ -158,7 +162,7 @@ class AutomationProxy : public IPC::Channel::Listener, // Tells the browser to enable or disable network request filtering. Returns // false if the message fails to send to the browser. - bool SetFilteredInet(bool enabled); + bool SetFilteredInet(bool enabled) WARN_UNUSED_RESULT; // Returns the number of times a network request filter was used to service a // network request. Returns -1 on error. @@ -166,7 +170,7 @@ class AutomationProxy : public IPC::Channel::Listener, // Sends the browser a new proxy configuration to start using. Returns true // if the proxy config was successfully sent, false otherwise. - bool SendProxyConfig(const std::string& new_proxy_config); + bool SendProxyConfig(const std::string& new_proxy_config) WARN_UNUSED_RESULT; // These methods are intended to be called by the background thread // to signal that the given event has occurred, and that any corresponding @@ -179,12 +183,12 @@ class AutomationProxy : public IPC::Channel::Listener, // Set whether or not running the save page as... command show prompt the // user for a download path. Returns true if the message is successfully // sent. - bool SavePackageShouldPromptUser(bool should_prompt); + bool SavePackageShouldPromptUser(bool should_prompt) WARN_UNUSED_RESULT; // Installs the extension crx. Returns true only if extension was installed // and loaded successfully. // Note: Overinstalls will fail. - bool InstallExtension(const FilePath& crx_file); + bool InstallExtension(const FilePath& crx_file) WARN_UNUSED_RESULT; // Gets a list of all enabled extensions' base directories. // Returns true on success. @@ -194,7 +198,7 @@ class AutomationProxy : public IPC::Channel::Listener, // Logs in through the Chrome OS login wizard with given |username| // and |password|. Returns true on success. bool LoginWithUserAndPass(const std::string& username, - const std::string& password); + const std::string& password) WARN_UNUSED_RESULT; #endif // Returns the ID of the automation IPC channel, so that it can be // passed to the app as a launch parameter. @@ -205,9 +209,9 @@ class AutomationProxy : public IPC::Channel::Listener, #endif // AutomationMessageSender implementations. - virtual bool Send(IPC::Message* message); + virtual bool Send(IPC::Message* message) WARN_UNUSED_RESULT; virtual bool SendWithTimeout(IPC::Message* message, int timeout, - bool* is_timeout); + bool* is_timeout) WARN_UNUSED_RESULT; // Wrapper over AutomationHandleTracker::InvalidateHandle. Receives the // message from AutomationProxy, unpacks the messages and routes that call to diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc index 4c08fe2..0767ca7 100644 --- a/chrome/test/automation/automation_proxy_uitest.cc +++ b/chrome/test/automation/automation_proxy_uitest.cc @@ -281,7 +281,8 @@ TEST_F(AutomationProxyTest, NavigateToURL) { FilePath filename(test_data_directory_); filename = filename.AppendASCII("title2.html"); - tab->NavigateToURL(net::FilePathToFileURL(filename)); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, + tab->NavigateToURL(net::FilePathToFileURL(filename))); ASSERT_TRUE(tab->GetTabTitle(&title)); ASSERT_STREQ(L"Title Of Awesomeness", title.c_str()); @@ -298,8 +299,9 @@ TEST_F(AutomationProxyTest, NavigateToURLWithTimeout1) { filename = filename.AppendASCII("title2.html"); bool is_timeout; - tab->NavigateToURLWithTimeout(net::FilePathToFileURL(filename), - 1, 5000, &is_timeout); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, + tab->NavigateToURLWithTimeout(net::FilePathToFileURL(filename), + 1, 5000, &is_timeout)); ASSERT_FALSE(is_timeout); std::wstring title; @@ -309,9 +311,10 @@ TEST_F(AutomationProxyTest, NavigateToURLWithTimeout1) { // Use timeout high enough to allow the browser to create a url request job. const int kLowTimeoutMs = 250; ASSERT_GE(URLRequestSlowHTTPJob::kDelayMs, kLowTimeoutMs); - tab->NavigateToURLWithTimeout( - URLRequestSlowHTTPJob::GetMockUrl(filename), - 1, kLowTimeoutMs, &is_timeout); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_ERROR, + tab->NavigateToURLWithTimeout( + URLRequestSlowHTTPJob::GetMockUrl(filename), + 1, kLowTimeoutMs, &is_timeout)); ASSERT_TRUE(is_timeout); } @@ -329,15 +332,17 @@ TEST_F(AutomationProxyTest, NavigateToURLWithTimeout2) { // Use timeout high enough to allow the browser to create a url request job. const int kLowTimeoutMs = 250; ASSERT_GE(URLRequestSlowHTTPJob::kDelayMs, kLowTimeoutMs); - tab->NavigateToURLWithTimeout( - URLRequestSlowHTTPJob::GetMockUrl(filename1), - 1, kLowTimeoutMs, &is_timeout); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_ERROR, + tab->NavigateToURLWithTimeout( + URLRequestSlowHTTPJob::GetMockUrl(filename1), + 1, kLowTimeoutMs, &is_timeout)); ASSERT_TRUE(is_timeout); FilePath filename2(test_data_directory_); filename2 = filename2.AppendASCII("title1.html"); - tab->NavigateToURLWithTimeout(net::FilePathToFileURL(filename2), - 1, 5000, &is_timeout); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, + tab->NavigateToURLWithTimeout(net::FilePathToFileURL(filename2), + 1, 5000, &is_timeout)); ASSERT_FALSE(is_timeout); } @@ -1431,7 +1436,8 @@ TEST_F(AutomationProxyTest, DISABLED_AppModalDialogTest) { "data:text/html,<html><head><script>function onload() {" "setTimeout(\"alert('hello');\", 1000); }</script></head>" "<body onload='onload()'></body></html>"; - tab->NavigateToURL(GURL(content)); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, + tab->NavigateToURL(GURL(content))); EXPECT_TRUE(automation()->WaitForAppModalDialog(3000)); EXPECT_TRUE(automation()->GetShowingAppModalDialog(&modal_dialog_showing, &button)); @@ -1458,7 +1464,8 @@ TEST_F(AutomationProxyTest, DISABLED_AppModalDialogTest) { "data:text/html,<html><head><script>var result = -1; function onload() {" "setTimeout(\"result = confirm('hello') ? 0 : 1;\", 1000);} </script>" "</head><body onload='onload()'></body></html>"; - tab->NavigateToURL(GURL(content)); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, + tab->NavigateToURL(GURL(content))); EXPECT_TRUE(automation()->WaitForAppModalDialog(3000)); EXPECT_TRUE(automation()->GetShowingAppModalDialog(&modal_dialog_showing, &button)); @@ -1478,7 +1485,8 @@ TEST_F(AutomationProxyTest, DISABLED_AppModalDialogTest) { EXPECT_EQ(0, result); // Try again. - tab->NavigateToURL(GURL(content)); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, + tab->NavigateToURL(GURL(content))); EXPECT_TRUE(automation()->WaitForAppModalDialog(3000)); EXPECT_TRUE(automation()->GetShowingAppModalDialog(&modal_dialog_showing, &button)); @@ -1518,7 +1526,8 @@ TEST_F(AutomationProxyTest5, TestLifetimeOfDomAutomationController) { FilePath filename(test_data_directory_); filename = filename.AppendASCII("dom_automation_test_with_popup.html"); - tab->NavigateToURL(net::FilePathToFileURL(filename)); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, + tab->NavigateToURL(net::FilePathToFileURL(filename))); // Allow some time for the popup to show up and close. PlatformThread::Sleep(2000); diff --git a/chrome/test/automation/browser_proxy.h b/chrome/test/automation/browser_proxy.h index 04e6288..674cf83 100644 --- a/chrome/test/automation/browser_proxy.h +++ b/chrome/test/automation/browser_proxy.h @@ -13,6 +13,7 @@ #include <string> +#include "base/compiler_specific.h" #include "chrome/browser/browser.h" #include "chrome/common/content_settings.h" #include "chrome/test/automation/automation_handle_tracker.h" @@ -40,55 +41,56 @@ class BrowserProxy : public AutomationResourceProxy { // Activates the tab corresponding to (zero-based) tab_index. Returns true if // successful. - bool ActivateTab(int tab_index); + bool ActivateTab(int tab_index) WARN_UNUSED_RESULT; // Like ActivateTab, but returns false if response is not received before // the specified timeout. bool ActivateTabWithTimeout(int tab_index, uint32 timeout_ms, - bool* is_timeout); + bool* is_timeout) WARN_UNUSED_RESULT; // Bring the browser window to the front, activating it. Returns true on // success. - bool BringToFront(); + bool BringToFront() WARN_UNUSED_RESULT; // Like BringToFront, but returns false if action is not completed before // the specified timeout. - bool BringToFrontWithTimeout(uint32 timeout_ms, bool* is_timeout); + bool BringToFrontWithTimeout(uint32 timeout_ms, + bool* is_timeout) WARN_UNUSED_RESULT; // Checks to see if a navigation command is active or not. Can also // return false if action is not completed before the specified // timeout; is_timeout will be set in those cases. bool IsPageMenuCommandEnabledWithTimeout(int id, uint32 timeout_ms, - bool* is_timeout); + bool* is_timeout) WARN_UNUSED_RESULT; // Append a new tab to the TabStrip. The new tab is selected. // The new tab navigates to the given tab_url. // Returns true if successful. // TODO(mpcomplete): If the navigation results in an auth challenge, the // TabProxy we attach won't know about it. See bug 666730. - bool AppendTab(const GURL& tab_url); + bool AppendTab(const GURL& tab_url) WARN_UNUSED_RESULT; // Gets the (zero-based) index of the currently active tab. Returns true if // successful. - bool GetActiveTabIndex(int* active_tab_index) const; + bool GetActiveTabIndex(int* active_tab_index) const WARN_UNUSED_RESULT; // Like GetActiveTabIndex, but returns false if active tab is not received // before the specified timeout. bool GetActiveTabIndexWithTimeout(int* active_tab_index, uint32 timeout_ms, - bool* is_timeout) const; + bool* is_timeout) const WARN_UNUSED_RESULT; // Returns the number of tabs in the given window. Returns true if // the call was successful. - bool GetTabCount(int* num_tabs) const; + bool GetTabCount(int* num_tabs) const WARN_UNUSED_RESULT; // Like GetTabCount, but returns false if tab count is not received within the // before timeout. bool GetTabCountWithTimeout(int* num_tabs, uint32 timeout_ms, - bool* is_timeout) const; + bool* is_timeout) const WARN_UNUSED_RESULT; // Returns the type of the given window. Returns true if the call was // successful. - bool GetType(Browser::Type* type) const; + bool GetType(Browser::Type* type) const WARN_UNUSED_RESULT; // Returns the TabProxy for the tab at the given index, transferring // ownership of the pointer to the caller. On failure, returns NULL. @@ -127,7 +129,7 @@ class BrowserProxy : public AutomationResourceProxy { // focus. This leads to a flaky test behavior in circumstances when the // desktop screen is locked or the test is being executed over a remote // desktop. - bool ApplyAccelerator(int id); + bool ApplyAccelerator(int id) WARN_UNUSED_RESULT; // Performs a drag operation between the start and end points (both defined // in window coordinates). |flags| specifies which buttons are pressed for @@ -135,7 +137,7 @@ class BrowserProxy : public AutomationResourceProxy { virtual bool SimulateDrag(const gfx::Point& start, const gfx::Point& end, int flags, - bool press_escape_en_route); + bool press_escape_en_route) WARN_UNUSED_RESULT; // Like SimulateDrag, but returns false if response is not received before // the specified timeout. @@ -143,106 +145,113 @@ class BrowserProxy : public AutomationResourceProxy { const gfx::Point& end, int flags, uint32 timeout_ms, bool* is_timeout, - bool press_escape_en_route); + bool press_escape_en_route) + WARN_UNUSED_RESULT; // Block the thread until the tab count is |count|. // |wait_timeout| is the timeout, in milliseconds, for waiting. // Returns true on success. - bool WaitForTabCountToBecome(int count, int wait_timeout); + bool WaitForTabCountToBecome(int count, int wait_timeout) WARN_UNUSED_RESULT; // Block the thread until the specified tab is the active tab. // |wait_timeout| is the timeout, in milliseconds, for waiting. // Returns false if the tab does not become active. - bool WaitForTabToBecomeActive(int tab, int wait_timeout); + bool WaitForTabToBecomeActive(int tab, int wait_timeout) WARN_UNUSED_RESULT; // Opens the FindInPage box. Note: If you just want to search within a tab // you don't need to call this function, just use FindInPage(...) directly. - bool OpenFindInPage(); + bool OpenFindInPage() WARN_UNUSED_RESULT; // Get the x, y coordinates for the Find window. If animating, |x| and |y| // will be -1, -1. Returns false on failure. - bool GetFindWindowLocation(int* x, int* y); + bool GetFindWindowLocation(int* x, int* y) WARN_UNUSED_RESULT; // Returns whether the Find window is fully visible If animating, |is_visible| // will be false. Returns false on failure. - bool IsFindWindowFullyVisible(bool* is_visible); + bool IsFindWindowFullyVisible(bool* is_visible) WARN_UNUSED_RESULT; // Run the specified command in the browser (see browser_commands.cc for the // list of supported commands). Returns true if the command was successfully // dispatched, false otherwise. - bool RunCommandAsync(int browser_command) const; + bool RunCommandAsync(int browser_command) const WARN_UNUSED_RESULT; // Run the specified command in the browser (see browser_commands.cc for the // list of supported commands). Returns true if the command was successfully // dispatched and executed, false otherwise. - bool RunCommand(int browser_command) const; + bool RunCommand(int browser_command) const WARN_UNUSED_RESULT; // Returns whether the Bookmark bar is visible and whether we are animating // it into position. Returns false on failure. - bool GetBookmarkBarVisibility(bool* is_visible, bool* is_animating); + bool GetBookmarkBarVisibility(bool* is_visible, + bool* is_animating) WARN_UNUSED_RESULT; // Get the bookmarks as a JSON string and put it in |json_string|. // Return true on success. - bool GetBookmarksAsJSON(std::string* json_string); + bool GetBookmarksAsJSON(std::string* json_string) WARN_UNUSED_RESULT; // Wait for the bookmarks to load. Called implicitly by GetBookmarksAsJSON(). - bool WaitForBookmarkModelToLoad(); + bool WaitForBookmarkModelToLoad() WARN_UNUSED_RESULT; // Editing of the bookmark model. Bookmarks are referenced by id. // Bookmark or group (folder) creation: - bool AddBookmarkGroup(int64 parent_id, int index, std::wstring& title); + bool AddBookmarkGroup(int64 parent_id, int index, + std::wstring& title) WARN_UNUSED_RESULT; bool AddBookmarkURL(int64 parent_id, int index, - std::wstring& title, const GURL& url); + std::wstring& title, const GURL& url) WARN_UNUSED_RESULT; // Bookmark editing: - bool ReparentBookmark(int64 id, int64 new_parent_id, int index); - bool SetBookmarkTitle(int64 id, std::wstring& title); - bool SetBookmarkURL(int64 id, const GURL& url); + bool ReparentBookmark(int64 id, int64 new_parent_id, + int index) WARN_UNUSED_RESULT; + bool SetBookmarkTitle(int64 id, std::wstring& title) WARN_UNUSED_RESULT; + bool SetBookmarkURL(int64 id, const GURL& url) WARN_UNUSED_RESULT; // Finally, bookmark deletion: - bool RemoveBookmark(int64 id); + bool RemoveBookmark(int64 id) WARN_UNUSED_RESULT; // Fills |*is_visible| with whether the browser's download shelf is currently // visible. The return value indicates success. On failure, |*is_visible| is // unchanged. - bool IsShelfVisible(bool* is_visible); + bool IsShelfVisible(bool* is_visible) WARN_UNUSED_RESULT; // Shows or hides the download shelf. - bool SetShelfVisible(bool is_visible); + bool SetShelfVisible(bool is_visible) WARN_UNUSED_RESULT; // Sets the int value of the specified preference. - bool SetIntPreference(const std::wstring& name, int value); + bool SetIntPreference(const std::wstring& name, int value) WARN_UNUSED_RESULT; // Sets the string value of the specified preference. - bool SetStringPreference(const std::wstring& name, const std::wstring& value); + bool SetStringPreference(const std::wstring& name, + const std::wstring& value) WARN_UNUSED_RESULT; // Gets the boolean value of the specified preference. - bool GetBooleanPreference(const std::wstring& name, bool* value); + bool GetBooleanPreference(const std::wstring& name, + bool* value) WARN_UNUSED_RESULT; // Sets the boolean value of the specified preference. - bool SetBooleanPreference(const std::wstring& name, bool value); + bool SetBooleanPreference(const std::wstring& name, + bool value) WARN_UNUSED_RESULT; // Sets default content settings. bool SetDefaultContentSetting(ContentSettingsType content_type, - ContentSetting setting); + ContentSetting setting) WARN_UNUSED_RESULT; // Sets content settings for a particular host (overriding the default). bool SetContentSetting(const std::string& host, ContentSettingsType content_type, - ContentSetting setting); + ContentSetting setting) WARN_UNUSED_RESULT; // Simulates a termination the browser session (as if the user logged off the // mahine). - bool TerminateSession(); + bool TerminateSession() WARN_UNUSED_RESULT; // Sets |is_fullscreen| to whether the browser is currently in fullscreen // mode. - bool IsFullscreen(bool* is_fullscreen); + bool IsFullscreen(bool* is_fullscreen) WARN_UNUSED_RESULT; // Sets |is_visible| to whether the browser's fullscreen bubble is visible. - bool IsFullscreenBubbleVisible(bool* is_visible); + bool IsFullscreenBubbleVisible(bool* is_visible) WARN_UNUSED_RESULT; // Shuts down the session service for the browser's profile. Returns true // on success. - bool ShutdownSessionService(); + bool ShutdownSessionService() WARN_UNUSED_RESULT; protected: virtual ~BrowserProxy() {} diff --git a/chrome/test/automation/tab_proxy.h b/chrome/test/automation/tab_proxy.h index 326f0dc..8fe9318 100644 --- a/chrome/test/automation/tab_proxy.h +++ b/chrome/test/automation/tab_proxy.h @@ -14,6 +14,7 @@ #include <string> #include <vector> +#include "base/compiler_specific.h" #include "base/observer_list.h" #include "chrome/browser/download/save_package.h" #include "chrome/browser/tab_contents/navigation_entry.h" @@ -55,16 +56,16 @@ class TabProxy : public AutomationResourceProxy { : AutomationResourceProxy(tracker, sender, handle) {} // Gets the current url of the tab. - bool GetCurrentURL(GURL* url) const; + bool GetCurrentURL(GURL* url) const WARN_UNUSED_RESULT; // Gets the title of the tab. - bool GetTabTitle(std::wstring* title) const; + bool GetTabTitle(std::wstring* title) const WARN_UNUSED_RESULT; // Gets the tabstrip index of the tab. - bool GetTabIndex(int* index) const; + bool GetTabIndex(int* index) const WARN_UNUSED_RESULT; // Gets the number of constrained window for this tab. - bool GetConstrainedWindowCount(int* count) const; + bool GetConstrainedWindowCount(int* count) const WARN_UNUSED_RESULT; // Executes a javascript in a frame's context whose xpath is provided as the // first parameter and extract the values from the resulting json string. @@ -75,16 +76,16 @@ class TabProxy : public AutomationResourceProxy { // will result in value = 24 bool ExecuteAndExtractString(const std::wstring& frame_xpath, const std::wstring& jscript, - std::wstring* value); + std::wstring* value) WARN_UNUSED_RESULT; bool ExecuteAndExtractBool(const std::wstring& frame_xpath, const std::wstring& jscript, - bool* value); + bool* value) WARN_UNUSED_RESULT; bool ExecuteAndExtractInt(const std::wstring& frame_xpath, const std::wstring& jscript, - int* value); + int* value) WARN_UNUSED_RESULT; bool ExecuteAndExtractValue(const std::wstring& frame_xpath, const std::wstring& jscript, - Value** value); + Value** value) WARN_UNUSED_RESULT; // Configure extension automation mode. When extension automation // mode is turned on, the automation host can overtake extension API calls @@ -108,20 +109,20 @@ class TabProxy : public AutomationResourceProxy { // write tests where some functionality continues to function as normal, // and other functionality is mocked out by the test. bool SetEnableExtensionAutomation( - const std::vector<std::string>& functions_enabled); + const std::vector<std::string>& functions_enabled) WARN_UNUSED_RESULT; // Navigates to a url. This method accepts the same kinds of URL input that // can be passed to Chrome on the command line. This is a synchronous call and // hence blocks until the navigation completes. AutomationMsg_NavigationResponseValues NavigateToURL( - const GURL& url); + const GURL& url) WARN_UNUSED_RESULT; // Navigates to a url. This method accepts the same kinds of URL input that // can be passed to Chrome on the command line. This is a synchronous call and // hence blocks until the |number_of_navigations| navigations complete. AutomationMsg_NavigationResponseValues - NavigateToURLBlockUntilNavigationsComplete(const GURL& url, - int number_of_navigations); + NavigateToURLBlockUntilNavigationsComplete( + const GURL& url, int number_of_navigations) WARN_UNUSED_RESULT; // Navigates to a url. This is same as NavigateToURL with a timeout option. // The function blocks until the |number_of_navigations| navigations @@ -129,16 +130,17 @@ class TabProxy : public AutomationResourceProxy { // is_timeout is set to true. AutomationMsg_NavigationResponseValues NavigateToURLWithTimeout( const GURL& url, int number_of_navigations, uint32 timeout_ms, - bool* is_timeout); + bool* is_timeout) WARN_UNUSED_RESULT; // Navigates to a url in an externally hosted tab. // This method accepts the same kinds of URL input that // can be passed to Chrome on the command line. This is a synchronous call and // hence blocks until the navigation completes. AutomationMsg_NavigationResponseValues NavigateInExternalTab( - const GURL& url, const GURL& referrer); + const GURL& url, const GURL& referrer) WARN_UNUSED_RESULT; - AutomationMsg_NavigationResponseValues NavigateExternalTabAtIndex(int index); + AutomationMsg_NavigationResponseValues NavigateExternalTabAtIndex( + int index) WARN_UNUSED_RESULT; // Navigates to a url. This is an asynchronous version of NavigateToURL. // The function returns immediately after sending the LoadURL notification @@ -146,42 +148,43 @@ class TabProxy : public AutomationResourceProxy { // TODO(vibhor): Add a callback if needed in future. // TODO(mpcomplete): If the navigation results in an auth challenge, the // TabProxy we attach won't know about it. See bug 666730. - bool NavigateToURLAsync(const GURL& url); + bool NavigateToURLAsync(const GURL& url) WARN_UNUSED_RESULT; // Replaces a vector contents with the redirect chain out of the given URL. // Returns true on success. Failure may be due to being unable to send the // message, parse the response, or a failure of the history system in the // browser. - bool GetRedirectsFrom(const GURL& source_url, std::vector<GURL>* redirects); + bool GetRedirectsFrom(const GURL& source_url, + std::vector<GURL>* redirects) WARN_UNUSED_RESULT; // Equivalent to hitting the Back button. This is a synchronous call and // hence blocks until the navigation completes. - AutomationMsg_NavigationResponseValues GoBack(); + AutomationMsg_NavigationResponseValues GoBack() WARN_UNUSED_RESULT; // Equivalent to hitting the Back button. This is a synchronous call and // hence blocks until the |number_of_navigations| navigations complete. AutomationMsg_NavigationResponseValues GoBackBlockUntilNavigationsComplete( - int number_of_navigations); + int number_of_navigations) WARN_UNUSED_RESULT; // Equivalent to hitting the Forward button. This is a synchronous call and // hence blocks until the navigation completes. - AutomationMsg_NavigationResponseValues GoForward(); + AutomationMsg_NavigationResponseValues GoForward() WARN_UNUSED_RESULT; // Equivalent to hitting the Forward button. This is a synchronous call and // hence blocks until the |number_of_navigations| navigations complete. AutomationMsg_NavigationResponseValues GoForwardBlockUntilNavigationsComplete( - int number_of_navigations); + int number_of_navigations) WARN_UNUSED_RESULT; // Equivalent to hitting the Reload button. This is a synchronous call and // hence blocks until the navigation completes. - AutomationMsg_NavigationResponseValues Reload(); + AutomationMsg_NavigationResponseValues Reload() WARN_UNUSED_RESULT; // Closes the tab. This is synchronous, but does NOT block until the tab has // closed, rather it blocks until the browser has initiated the close. Use // Close(true) if you need to block until tab completely closes. // // Note that this proxy is invalid after this call. - bool Close(); + bool Close() WARN_UNUSED_RESULT; // Variant of close that allows you to specify whether you want to block // until the tab has completely closed (wait_until_closed == true) or block @@ -193,27 +196,28 @@ class TabProxy : public AutomationResourceProxy { // when closing the last tab it is possible for the browser to shutdown BEFORE // the tab has completely closed. In other words, this may NOT be sent for // the last tab. - bool Close(bool wait_until_closed); + bool Close(bool wait_until_closed) WARN_UNUSED_RESULT; #if defined(OS_WIN) // TODO(port): Use portable replacement for HWND. // Gets the HWND that corresponds to the content area of this tab. // Returns true if the call was successful. - bool GetHWND(HWND* hwnd) const; + bool GetHWND(HWND* hwnd) const WARN_UNUSED_RESULT; #endif // defined(OS_WIN) // Gets the process ID that corresponds to the content area of this tab. // Returns true if the call was successful. If the specified tab has no // separate process for rendering its content, the return value is true but // the process_id is 0. - bool GetProcessID(int* process_id) const; + bool GetProcessID(int* process_id) const WARN_UNUSED_RESULT; // Supply or cancel authentication to a login prompt. These are synchronous // calls and hence block until the load finishes (or another login prompt // appears, in the case of invalid login info). - bool SetAuth(const std::wstring& username, const std::wstring& password); - bool CancelAuth(); + bool SetAuth(const std::wstring& username, + const std::wstring& password) WARN_UNUSED_RESULT; + bool CancelAuth() WARN_UNUSED_RESULT; // Checks if this tab has a login prompt waiting for auth. This will be // true if a navigation results in a login prompt, and if an attempted login @@ -224,7 +228,7 @@ class TabProxy : public AutomationResourceProxy { // TODO(mpcomplete): we have no way of knowing if auth is needed after either // NavigateToURLAsync, or after appending a tab with an URL that triggers // auth. - bool NeedsAuth() const; + bool NeedsAuth() const WARN_UNUSED_RESULT; // Starts a search within the current tab. The parameter |search_string| // specifies what string to search for, |forward| specifies whether to search @@ -236,11 +240,11 @@ class TabProxy : public AutomationResourceProxy { int FindInPage(const std::wstring& search_string, FindInPageDirection forward, FindInPageCase match_case, bool find_next, int* ordinal); - bool GetCookies(const GURL& url, std::string* cookies); + bool GetCookies(const GURL& url, std::string* cookies) WARN_UNUSED_RESULT; bool GetCookieByName(const GURL& url, const std::string& name, - std::string* cookies); - bool SetCookie(const GURL& url, const std::string& value); + std::string* cookies) WARN_UNUSED_RESULT; + bool SetCookie(const GURL& url, const std::string& value) WARN_UNUSED_RESULT; // Sends a InspectElement message for the current tab. |x| and |y| are the // coordinates that we want to simulate that the user is trying to inspect. @@ -252,24 +256,26 @@ class TabProxy : public AutomationResourceProxy { // The third parameter specifies the timeout length for the wait loop. // Returns false if the count does not change. bool WaitForChildWindowCountToChange(int count, int* new_count, - int wait_timeout); + int wait_timeout) WARN_UNUSED_RESULT; // Gets the number of popups blocked from this tab. - bool GetBlockedPopupCount(int* count) const; + bool GetBlockedPopupCount(int* count) const WARN_UNUSED_RESULT; // Blocks the thread until the number of blocked popup is equal to // |target_count|. - bool WaitForBlockedPopupCountToChangeTo(int target_count, int wait_timeout); + bool WaitForBlockedPopupCountToChangeTo(int target_count, + int wait_timeout) WARN_UNUSED_RESULT; - bool GetDownloadDirectory(FilePath* download_directory); + bool GetDownloadDirectory(FilePath* download_directory) WARN_UNUSED_RESULT; // Shows an interstitial page. Blocks until the interstitial page // has been loaded. Return false if a failure happens.3 - bool ShowInterstitialPage(const std::string& html_text, int timeout_ms); + bool ShowInterstitialPage(const std::string& html_text, + int timeout_ms) WARN_UNUSED_RESULT; // Hides the currently shown interstitial page. Blocks until the interstitial // page has been hidden. Return false if a failure happens. - bool HideInterstitialPage(); + bool HideInterstitialPage() WARN_UNUSED_RESULT; #if defined(OS_WIN) // TODO(port): Use something portable. @@ -277,41 +283,41 @@ class TabProxy : public AutomationResourceProxy { // The container of an externally hosted tab calls this to reflect any // accelerator keys that it did not process. This gives the tab a chance // to handle the keys - bool ProcessUnhandledAccelerator(const MSG& msg); + bool ProcessUnhandledAccelerator(const MSG& msg) WARN_UNUSED_RESULT; #endif // defined(OS_WIN) // Ask the tab to set focus to either the first or last element on the page. - bool SetInitialFocus(bool reverse); + bool SetInitialFocus(bool reverse) WARN_UNUSED_RESULT; // Waits for the tab to finish being restored. Returns true on success. // timeout_ms gives the max amount of time to wait for restore to complete. - bool WaitForTabToBeRestored(uint32 timeout_ms); + bool WaitForTabToBeRestored(uint32 timeout_ms) WARN_UNUSED_RESULT; // Retrieves the different security states for the current tab. bool GetSecurityState(SecurityStyle* security_style, int* ssl_cert_status, - int* mixed_content_state); + int* mixed_content_state) WARN_UNUSED_RESULT; // Returns the type of the page currently showing (normal, interstitial, // error). - bool GetPageType(NavigationEntry::PageType* page_type); + bool GetPageType(NavigationEntry::PageType* page_type) WARN_UNUSED_RESULT; // Simulates the user action on the SSL blocking page. if |proceed| is true, // this is equivalent to clicking the 'Proceed' button, if false to 'Take me // out of there' button. - bool TakeActionOnSSLBlockingPage(bool proceed); + bool TakeActionOnSSLBlockingPage(bool proceed) WARN_UNUSED_RESULT; // Prints the current page without user intervention. - bool PrintNow(); + bool PrintNow() WARN_UNUSED_RESULT; // Sends off an asynchronous request for printing. - bool PrintAsync(); + bool PrintAsync() WARN_UNUSED_RESULT; // Save the current web page. |file_name| is the HTML file name, and // |dir_path| is the directory for saving resource files. |type| indicates // which type we're saving as: HTML only or the complete web page. bool SavePage(const FilePath& file_name, const FilePath& dir_path, - SavePackage::SavePackageType type); + SavePackage::SavePackageType type) WARN_UNUSED_RESULT; // Posts a message to the external tab. void HandleMessageFromExternalHost(const std::string& message, @@ -319,21 +325,22 @@ class TabProxy : public AutomationResourceProxy { const std::string& target); // Retrieves the number of info-bars currently showing in |count|. - bool GetInfoBarCount(int* count); + bool GetInfoBarCount(int* count) WARN_UNUSED_RESULT; // Waits for up to |wait_timeout| ms until the infobar count is |count|. // Returns false if a timeout occurred before the count matched, or an // error occurred retrieving the count. - bool WaitForInfoBarCount(int count, int wait_timeout); + bool WaitForInfoBarCount(int count, int wait_timeout) WARN_UNUSED_RESULT; // Causes a click on the "accept" button of the info-bar at |info_bar_index|. // If |wait_for_navigation| is true, this call does not return until a // navigation has occured. - bool ClickInfoBarAccept(int info_bar_index, bool wait_for_navigation); + bool ClickInfoBarAccept(int info_bar_index, + bool wait_for_navigation) WARN_UNUSED_RESULT; // Retrieves the time at which the last navigation occured. This is intended // to be used with WaitForNavigation (see below). - bool GetLastNavigationTime(int64* last_navigation_time); + bool GetLastNavigationTime(int64* last_navigation_time) WARN_UNUSED_RESULT; // Waits for a new navigation if none as occurred since |last_navigation_time| // The purpose of this function is for operations that causes asynchronous @@ -343,13 +350,13 @@ class TabProxy : public AutomationResourceProxy { // tab_proxy->GetLastNavigationTime(&last_nav_time); // tab_proxy->SomeOperationThatTriggersAnAsynchronousNavigation(); // tab_proxy->WaitForNavigation(last_nav_time); - bool WaitForNavigation(int64 last_navigation_time); + bool WaitForNavigation(int64 last_navigation_time) WARN_UNUSED_RESULT; // Gets the current used encoding of the page in the tab. - bool GetPageCurrentEncoding(std::string* encoding); + bool GetPageCurrentEncoding(std::string* encoding) WARN_UNUSED_RESULT; // Uses the specified encoding to override encoding of the page in the tab. - bool OverrideEncoding(const std::string& encoding); + bool OverrideEncoding(const std::string& encoding) WARN_UNUSED_RESULT; #if defined(OS_WIN) // Resizes the tab window. diff --git a/chrome/test/memory_test/memory_test.cc b/chrome/test/memory_test/memory_test.cc index 9c22c1b..1d5a3cd 100644 --- a/chrome/test/memory_test/memory_test.cc +++ b/chrome/test/memory_test/memory_test.cc @@ -143,6 +143,8 @@ class MemoryTest : public UITest { int expected_tab_count = 1; for (unsigned counter = 0; counter < urls_length; ++counter) { std::string url = urls[counter]; + + SCOPED_TRACE(url); if (url == "<PAUSE>") { // Special command to delay on this page PlatformThread::Sleep(2000); @@ -169,8 +171,8 @@ class MemoryTest : public UITest { if (url == "<NEXTTAB>") { // Special command to select the next tab. int tab_index, tab_count; - window->GetActiveTabIndex(&tab_index); - window->GetTabCount(&tab_count); + EXPECT_TRUE(window->GetActiveTabIndex(&tab_index)); + EXPECT_TRUE(window->GetTabCount(&tab_count)); tab_index = (tab_index + 1) % tab_count; tab = window->GetTab(tab_index); EXPECT_NE(tab, static_cast<TabProxy*>(NULL)); @@ -186,7 +188,8 @@ class MemoryTest : public UITest { EXPECT_TRUE(automation()->OpenNewBrowserWindow(Browser::TYPE_NORMAL, show_window_)); int expected_window_count = window_count + 1; - automation()->WaitForWindowCountToBecome(expected_window_count, 500); + EXPECT_TRUE(automation()->WaitForWindowCountToBecome( + expected_window_count, 500)); EXPECT_TRUE(automation()->GetBrowserWindowCount(&window_count)); EXPECT_EQ(expected_window_count, window_count); @@ -213,10 +216,10 @@ class MemoryTest : public UITest { const int kMaxWaitTime = 5000; bool timed_out = false; - tab->NavigateToURLWithTimeout(GURL(urls[counter]), 1, kMaxWaitTime, - &timed_out); - if (timed_out) - printf("warning: %s timed out!\n", urls[counter].c_str()); + EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, + tab->NavigateToURLWithTimeout(GURL(urls[counter]), 1, kMaxWaitTime, + &timed_out)); + EXPECT_FALSE(timed_out); // TODO(mbelshe): Bug 2953 // The automation crashes periodically if we cycle too quickly. diff --git a/chrome/test/page_cycler/page_cycler_test.cc b/chrome/test/page_cycler/page_cycler_test.cc index 6750b08..5c64bb7 100644 --- a/chrome/test/page_cycler/page_cycler_test.cc +++ b/chrome/test/page_cycler/page_cycler_test.cc @@ -221,7 +221,7 @@ class PageCyclerTest : public UITest { scoped_refptr<TabProxy> tab(GetActiveTab()); ASSERT_TRUE(tab.get()); - tab->NavigateToURL(test_url); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(test_url)); // Wait for the test to finish. ASSERT_TRUE(WaitUntilCookieValue(tab.get(), test_url, "__pc_done", diff --git a/chrome/test/reliability/page_load_test.cc b/chrome/test/reliability/page_load_test.cc index 5702308..bac5fa1 100644 --- a/chrome/test/reliability/page_load_test.cc +++ b/chrome/test/reliability/page_load_test.cc @@ -206,9 +206,10 @@ class PageLoadTest : public UITest { scoped_refptr<WindowProxy> window(browser->GetWindow()); if (window.get()) { bool activation_timeout; - browser->BringToFrontWithTimeout(action_max_timeout_ms(), - &activation_timeout); - if (!activation_timeout) { + bool success = + browser->BringToFrontWithTimeout(action_max_timeout_ms(), + &activation_timeout); + if (success && !activation_timeout) { window->SimulateOSKeyPress(base::VKEY_NEXT, 0); PlatformThread::Sleep(sleep_timeout_ms()); window->SimulateOSKeyPress(base::VKEY_NEXT, 0); @@ -401,8 +402,10 @@ class PageLoadTest : public UITest { { // TabProxy should be released before Browser is closed. scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); + EXPECT_TRUE(tab_proxy.get()); if (tab_proxy.get()) { - tab_proxy->NavigateToURL(GURL(test_url_1)); + EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, + tab_proxy->NavigateToURL(GURL(test_url_1))); } } // Kill browser process. diff --git a/chrome/test/startup/feature_startup_test.cc b/chrome/test/startup/feature_startup_test.cc index 31f1b1f..df68386 100644 --- a/chrome/test/startup/feature_startup_test.cc +++ b/chrome/test/startup/feature_startup_test.cc @@ -80,7 +80,7 @@ class NewTabUIStartupTest : public UITest { ASSERT_EQ(1, tab_count); // Hit ctl-t and wait for the tab to load. - window->RunCommand(IDC_NEW_TAB); + ASSERT_TRUE(window->RunCommand(IDC_NEW_TAB)); ASSERT_TRUE(window->GetTabCount(&tab_count)); ASSERT_EQ(2, tab_count); int load_time; @@ -88,7 +88,7 @@ class NewTabUIStartupTest : public UITest { if (want_warm) { // Bring up a second tab, now that we've already shown one tab. - window->RunCommand(IDC_NEW_TAB); + ASSERT_TRUE(window->RunCommand(IDC_NEW_TAB)); ASSERT_TRUE(window->GetTabCount(&tab_count)); ASSERT_EQ(3, tab_count); ASSERT_TRUE(automation()->WaitForInitialNewTabUILoad(&load_time)); @@ -130,7 +130,7 @@ class NewTabUIStartupTest : public UITest { ASSERT_EQ(1, tab_count); // Hit ctl-t and wait for the tab to load. - window->RunCommand(IDC_NEW_TAB); + ASSERT_TRUE(window->RunCommand(IDC_NEW_TAB)); ASSERT_TRUE(window->GetTabCount(&tab_count)); ASSERT_EQ(2, tab_count); int duration; diff --git a/chrome/test/tab_switching/tab_switching_test.cc b/chrome/test/tab_switching/tab_switching_test.cc index 3c6c312..4247614 100644 --- a/chrome/test/tab_switching/tab_switching_test.cc +++ b/chrome/test/tab_switching/tab_switching_test.cc @@ -87,11 +87,11 @@ class TabSwitchingUITest : public UITest { initial_tab_count + new_tab_count, 10000)); // Switch linearly between tabs. - browser_proxy_->ActivateTab(0); + ASSERT_TRUE(browser_proxy_->ActivateTab(0)); int final_tab_count = 0; ASSERT_TRUE(browser_proxy_->GetTabCount(&final_tab_count)); for (int j = initial_tab_count; j < final_tab_count; ++j) { - browser_proxy_->ActivateTab(j); + ASSERT_TRUE(browser_proxy_->ActivateTab(j)); ASSERT_TRUE(browser_proxy_->WaitForTabToBecomeActive(j, 10000)); } @@ -155,8 +155,11 @@ class TabSwitchingUITest : public UITest { file_name = path_prefix_; file_name = file_name.AppendASCII(files[i]); file_name = file_name.AppendASCII("index.html"); - browser_proxy_->AppendTab(net::FilePathToFileURL(file_name)); - number_of_new_tabs_opened++; + bool success = + browser_proxy_->AppendTab(net::FilePathToFileURL(file_name)); + EXPECT_TRUE(success); + if (success) + number_of_new_tabs_opened++; } return number_of_new_tabs_opened; diff --git a/chrome/test/ui/dom_checker_uitest.cc b/chrome/test/ui/dom_checker_uitest.cc index e9a4996..db28e07 100644 --- a/chrome/test/ui/dom_checker_uitest.cc +++ b/chrome/test/ui/dom_checker_uitest.cc @@ -201,7 +201,7 @@ class DomCheckerTest : public UITest { scoped_refptr<TabProxy> tab(GetActiveTab()); ASSERT_TRUE(tab.get()); - tab->NavigateToURL(test_url); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(test_url)); // Wait for the test to finish. ASSERT_TRUE(WaitUntilTestCompletes(tab.get())); diff --git a/chrome/test/ui/dromaeo_benchmark_uitest.cc b/chrome/test/ui/dromaeo_benchmark_uitest.cc index a5599e8..9e5dcc3 100644 --- a/chrome/test/ui/dromaeo_benchmark_uitest.cc +++ b/chrome/test/ui/dromaeo_benchmark_uitest.cc @@ -39,7 +39,7 @@ class DromaeoTest : public UITest { GURL test_url(net::FilePathToFileURL(test_path)); scoped_refptr<TabProxy> tab(GetActiveTab()); - tab->NavigateToURL(test_url); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(test_url)); // Wait for the test to finish. ASSERT_TRUE(WaitUntilTestCompletes(tab.get(), test_url)); diff --git a/chrome/test/ui/fast_shutdown_uitest.cc b/chrome/test/ui/fast_shutdown_uitest.cc index fd4159e..d7663f8 100644 --- a/chrome/test/ui/fast_shutdown_uitest.cc +++ b/chrome/test/ui/fast_shutdown_uitest.cc @@ -42,5 +42,6 @@ TEST_F(FastShutdown, DISABLED_SlowTermination) { // alert(). ASSERT_TRUE(browser->ApplyAccelerator(IDC_CLOSE_WINDOW)); ASSERT_TRUE(automation()->WaitForAppModalDialog(action_max_timeout_ms())); - automation()->ClickAppModalDialogButton(MessageBoxFlags::DIALOGBUTTON_OK); + ASSERT_TRUE(automation()->ClickAppModalDialogButton( + MessageBoxFlags::DIALOGBUTTON_OK)); } diff --git a/chrome/test/ui/mouseleave_uitest.cc b/chrome/test/ui/mouseleave_uitest.cc index 937cd5a..311b27a 100644 --- a/chrome/test/ui/mouseleave_uitest.cc +++ b/chrome/test/ui/mouseleave_uitest.cc @@ -66,7 +66,7 @@ TEST_F(MouseLeaveTest, MAYBE_TestOnMouseOut) { ASSERT_TRUE(window->SimulateOSMouseMove(above_content_point)); // Navigate to the test html page. - tab->NavigateToURL(test_url); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(test_url)); const int timeout_ms = 5 * action_max_timeout_ms(); const int check_interval_ms = action_max_timeout_ms() / 10; diff --git a/chrome/test/ui/npapi_uitest.cc b/chrome/test/ui/npapi_uitest.cc index 1d56c69..329c204 100644 --- a/chrome/test/ui/npapi_uitest.cc +++ b/chrome/test/ui/npapi_uitest.cc @@ -128,7 +128,7 @@ TEST_F(NPAPITester, DISABLED_SelfDeletePluginInvokeAlert) { ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); // Wait for the alert dialog and then close it. - automation()->WaitForAppModalDialog(5000); + ASSERT_TRUE(automation()->WaitForAppModalDialog(5000)); scoped_refptr<WindowProxy> window(automation()->GetActiveWindow()); ASSERT_TRUE(window.get()); ASSERT_TRUE(window->SimulateOSKeyPress(base::VKEY_ESCAPE, 0)); @@ -370,10 +370,12 @@ TEST_F(NPAPITester, NPObjectReleasedOnDestruction) { ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); scoped_refptr<BrowserProxy> window_proxy(automation()->GetBrowserWindow(0)); - window_proxy->AppendTab(GURL(chrome::kAboutBlankURL)); + ASSERT_TRUE(window_proxy); + ASSERT_TRUE(window_proxy->AppendTab(GURL(chrome::kAboutBlankURL))); scoped_refptr<TabProxy> tab_proxy(window_proxy->GetTab(0)); - tab_proxy->Close(true); + ASSERT_TRUE(tab_proxy.get()); + ASSERT_TRUE(tab_proxy->Close(true)); } // Test that a dialog is properly created when a plugin throws an @@ -420,7 +422,7 @@ TEST_F(NPAPIVisiblePluginTester, FLAKY_PluginConvertPointTest) { // TODO(stuartmorgan): When the automation system supports sending clicks, // change the test to trigger on mouse-down rather than window focus. - browser->BringToFront(); + ASSERT_TRUE(browser->BringToFront()); WaitForFinish("convert_point", "1", url, kTestCompleteCookie, kTestCompleteSuccess, kShortWaitTimeout); } diff --git a/chrome/test/ui/sunspider_uitest.cc b/chrome/test/ui/sunspider_uitest.cc index a3c20db..2322f34 100644 --- a/chrome/test/ui/sunspider_uitest.cc +++ b/chrome/test/ui/sunspider_uitest.cc @@ -40,7 +40,7 @@ class SunSpiderTest : public UITest { scoped_refptr<TabProxy> tab(GetActiveTab()); ASSERT_TRUE(tab.get()); - tab->NavigateToURL(test_url); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(test_url)); // Wait for the test to finish. ASSERT_TRUE(WaitUntilTestCompletes(tab.get(), test_url)); diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc index e88a729..48a2059 100644 --- a/chrome/test/ui/ui_test.cc +++ b/chrome/test/ui/ui_test.cc @@ -248,7 +248,7 @@ void UITestBase::LaunchBrowserAndServer() { else PlatformThread::Sleep(sleep_timeout_ms()); - automation()->SetFilteredInet(ShouldFilterInet()); + EXPECT_TRUE(automation()->SetFilteredInet(ShouldFilterInet())); } void UITestBase::CloseBrowserAndServer() { @@ -409,7 +409,7 @@ bool UITestBase::LaunchAnotherBrowserBlockUntilClosed( void UITestBase::QuitBrowser() { // There's nothing to do here if the browser is not running. if (IsBrowserRunning()) { - automation()->SetFilteredInet(false); + EXPECT_TRUE(automation()->SetFilteredInet(false)); int window_count = 0; EXPECT_TRUE(automation()->GetBrowserWindowCount(&window_count)); @@ -435,7 +435,7 @@ void UITestBase::QuitBrowser() { automation()->GetBrowserWindow(0); EXPECT_TRUE(browser_proxy.get()); if (browser_proxy.get()) { - browser_proxy->ApplyAccelerator(IDC_CLOSE_WINDOW); + EXPECT_TRUE(browser_proxy->ApplyAccelerator(IDC_CLOSE_WINDOW)); browser_proxy = NULL; } @@ -519,7 +519,7 @@ scoped_refptr<TabProxy> UITestBase::GetActiveTab() { void UITestBase::NavigateToURLAsync(const GURL& url) { scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); ASSERT_TRUE(tab_proxy.get()); - tab_proxy->NavigateToURLAsync(url); + ASSERT_TRUE(tab_proxy->NavigateToURLAsync(url)); } void UITestBase::NavigateToURL(const GURL& url) { @@ -536,9 +536,10 @@ void UITestBase::NavigateToURLBlockUntilNavigationsComplete( scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); ASSERT_TRUE(tab_proxy.get()); bool is_timeout = true; - ASSERT_TRUE(tab_proxy->NavigateToURLWithTimeout( - url, number_of_navigations, command_execution_timeout_ms(), - &is_timeout)) << url.spec(); + EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, + tab_proxy->NavigateToURLWithTimeout( + url, number_of_navigations, command_execution_timeout_ms(), + &is_timeout)) << url.spec(); ASSERT_FALSE(is_timeout) << url.spec(); } @@ -551,9 +552,10 @@ void UITestBase::NavigateToURLBlockUntilNavigationsComplete( scoped_refptr<TabProxy> tab_proxy(window->GetTab(tab_index)); ASSERT_TRUE(tab_proxy.get()); bool is_timeout = true; - ASSERT_TRUE(tab_proxy->NavigateToURLWithTimeout( - url, number_of_navigations, command_execution_timeout_ms(), - &is_timeout)) << url.spec(); + EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, + tab_proxy->NavigateToURLWithTimeout( + url, number_of_navigations, command_execution_timeout_ms(), + &is_timeout)) << url.spec(); ASSERT_FALSE(is_timeout) << url.spec(); } @@ -718,7 +720,7 @@ bool UITestBase::WaitUntilCookieValue(TabProxy* tab, for (int i = 0; i < kMaxIntervals; ++i) { bool browser_survived = CrashAwareSleep(interval_ms); - tab->GetCookieByName(url, cookie_name, &cookie_value); + EXPECT_TRUE(tab->GetCookieByName(url, cookie_name, &cookie_value)); if (cookie_value == expected_value) { completed = true; @@ -744,7 +746,7 @@ std::string UITestBase::WaitUntilCookieNonEmpty(TabProxy* tab, for (int i = 0; i < kMaxIntervals; ++i) { bool browser_survived = CrashAwareSleep(interval_ms); - tab->GetCookieByName(url, cookie_name, &cookie_value); + EXPECT_TRUE(tab->GetCookieByName(url, cookie_name, &cookie_value)); if (!cookie_value.empty()) break; @@ -810,8 +812,8 @@ FilePath UITestBase::GetDownloadDirectory() { } void UITestBase::CloseBrowserAsync(BrowserProxy* browser) const { - server_->Send( - new AutomationMsg_CloseBrowserRequestAsync(0, browser->handle())); + ASSERT_TRUE(server_->Send( + new AutomationMsg_CloseBrowserRequestAsync(0, browser->handle()))); } bool UITestBase::CloseBrowser(BrowserProxy* browser, diff --git a/chrome/test/ui/v8_benchmark_uitest.cc b/chrome/test/ui/v8_benchmark_uitest.cc index 4a248f7..e52c330 100644 --- a/chrome/test/ui/v8_benchmark_uitest.cc +++ b/chrome/test/ui/v8_benchmark_uitest.cc @@ -40,7 +40,7 @@ class V8BenchmarkTest : public UITest { GURL test_url(net::FilePathToFileURL(test_path)); scoped_refptr<TabProxy> tab(GetActiveTab()); - tab->NavigateToURL(test_url); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(test_url)); // Wait for the test to finish. ASSERT_TRUE(WaitUntilTestCompletes(tab.get(), test_url)); diff --git a/chrome/test/url_fetch_test/url_fetch_test.cc b/chrome/test/url_fetch_test/url_fetch_test.cc index ed70f20..9b757fd 100644 --- a/chrome/test/url_fetch_test/url_fetch_test.cc +++ b/chrome/test/url_fetch_test/url_fetch_test.cc @@ -47,7 +47,7 @@ class UrlFetchTest : public UITest { const char *waitCookieValue, const wchar_t *varToFetch, UrlFetchTestResult *result) { scoped_refptr<TabProxy> tab(GetActiveTab()); - tab->NavigateToURL(url); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(url)); if (waitCookieName) { if (waitCookieValue) { diff --git a/chrome/worker/worker_uitest.cc b/chrome/worker/worker_uitest.cc index 1eedc25..56bf93a 100644 --- a/chrome/worker/worker_uitest.cc +++ b/chrome/worker/worker_uitest.cc @@ -106,7 +106,8 @@ class WorkerTest : public UILayoutTest { // Pass a large number of navigations to tell the tab to block until an auth // dialog pops up. bool timeout = false; - tab->NavigateToURLWithTimeout(url, 100, kTestWaitTimeoutMs, &timeout); + EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, + tab->NavigateToURLWithTimeout(url, 100, kTestWaitTimeoutMs, &timeout)); EXPECT_FALSE(timeout); return tab->NeedsAuth(); } @@ -483,14 +484,16 @@ TEST_F(WorkerTest, DISABLED_LimitTotal) { ASSERT_TRUE(tab.get()); ASSERT_TRUE(tab->NavigateToURL(url)); scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); + ASSERT_TRUE(window.get()); for (int i = 1; i < tab_count; ++i) - window->AppendTab(url); + ASSERT_TRUE(window->AppendTab(url)); // Check that we didn't create more than the max number of workers. ASSERT_TRUE(WaitForProcessCountToBe(tab_count, total_workers)); // Now close a page and check that the queued workers were started. - tab->NavigateToURL(GetTestUrl(L"google", L"google.html")); + ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, + tab->NavigateToURL(GetTestUrl(L"google", L"google.html"))); ASSERT_TRUE(WaitForProcessCountToBe(tab_count, total_workers)); #endif @@ -571,7 +574,7 @@ TEST_F(WorkerTest, DISABLED_QueuedSharedWorkerStartedFromOtherTab) { scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); GURL url2 = GetTestUrl(L"workers", L"single_shared_worker.html"); url2 = GURL(url2.spec() + StringPrintf("?id=%d", max_workers_per_tab)); - window->AppendTab(url2); + ASSERT_TRUE(window->AppendTab(url2)); std::string value = WaitUntilCookieNonEmpty(tab.get(), url, kTestCompleteCookie, kTestIntervalMs, kTestWaitTimeoutMs); |