diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-08 07:15:16 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-08 07:15:16 +0000 |
commit | 36589350415ced89e716015330fe210a8fcfd180 (patch) | |
tree | 95673c9f4a7aebe659a3500902c7480ecbe10d2b /chrome/test | |
parent | 93b86a850b7b1b3f46a7c4fc4521fefa8ca56e8d (diff) | |
download | chromium_src-36589350415ced89e716015330fe210a8fcfd180.zip chromium_src-36589350415ced89e716015330fe210a8fcfd180.tar.gz chromium_src-36589350415ced89e716015330fe210a8fcfd180.tar.bz2 |
[GTTF] Tests cleanup:
- use timeouts correctly
- use more automation methods to make test code more clear
- use more reliable ways of waiting
- remove unnecessary automation calls
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/1553016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43932 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-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 |
10 files changed, 68 insertions, 93 deletions
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; } |