diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-10 02:46:03 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-10 02:46:03 +0000 |
commit | 49c09c15d6bef3d14a7c77e9e59d90057cc3517d (patch) | |
tree | 3f00a08c635845489003c10c91729531b6ff973a | |
parent | 4c1b035dd362ef394df78a5abdb46c6242d22fc4 (diff) | |
download | chromium_src-49c09c15d6bef3d14a7c77e9e59d90057cc3517d.zip chromium_src-49c09c15d6bef3d14a7c77e9e59d90057cc3517d.tar.gz chromium_src-49c09c15d6bef3d14a7c77e9e59d90057cc3517d.tar.bz2 |
Add a separate cookie for the start of a PPAPI test to help reduce test
flakyness.
This also ups the timeout time for actually running the test. We don't know
what the tests do (some of the file ones do a lot of I/O), so the short timeout
is somewhat dangerous. We have not historically had many problems with hanging
tests other than problems with startup (which has a shorter timeout), so I
think the longer test timeout is unlikely to cause problems.
TEST=this is
BUG=none
Review URL: http://codereview.chromium.org/5743002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68819 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/test/ui/ppapi_uitest.cc | 20 | ||||
-rw-r--r-- | ppapi/tests/testing_instance.cc | 4 |
2 files changed, 22 insertions, 2 deletions
diff --git a/chrome/test/ui/ppapi_uitest.cc b/chrome/test/ui/ppapi_uitest.cc index d861705..b4e0261 100644 --- a/chrome/test/ui/ppapi_uitest.cc +++ b/chrome/test/ui/ppapi_uitest.cc @@ -4,6 +4,7 @@ #include "base/file_util.h" #include "base/path_service.h" +#include "base/test/test_timeouts.h" #include "build/build_config.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/automation/tab_proxy.h" @@ -84,9 +85,26 @@ class PPAPITest : public UITest { scoped_refptr<TabProxy> tab(GetActiveTab()); ASSERT_TRUE(tab.get()); ASSERT_TRUE(tab->NavigateToURL(test_url)); + + // First wait for the "starting" signal. This cookie is set at the start + // of every test. Waiting for this separately allows us to avoid a single + // long timeout. Instead, we can have two timeouts which allow startup + + // test execution time to take a while on a loaded computer, while also + // making sure we're making forward progress. + std::string startup_cookie = + WaitUntilCookieNonEmpty(tab.get(), test_url, + "STARTUP_COOKIE", action_max_timeout_ms()); + + // If this fails, the plugin couldn't be loaded in the given amount of + // time. This may mean the plugin was not found or possibly the system + // can't load it due to missing symbols, etc. + ASSERT_STREQ("STARTED", startup_cookie.c_str()) + << "Plugin couldn't be loaded. Make sure the PPAPI test plugin is " + << "built, in the right place, and doesn't have any missing symbols."; + std::string escaped_value = WaitUntilCookieNonEmpty(tab.get(), test_url, - "COMPLETION_COOKIE", action_max_timeout_ms()); + "COMPLETION_COOKIE", TestTimeouts::large_test_timeout_ms()); EXPECT_STREQ("PASS", escaped_value.c_str()); } }; diff --git a/ppapi/tests/testing_instance.cc b/ppapi/tests/testing_instance.cc index 3f42d415..34ec749 100644 --- a/ppapi/tests/testing_instance.cc +++ b/ppapi/tests/testing_instance.cc @@ -93,6 +93,8 @@ void TestingInstance::AppendError(const std::string& message) { } void TestingInstance::ExecuteTests(int32_t unused) { + SetCookie("STARTUP_COOKIE", "STARTED"); + // Clear the console. // This does: window.document.getElementById("console").innerHTML = ""; pp::Var window = GetWindowObject(); @@ -168,7 +170,7 @@ void TestingInstance::LogHTML(const std::string& html) { } void TestingInstance::SetCookie(const std::string& name, - const std::string& value) { + const std::string& value) { // window.document.cookie = "<name>=<value>; path=/" std::string cookie_string = name + "=" + value + "; path=/"; pp::Var document = GetWindowObject().GetProperty("document"); |