diff options
-rw-r--r-- | chrome/browser/browser_uitest.cc | 6 | ||||
-rw-r--r-- | chrome/browser/dom_ui/bookmarks_ui_uitest.cc | 11 | ||||
-rw-r--r-- | chrome/browser/dom_ui/new_tab_ui_uitest.cc | 17 | ||||
-rw-r--r-- | chrome/browser/download/download_uitest.cc | 38 | ||||
-rw-r--r-- | chrome/browser/extensions/browser_action_apitest.cc | 2 | ||||
-rw-r--r-- | chrome/browser/extensions/extension_uitest.cc | 2 | ||||
-rw-r--r-- | chrome/test/automation/automation_proxy_uitest.cc | 18 | ||||
-rw-r--r-- | chrome/test/interactive_ui/keyboard_access_uitest.cc | 2 | ||||
-rw-r--r-- | chrome/test/interactive_ui/npapi_interactive_test.cc | 5 | ||||
-rw-r--r-- | chrome/test/nacl/nacl_test.cc | 19 | ||||
-rw-r--r-- | chrome/test/nacl/nacl_test.h | 3 | ||||
-rw-r--r-- | chrome/test/plugin/plugin_test.cpp | 40 | ||||
-rw-r--r-- | chrome/test/ui/npapi_test_helper.h | 2 | ||||
-rw-r--r-- | chrome/test/ui/npapi_uitest.cc | 62 | ||||
-rw-r--r-- | chrome/test/ui/pepper_uitest.cc | 4 | ||||
-rw-r--r-- | chrome/test/ui/ui_test.cc | 6 |
16 files changed, 90 insertions, 147 deletions
diff --git a/chrome/browser/browser_uitest.cc b/chrome/browser/browser_uitest.cc index 64634a0..08a6a9c4 100644 --- a/chrome/browser/browser_uitest.cc +++ b/chrome/browser/browser_uitest.cc @@ -111,7 +111,7 @@ TEST_F(BrowserTest, NullOpenerRedirectForksProcess) { // Make sure that a new tab has been created and that we have a new renderer // process for it. ASSERT_TRUE(tab->NavigateToURLAsync(fork_url)); - PlatformThread::Sleep(action_timeout_ms()); + PlatformThread::Sleep(sleep_timeout_ms()); ASSERT_EQ(orig_process_count + 1, GetBrowserProcessCount()); int new_tab_count = -1; ASSERT_TRUE(window->GetTabCount(&new_tab_count)); @@ -162,7 +162,7 @@ TEST_F(BrowserTest, MAYBE_OtherRedirectsDontForkProcess) { // Make sure that a new tab but not new process has been created. ASSERT_TRUE(tab->NavigateToURLAsync(dont_fork_url)); - PlatformThread::Sleep(action_timeout_ms()); + PlatformThread::Sleep(sleep_timeout_ms()); ASSERT_EQ(orig_process_count, GetBrowserProcessCount()); int new_tab_count = -1; ASSERT_TRUE(window->GetTabCount(&new_tab_count)); @@ -174,7 +174,7 @@ TEST_F(BrowserTest, MAYBE_OtherRedirectsDontForkProcess) { // Make sure that no new process has been created. ASSERT_TRUE(tab->NavigateToURLAsync(dont_fork_url2)); - PlatformThread::Sleep(action_timeout_ms()); + PlatformThread::Sleep(sleep_timeout_ms()); ASSERT_EQ(orig_process_count, GetBrowserProcessCount()); } diff --git a/chrome/browser/dom_ui/bookmarks_ui_uitest.cc b/chrome/browser/dom_ui/bookmarks_ui_uitest.cc index 77f7f38..3e3ac33 100644 --- a/chrome/browser/dom_ui/bookmarks_ui_uitest.cc +++ b/chrome/browser/dom_ui/bookmarks_ui_uitest.cc @@ -21,7 +21,7 @@ class BookmarksUITest : public UITest { L"domAutomationController.send(" L" location.protocol == 'chrome-extension:' && " L" document.readyState == 'complete')", - UITest::test_timeout_ms()); + test_timeout_ms()); } scoped_refptr<TabProxy> GetBookmarksUITab() { @@ -110,8 +110,7 @@ TEST_F(BookmarksUITest, CommandAgainGoesBackToBookmarksTab) { // Bring up the bookmarks manager tab. ASSERT_TRUE(browser->RunCommand(IDC_SHOW_BOOKMARK_MANAGER)); - ASSERT_TRUE(browser->WaitForTabToBecomeActive(1, - UITest::action_max_timeout_ms())); + ASSERT_TRUE(browser->WaitForTabToBecomeActive(1, action_max_timeout_ms())); ASSERT_TRUE(browser->GetTabCount(&tab_count)); ASSERT_EQ(2, tab_count); @@ -122,13 +121,11 @@ TEST_F(BookmarksUITest, CommandAgainGoesBackToBookmarksTab) { // Switch to first tab and run command again. ASSERT_TRUE(browser->ActivateTab(0)); - ASSERT_TRUE(browser->WaitForTabToBecomeActive(0, - UITest::action_max_timeout_ms())); + ASSERT_TRUE(browser->WaitForTabToBecomeActive(0, action_max_timeout_ms())); ASSERT_TRUE(browser->RunCommand(IDC_SHOW_BOOKMARK_MANAGER)); // Ensure the bookmarks ui tab is active. - ASSERT_TRUE(browser->WaitForTabToBecomeActive(1, - UITest::action_max_timeout_ms())); + ASSERT_TRUE(browser->WaitForTabToBecomeActive(1, action_max_timeout_ms())); ASSERT_TRUE(browser->GetTabCount(&tab_count)); ASSERT_EQ(2, tab_count); } diff --git a/chrome/browser/dom_ui/new_tab_ui_uitest.cc b/chrome/browser/dom_ui/new_tab_ui_uitest.cc index 7d7531e..0b8f380 100644 --- a/chrome/browser/dom_ui/new_tab_ui_uitest.cc +++ b/chrome/browser/dom_ui/new_tab_ui_uitest.cc @@ -43,19 +43,10 @@ TEST_F(NewTabUITest, NTPHasThumbnails) { scoped_refptr<TabProxy> tab = window->GetActiveTab(); ASSERT_TRUE(tab.get()); - int filler_thumbnails_count = -1; - int wait_time = action_max_timeout_ms(); - while (wait_time > 0) { - ASSERT_TRUE(tab->ExecuteAndExtractInt(L"", - L"window.domAutomationController.send(" - L"document.getElementsByClassName('filler').length)", - &filler_thumbnails_count)); - if (filler_thumbnails_count == 0) - break; - PlatformThread::Sleep(sleep_timeout_ms()); - wait_time -= sleep_timeout_ms(); - } - EXPECT_EQ(0, filler_thumbnails_count); + ASSERT_TRUE(WaitUntilJavaScriptCondition(tab, L"", + L"window.domAutomationController.send(" + L"document.getElementsByClassName('filler').length == 0)", + action_max_timeout_ms())); } TEST_F(NewTabUITest, ChromeInternalLoadsNTP) { diff --git a/chrome/browser/download/download_uitest.cc b/chrome/browser/download/download_uitest.cc index 2649364..40a5af27 100644 --- a/chrome/browser/download/download_uitest.cc +++ b/chrome/browser/download/download_uitest.cc @@ -56,11 +56,10 @@ class DownloadTest : public UITest { protected: DownloadTest() : UITest() {} - void CleanUpDownload(const FilePath& client_filename, + void CheckDownload(const FilePath& client_filename, const FilePath& server_filename) { // Find the path on the client. FilePath file_on_client = download_prefix_.Append(client_filename); - EXPECT_TRUE(file_util::PathExists(file_on_client)); // Find the path on the server. FilePath file_on_server; @@ -69,9 +68,8 @@ class DownloadTest : public UITest { file_on_server = file_on_server.Append(server_filename); ASSERT_TRUE(file_util::PathExists(file_on_server)); - // Check that we downloaded the file correctly. - EXPECT_TRUE(file_util::ContentsEqual(file_on_server, - file_on_client)); + WaitForGeneratedFileAndCheck(file_on_client, file_on_server, + true, true, false); #if defined(OS_WIN) // Check if the Zone Identifier is correctly set. @@ -83,8 +81,8 @@ class DownloadTest : public UITest { EXPECT_TRUE(file_util::Delete(file_on_client, false)); } - void CleanUpDownload(const FilePath& file) { - CleanUpDownload(file, file); + void CheckDownload(const FilePath& file) { + CheckDownload(file, file); } virtual void SetUp() { @@ -185,10 +183,7 @@ TEST_F(DownloadTest, FLAKY_DownloadMimeType) { // No new tabs created, downloads appear in the current tab's download shelf. WaitUntilTabCount(1); - // Wait until the file is downloaded. - PlatformThread::Sleep(action_timeout_ms()); - - CleanUpDownload(file); + CheckDownload(file); scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); ASSERT_TRUE(browser.get()); @@ -206,13 +201,11 @@ TEST_F(DownloadTest, FLAKY_NoDownload) { if (file_util::PathExists(file_path)) ASSERT_TRUE(file_util::Delete(file_path, false)); - EXPECT_EQ(1, GetTabCount()); - NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(file)); WaitUntilTabCount(1); // Wait to see if the file will be downloaded. - PlatformThread::Sleep(action_timeout_ms()); + PlatformThread::Sleep(sleep_timeout_ms()); EXPECT_FALSE(file_util::PathExists(file_path)); if (file_util::PathExists(file_path)) @@ -232,15 +225,10 @@ TEST_F(DownloadTest, FLAKY_ContentDisposition) { FilePath file(FILE_PATH_LITERAL("download-test3.gif")); FilePath download_file(FILE_PATH_LITERAL("download-test3-attachment.gif")); - EXPECT_EQ(1, GetTabCount()); - NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(file)); WaitUntilTabCount(1); - // Wait until the file is downloaded. - PlatformThread::Sleep(action_timeout_ms()); - - CleanUpDownload(download_file, file); + CheckDownload(download_file, file); // Ensure the download shelf is visible on the window. scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); @@ -258,15 +246,10 @@ TEST_F(DownloadTest, FLAKY_PerWindowShelf) { FilePath file(FILE_PATH_LITERAL("download-test3.gif")); FilePath download_file(FILE_PATH_LITERAL("download-test3-attachment.gif")); - EXPECT_EQ(1, GetTabCount()); - NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(file)); WaitUntilTabCount(1); - // Wait until the file is downloaded. - PlatformThread::Sleep(action_timeout_ms()); - - CleanUpDownload(download_file, file); + CheckDownload(download_file, file); // Ensure the download shelf is visible on the window. scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); @@ -348,7 +331,6 @@ TEST_F(DownloadTest, FLAKY_IncognitoDownload) { scoped_refptr<TabProxy> tab(incognito->GetTab(0)); ASSERT_TRUE(tab.get()); ASSERT_TRUE(tab->NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(file))); - PlatformThread::Sleep(action_timeout_ms()); // Verify that the download shelf is showing for the Incognito window. EXPECT_TRUE(WaitForDownloadShelfVisible(incognito.get())); @@ -362,7 +344,7 @@ TEST_F(DownloadTest, FLAKY_IncognitoDownload) { EXPECT_TRUE(browser->IsShelfVisible(&is_shelf_visible)); EXPECT_FALSE(is_shelf_visible); - CleanUpDownload(file); + CheckDownload(file); } } // namespace diff --git a/chrome/browser/extensions/browser_action_apitest.cc b/chrome/browser/extensions/browser_action_apitest.cc index b46006f..dbdf6c9 100644 --- a/chrome/browser/extensions/browser_action_apitest.cc +++ b/chrome/browser/extensions/browser_action_apitest.cc @@ -34,8 +34,6 @@ #define MAYBE_BrowserActionAddPopup BrowserActionAddPopup #endif -static const int kTimeoutMs = 60 * 1000; // 1 minute - class BrowserActionApiTest : public ExtensionApiTest { public: BrowserActionApiTest() {} diff --git a/chrome/browser/extensions/extension_uitest.cc b/chrome/browser/extensions/extension_uitest.cc index ebfef1f..bec705a 100644 --- a/chrome/browser/extensions/extension_uitest.cc +++ b/chrome/browser/extensions/extension_uitest.cc @@ -145,7 +145,7 @@ TEST_F(ExtensionTestSimpleApiCall, RunTest) { GURL("chrome-extension://pmgpglkggjdpkpghhdmbdhababjpcohk/test.html"), GURL(""))); - loop_.RunFor(2 * action_max_timeout_ms()); + loop_.RunFor(action_max_timeout_ms()); ASSERT_FALSE(message_received.empty()); scoped_ptr<Value> message_value(base::JSONReader::Read(message_received, diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc index d784bfc..b3dce0f 100644 --- a/chrome/test/automation/automation_proxy_uitest.cc +++ b/chrome/test/automation/automation_proxy_uitest.cc @@ -818,7 +818,7 @@ TEST_F(ExternalTabUITest, CreateExternalTab1) { .WillOnce(QUIT_LOOP(&loop)); tab = mock_->CreateTabWithUrl(GURL(simple_data_url)); - loop.RunFor(2 * action_max_timeout_ms()); + loop.RunFor(action_max_timeout_ms()); } // Create with empty url and then navigate @@ -841,7 +841,7 @@ TEST_F(ExternalTabUITest, FLAKY_CreateExternalTab2) { tab = mock_->CreateTabWithUrl(GURL()); mock_->NavigateInExternalTab(tab->handle(), GURL(simple_data_url)); - loop.RunFor(2 * action_max_timeout_ms()); + loop.RunFor(action_max_timeout_ms()); } TEST_F(ExternalTabUITest, IncognitoMode) { @@ -925,7 +925,7 @@ TEST_F(ExternalTabUITest, TabPostMessage) { EXPECT_CALL(*mock_, HandleClosed(1)).Times(1); tab = mock_->CreateTabWithUrl(GURL(content)); - loop.RunFor(2 * action_max_timeout_ms()); + loop.RunFor(action_max_timeout_ms()); } TEST_F(ExternalTabUITest, FLAKY_PostMessageTarget) { @@ -967,7 +967,7 @@ TEST_F(ExternalTabUITest, FLAKY_PostMessageTarget) { s.load_requests_via_automation = false; s.initial_url = GURL("http://localhost:1337/files/post_message.html"); tab = mock_->CreateHostWindowAndTab(s); - loop.RunFor(2 * action_max_timeout_ms()); + loop.RunFor(action_max_timeout_ms()); } TEST_F(ExternalTabUITest, HostNetworkStack) { @@ -1037,7 +1037,7 @@ TEST_F(ExternalTabUITest, HostNetworkStack) { .WillOnce(QUIT_LOOP_SOON(&loop, 300)); tab = mock_->CreateTabWithUrl(GURL(url)); - loop.RunFor(2 * action_max_timeout_ms()); + loop.RunFor(action_max_timeout_ms()); } TEST_F(ExternalTabUITest, HostNetworkStackAbortRequest) { @@ -1078,7 +1078,7 @@ TEST_F(ExternalTabUITest, HostNetworkStackAbortRequest) { .WillOnce(QUIT_LOOP_SOON(&loop, 300)); tab = mock_->CreateTabWithUrl(GURL(url)); - loop.RunFor(2 * action_max_timeout_ms()); + loop.RunFor(action_max_timeout_ms()); } TEST_F(ExternalTabUITest, HostNetworkStackUnresponsiveRenderer) { @@ -1146,7 +1146,7 @@ TEST_F(ExternalTabUITest, HostNetworkStackUnresponsiveRenderer) { EXPECT_CALL(*mock_, HandleClosed(1)).Times(1); tab = mock_->CreateTabWithUrl(GURL(url)); - loop.RunFor(2 * action_max_timeout_ms()); + loop.RunFor(action_max_timeout_ms()); mock_->DestroyHostWindow(); } @@ -1213,7 +1213,7 @@ TEST_F(ExternalTabUITestPopupEnabled, WindowDotOpen) { mock_->CreateTabWithUrl(main_url); - loop.RunFor(2 * action_max_timeout_ms()); + loop.RunFor(action_max_timeout_ms()); EXPECT_CALL(*mock_, HandleClosed(1)); EXPECT_CALL(*mock_, HandleClosed(2)); @@ -1260,7 +1260,7 @@ TEST_F(ExternalTabUITestPopupEnabled, UserGestureTargetBlank) { EXPECT_CALL(*mock_, OnLoad(2, _)).WillOnce(QUIT_LOOP_SOON(&loop, 500)); mock_->CreateTabWithUrl(main_url); - loop.RunFor(2 * action_max_timeout_ms()); + loop.RunFor(action_max_timeout_ms()); EXPECT_CALL(*mock_, HandleClosed(2)); EXPECT_CALL(*mock_, HandleClosed(1)); diff --git a/chrome/test/interactive_ui/keyboard_access_uitest.cc b/chrome/test/interactive_ui/keyboard_access_uitest.cc index f5c339e..bb8756a 100644 --- a/chrome/test/interactive_ui/keyboard_access_uitest.cc +++ b/chrome/test/interactive_ui/keyboard_access_uitest.cc @@ -84,7 +84,7 @@ void KeyboardAccessTest::TestMenuKeyboardAccess(bool alternate_key_sequence) { ASSERT_TRUE(window->SimulateOSKeyPress(base::VKEY_RETURN, 0)); // Wait for the new tab to appear. - ASSERT_TRUE(browser->WaitForTabCountToBecome(2, sleep_timeout_ms())); + ASSERT_TRUE(browser->WaitForTabCountToBecome(2, action_timeout_ms())); // Make sure that the new tab index is 1. ASSERT_TRUE(browser->GetActiveTabIndex(&tab_index)); diff --git a/chrome/test/interactive_ui/npapi_interactive_test.cc b/chrome/test/interactive_ui/npapi_interactive_test.cc index 3f6ca97..187e04b 100644 --- a/chrome/test/interactive_ui/npapi_interactive_test.cc +++ b/chrome/test/interactive_ui/npapi_interactive_test.cc @@ -41,7 +41,6 @@ const char kTestCompleteCookie[] = "status"; const char kTestCompleteSuccess[] = "OK"; -const int kShortWaitTimeout = 5 * 1000; // Tests if a plugin executing a self deleting script in the context of // a synchronous mousemove works correctly @@ -77,7 +76,7 @@ TEST_F(NPAPIVisiblePluginTester, SelfDeletePluginInvokeInSynchronousMouseMove) { WaitForFinish("execute_script_delete_in_mouse_move", "1", url, kTestCompleteCookie, kTestCompleteSuccess, - kShortWaitTimeout); + action_max_timeout_ms()); } } @@ -98,5 +97,5 @@ TEST_F(NPAPIVisiblePluginTester, GetURLRequest404Response) { ASSERT_TRUE(window->SimulateOSKeyPress(base::VKEY_ESCAPE, 0)); WaitForFinish("geturl_404_response", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); + kTestCompleteSuccess, action_max_timeout_ms()); } diff --git a/chrome/test/nacl/nacl_test.cc b/chrome/test/nacl/nacl_test.cc index 1ae70f9..71623e8 100644 --- a/chrome/test/nacl/nacl_test.cc +++ b/chrome/test/nacl/nacl_test.cc @@ -15,7 +15,6 @@ namespace { -const int kNaClTestTimeout = 20000; const char kTestCompleteCookie[] = "status"; const char kTestCompleteSuccess[] = "OK"; @@ -252,13 +251,9 @@ void NaClTest::TearDown() { UITest::TearDown(); } -int NaClTest::NaClTestTimeout() { - return std::max(kNaClTestTimeout, action_max_timeout_ms()); -} - TEST_F(NaClTest, ServerTest) { FilePath test_file(kServerHtmlFileName); - RunTest(test_file, NaClTestTimeout()); + RunTest(test_file, action_max_timeout_ms()); } // Those tests are disabled because they don't work on Windows. @@ -269,7 +264,7 @@ TEST_F(NaClTest, FLAKY_SrpcHelloWorld) { TEST_F(NaClTest, SrpcHelloWorld) { #endif FilePath test_file(kSrpcHwHtmlFileName); - RunTest(test_file, NaClTestTimeout()); + RunTest(test_file, action_max_timeout_ms()); } #if defined(OS_WIN) @@ -278,7 +273,7 @@ TEST_F(NaClTest, FLAKY_SrpcBasicTest) { TEST_F(NaClTest, SrpcBasicTest) { #endif FilePath test_file(kSrpcBasicHtmlFileName); - RunTest(test_file, NaClTestTimeout()); + RunTest(test_file, action_max_timeout_ms()); } #if defined(OS_WIN) @@ -287,7 +282,7 @@ TEST_F(NaClTest, FLAKY_SrpcSockAddrTest) { TEST_F(NaClTest, SrpcSockAddrTest) { #endif FilePath test_file(kSrpcSockAddrHtmlFileName); - RunTest(test_file, NaClTestTimeout()); + RunTest(test_file, action_max_timeout_ms()); } #if defined(OS_WIN) @@ -296,7 +291,7 @@ TEST_F(NaClTest, FLAKY_SrpcShmTest) { TEST_F(NaClTest, SrpcShmTest) { #endif FilePath test_file(kSrpcShmHtmlFileName); - RunTest(test_file, NaClTestTimeout()); + RunTest(test_file, action_max_timeout_ms()); } #if defined(OS_WIN) @@ -305,7 +300,7 @@ TEST_F(NaClTest, FLAKY_SrpcPluginTest) { TEST_F(NaClTest, SrpcPluginTest) { #endif FilePath test_file(kSrpcPluginHtmlFileName); - RunTest(test_file, NaClTestTimeout()); + RunTest(test_file, action_max_timeout_ms()); } #if defined(OS_WIN) @@ -314,5 +309,5 @@ TEST_F(NaClTest, FLAKY_SrpcNrdXferTest) { TEST_F(NaClTest, SrpcNrdXferTest) { #endif FilePath test_file(kSrpcNrdXferHtmlFileName); - RunTest(test_file, NaClTestTimeout()); + RunTest(test_file, action_max_timeout_ms()); } diff --git a/chrome/test/nacl/nacl_test.h b/chrome/test/nacl/nacl_test.h index b299e3f..7a38fb1 100644 --- a/chrome/test/nacl/nacl_test.h +++ b/chrome/test/nacl/nacl_test.h @@ -39,9 +39,6 @@ class NaClTest : public UITest { // Construct a URL for a test file on our local webserver. GURL GetTestUrl(const FilePath& filename); - // Get the timeout used for NaCL tests. - int NaClTestTimeout(); - private: void PrepareSrpcHwTest(FilePath test_root_dir); void PrepareServerTest(FilePath test_root_dir); diff --git a/chrome/test/plugin/plugin_test.cpp b/chrome/test/plugin/plugin_test.cpp index 9dba28d..f80de3f 100644 --- a/chrome/test/plugin/plugin_test.cpp +++ b/chrome/test/plugin/plugin_test.cpp @@ -65,8 +65,6 @@ const char kTestCompleteCookie[] = "status"; const char kTestCompleteSuccess[] = "OK"; -const int kShortWaitTimeout = 10 * 1000; -const int kLongWaitTimeout = 30 * 1000; class PluginTest : public UITest { protected: @@ -120,69 +118,55 @@ class PluginTest : public UITest { // Waits for the test case to finish. void WaitForFinish(const int wait_time, bool mock_http) { - const int kSleepTime = 500; // 2 times per second - const int kMaxIntervals = wait_time / kSleepTime; - GURL url = GetTestUrl(L"done", mock_http); scoped_refptr<TabProxy> tab(GetActiveTab()); - std::string done_str; - for (int i = 0; i < kMaxIntervals; ++i) { - Sleep(kSleepTime); - - // The webpage being tested has javascript which sets a cookie - // which signals completion of the test. - std::string cookieName = kTestCompleteCookie; - tab->GetCookieByName(url, cookieName, &done_str); - if (!done_str.empty()) - break; - } - - EXPECT_EQ(kTestCompleteSuccess, done_str); + ASSERT_TRUE(WaitUntilCookieValue(tab, url, kTestCompleteCookie, + wait_time, kTestCompleteSuccess)); } }; TEST_F(PluginTest, Quicktime) { - TestPlugin(L"quicktime.html", kShortWaitTimeout, false); + TestPlugin(L"quicktime.html", action_max_timeout_ms(), false); } TEST_F(PluginTest, MediaPlayerNew) { - TestPlugin(L"wmp_new.html", kShortWaitTimeout, false); + TestPlugin(L"wmp_new.html", action_max_timeout_ms(), false); } // http://crbug.com/4809 TEST_F(PluginTest, DISABLED_MediaPlayerOld) { - TestPlugin(L"wmp_old.html", kLongWaitTimeout, false); + TestPlugin(L"wmp_old.html", action_max_timeout_ms(), false); } TEST_F(PluginTest, Real) { - TestPlugin(L"real.html", kShortWaitTimeout, false); + TestPlugin(L"real.html", action_max_timeout_ms(), false); } TEST_F(PluginTest, Flash) { - TestPlugin(L"flash.html", kShortWaitTimeout, false); + TestPlugin(L"flash.html", action_max_timeout_ms(), false); } TEST_F(PluginTest, FlashOctetStream) { - TestPlugin(L"flash-octet-stream.html", kShortWaitTimeout, false); + TestPlugin(L"flash-octet-stream.html", action_max_timeout_ms(), false); } TEST_F(PluginTest, FlashSecurity) { - TestPlugin(L"flash.html", kShortWaitTimeout, false); + TestPlugin(L"flash.html", action_max_timeout_ms(), false); } // http://crbug.com/16114 // Flaky, http://crbug.com/21538 TEST_F(PluginTest, FLAKY_FlashLayoutWhilePainting) { - TestPlugin(L"flash-layout-while-painting.html", kShortWaitTimeout, true); + TestPlugin(L"flash-layout-while-painting.html", action_max_timeout_ms(), true); } // http://crbug.com/8690 TEST_F(PluginTest, DISABLED_Java) { - TestPlugin(L"Java.html", kShortWaitTimeout, false); + TestPlugin(L"Java.html", action_max_timeout_ms(), false); } // Flaky, http://crbug.com/22666 TEST_F(PluginTest, FLAKY_Silverlight) { - TestPlugin(L"silverlight.html", kShortWaitTimeout, false); + TestPlugin(L"silverlight.html", action_max_timeout_ms(), false); } diff --git a/chrome/test/ui/npapi_test_helper.h b/chrome/test/ui/npapi_test_helper.h index 8896713..ca75cfa 100644 --- a/chrome/test/ui/npapi_test_helper.h +++ b/chrome/test/ui/npapi_test_helper.h @@ -10,8 +10,6 @@ namespace npapi_test { extern const char kTestCompleteCookie[]; extern const char kTestCompleteSuccess[]; -const int kLongWaitTimeout = 30 * 1000; -const int kShortWaitTimeout = 5 * 1000; } // namespace npapi_test. // Base class for NPAPI tests. It provides common functionality between diff --git a/chrome/test/ui/npapi_uitest.cc b/chrome/test/ui/npapi_uitest.cc index 7b61abd..c6f4a71 100644 --- a/chrome/test/ui/npapi_uitest.cc +++ b/chrome/test/ui/npapi_uitest.cc @@ -32,8 +32,6 @@ using npapi_test::kTestCompleteCookie; using npapi_test::kTestCompleteSuccess; -using npapi_test::kLongWaitTimeout; -using npapi_test::kShortWaitTimeout; static const FilePath::CharType* kTestDir = FILE_PATH_LITERAL("npapi"); @@ -43,7 +41,7 @@ TEST_F(NPAPITester, Arguments) { GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("arguments", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); + kTestCompleteSuccess, action_max_timeout_ms()); } // Test invoking many plugins within a single page. @@ -54,9 +52,11 @@ TEST_F(NPAPITester, FLAKY_ManyPlugins) { ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); for (int i = 1; i <= 15; i++) { - SCOPED_TRACE(StringPrintf("Iteration %d", i)); - WaitForFinish("arguments", IntToString(i), url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); + SCOPED_TRACE(StringPrintf("Waiting for plugin #%d", i)); + ASSERT_NO_FATAL_FAILURE(WaitForFinish("arguments", IntToString(i), + url, kTestCompleteCookie, + kTestCompleteSuccess, + action_max_timeout_ms())); } } @@ -66,7 +66,7 @@ TEST_F(NPAPITester, GetURL) { GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("geturl", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); + kTestCompleteSuccess, action_max_timeout_ms()); } // Test various calls to GetURL for javascript URLs with @@ -76,7 +76,7 @@ TEST_F(NPAPITester, GetJavaScriptURL) { GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("getjavascripturl", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); + kTestCompleteSuccess, action_max_timeout_ms()); } // Flaky test: http://crbug.com/29020 @@ -87,7 +87,7 @@ TEST_F(NPAPITester, FLAKY_GetJavaScriptURL2) { GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("getjavascripturl2", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); + kTestCompleteSuccess, action_max_timeout_ms()); } // Tests that if an NPObject is proxies back to its original process, the @@ -98,7 +98,7 @@ TEST_F(NPAPITester, NPObjectProxy) { GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("npobject_proxy", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); + kTestCompleteSuccess, action_max_timeout_ms()); } // Tests if a plugin executing a self deleting script using NPN_GetURL @@ -109,7 +109,7 @@ TEST_F(NPAPITester, SelfDeletePluginGetUrl) { ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("self_delete_plugin_geturl", "1", url, kTestCompleteCookie, kTestCompleteSuccess, - kShortWaitTimeout); + action_max_timeout_ms()); } // Tests if a plugin executing a self deleting script using Invoke @@ -121,7 +121,7 @@ TEST_F(NPAPITester, FLAKY_SelfDeletePluginInvoke) { ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("self_delete_plugin_invoke", "1", url, kTestCompleteCookie, kTestCompleteSuccess, - kShortWaitTimeout); + action_max_timeout_ms()); } // Tests if a plugin executing a self deleting script using Invoke with @@ -140,7 +140,7 @@ TEST_F(NPAPITester, DISABLED_SelfDeletePluginInvokeAlert) { WaitForFinish("self_delete_plugin_invoke_alert", "1", url, kTestCompleteCookie, kTestCompleteSuccess, - kShortWaitTimeout); + action_max_timeout_ms()); } #if defined(OS_WIN) || defined(OS_MACOSX) @@ -158,7 +158,7 @@ TEST_F(NPAPIVisiblePluginTester, ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("execute_script_delete_in_paint", "1", url, kTestCompleteCookie, kTestCompleteSuccess, - kShortWaitTimeout); + action_max_timeout_ms()); } #endif @@ -172,7 +172,7 @@ TEST_F(NPAPIVisiblePluginTester, SelfDeletePluginInNewStream) { ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("self_delete_plugin_stream", "1", url, kTestCompleteCookie, kTestCompleteSuccess, - kShortWaitTimeout); + action_max_timeout_ms()); } #if defined(OS_WIN) @@ -183,7 +183,7 @@ TEST_F(NPAPIVisiblePluginTester, VerifyPluginWindowRect) { GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("checkwindowrect", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); + kTestCompleteSuccess, action_max_timeout_ms()); } // Tests that creating a new instance of a plugin while another one is handling @@ -194,7 +194,7 @@ TEST_F(NPAPIVisiblePluginTester, CreateInstanceInPaint) { GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("create_instance_in_paint", "2", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); + kTestCompleteSuccess, action_max_timeout_ms()); } // Tests that putting up an alert in response to a paint doesn't deadlock. @@ -234,7 +234,7 @@ TEST_F(NPAPIVisiblePluginTester, VerifyNPObjectLifetimeTest) { ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("npobject_lifetime_test", "1", url, kTestCompleteCookie, kTestCompleteSuccess, - kShortWaitTimeout); + action_max_timeout_ms()); } // Tests that we don't crash or assert if NPP_New fails @@ -243,7 +243,7 @@ TEST_F(NPAPIVisiblePluginTester, NewFails) { GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("new_fails", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); + kTestCompleteSuccess, action_max_timeout_ms()); } TEST_F(NPAPIVisiblePluginTester, SelfDeletePluginInNPNEvaluate) { @@ -256,7 +256,7 @@ TEST_F(NPAPIVisiblePluginTester, SelfDeletePluginInNPNEvaluate) { ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("npobject_delete_plugin_in_evaluate", "1", url, kTestCompleteCookie, kTestCompleteSuccess, - kShortWaitTimeout); + action_max_timeout_ms()); } #endif @@ -280,7 +280,7 @@ TEST_F(NPAPITester, PrivateDisabled) { GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("private", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); + kTestCompleteSuccess, action_max_timeout_ms()); } TEST_F(NPAPITester, ScheduleTimer) { @@ -288,7 +288,7 @@ TEST_F(NPAPITester, ScheduleTimer) { GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("schedule_timer", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); + kTestCompleteSuccess, action_max_timeout_ms()); } TEST_F(NPAPITester, PluginThreadAsyncCall) { @@ -296,7 +296,7 @@ TEST_F(NPAPITester, PluginThreadAsyncCall) { GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("plugin_thread_async_call", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); + kTestCompleteSuccess, action_max_timeout_ms()); } // Test checking the privacy mode is on. @@ -308,7 +308,7 @@ TEST_F(NPAPIIncognitoTester, PrivateEnabled) { GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("private", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); + kTestCompleteSuccess, action_max_timeout_ms()); } #if defined(OS_WIN) || defined(OS_MACOSX) @@ -323,7 +323,7 @@ TEST_F(NPAPIVisiblePluginTester, MultipleInstancesSyncCalls) { GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("multiple_instances_sync_calls", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); + kTestCompleteSuccess, action_max_timeout_ms()); } #endif @@ -338,7 +338,7 @@ TEST_F(NPAPIVisiblePluginTester, GetURLRequestFailWrite) { ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("geturl_fail_write", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); + kTestCompleteSuccess, action_max_timeout_ms()); } #if defined(OS_WIN) @@ -352,7 +352,7 @@ TEST_F(NPAPITester, EnsureScriptingWorksInDestroy) { ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("ensure_scripting_works_in_destroy", "1", url, kTestCompleteCookie, kTestCompleteSuccess, - kShortWaitTimeout); + action_max_timeout_ms()); } // This test uses a Windows Event to signal to the plugin that it should crash @@ -374,7 +374,7 @@ TEST_F(NPAPITester, FLAKY_NoHangIfInitCrashes) { NavigateToURL(url); WaitForFinish("no_hang_if_init_crashes", "1", url, kTestCompleteCookie, kTestCompleteSuccess, - kShortWaitTimeout); + action_max_timeout_ms()); CloseHandle(crash_event); } @@ -408,7 +408,7 @@ TEST_F(NPAPITester, NPObjectSetException) { ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("npobject_set_exception", "1", url, kTestCompleteCookie, kTestCompleteSuccess, - kShortWaitTimeout); + action_max_timeout_ms()); } TEST_F(NPAPIVisiblePluginTester, PluginReferrerTest) { @@ -422,7 +422,7 @@ TEST_F(NPAPIVisiblePluginTester, PluginReferrerTest) { ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("plugin_referrer_test", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); + kTestCompleteSuccess, action_max_timeout_ms()); } #if defined(OS_MACOSX) @@ -445,6 +445,6 @@ TEST_F(NPAPIVisiblePluginTester, FLAKY_PluginConvertPointTest) { // change the test to trigger on mouse-down rather than window focus. ASSERT_TRUE(browser->BringToFront()); WaitForFinish("convert_point", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); + kTestCompleteSuccess, action_max_timeout_ms()); } #endif diff --git a/chrome/test/ui/pepper_uitest.cc b/chrome/test/ui/pepper_uitest.cc index 01b14e3..b91877b 100644 --- a/chrome/test/ui/pepper_uitest.cc +++ b/chrome/test/ui/pepper_uitest.cc @@ -17,8 +17,6 @@ static const char kPepperTestPluginName[] = "libnpapi_pepper_test_plugin.so"; using npapi_test::kTestCompleteCookie; using npapi_test::kTestCompleteSuccess; -using npapi_test::kLongWaitTimeout; -using npapi_test::kShortWaitTimeout; // Helper class pepper NPAPI tests. class PepperTester : public NPAPITesterBase { @@ -44,5 +42,5 @@ TEST_F(PepperTester, DISABLED_Pepper3D) { ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); WaitForFinish("pepper_3d", "1", url, kTestCompleteCookie, kTestCompleteSuccess, - kShortWaitTimeout); + action_max_timeout_ms()); } diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc index 9c3c778..8ebb443 100644 --- a/chrome/test/ui/ui_test.cc +++ b/chrome/test/ui/ui_test.cc @@ -830,7 +830,11 @@ bool UITestBase::WaitUntilJavaScriptCondition(TabProxy* tab, return false; bool done_value = false; - EXPECT_TRUE(tab->ExecuteAndExtractBool(frame_xpath, jscript, &done_value)); + bool success = tab->ExecuteAndExtractBool(frame_xpath, jscript, + &done_value); + EXPECT_TRUE(success); + if (!success) + return false; if (done_value) return true; } |