diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-16 08:39:54 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-16 08:39:54 +0000 |
commit | 6fd3535a1593f4c73c938c7aa7e35eb976ccf280 (patch) | |
tree | 9a67ff8878ad611c4a35e728a613c451bb25008f /chrome/test/automation/automation_proxy_uitest.cc | |
parent | b22b5167bd0a7494a78195d04b5a77ff185de5ae (diff) | |
download | chromium_src-6fd3535a1593f4c73c938c7aa7e35eb976ccf280.zip chromium_src-6fd3535a1593f4c73c938c7aa7e35eb976ccf280.tar.gz chromium_src-6fd3535a1593f4c73c938c7aa7e35eb976ccf280.tar.bz2 |
[GTTF] Make automation framework more solid by making sure that
important return values are not ignored.
The macro used here, WARN_UNUSED_RESULT, takes effect only for GCC,
but that's enough since we have bots for all platforms.
Adding these warnings already detected some cases where a return value
was ignored. In some of them the test was trying to get the information
about success "some other way", in some it could sometimes confuse test
failure with test success.
TEST=ui_tests
BUG=none
Review URL: http://codereview.chromium.org/948002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41696 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/automation/automation_proxy_uitest.cc')
-rw-r--r-- | chrome/test/automation/automation_proxy_uitest.cc | 39 |
1 files changed, 24 insertions, 15 deletions
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); |