diff options
-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"); |