summaryrefslogtreecommitdiffstats
path: root/ppapi/tests
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-10 07:49:10 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-10 07:49:10 +0000
commitf237c0faa440ad898c234da4b999ced61cc17b88 (patch)
tree733bc7f3fe8a48aea070d0c1a1e1c757b917a179 /ppapi/tests
parent77671dd7696af0536b4f3a4f0d2e21e13b723c6a (diff)
downloadchromium_src-f237c0faa440ad898c234da4b999ced61cc17b88.zip
chromium_src-f237c0faa440ad898c234da4b999ced61cc17b88.tar.gz
chromium_src-f237c0faa440ad898c234da4b999ced61cc17b88.tar.bz2
Switch PPAPITests to run in browser_tests instead of ui_tests. The former is sharded and so tests run in parallel. Before this they were taking 17 minutes on the trybot. Now they take about a minute.
Another benefit is we can replace the sleeps with messages, so hopefully this makes the test faster/less flakier. BUG=115595 Review URL: https://chromiumcodereview.appspot.com/9646027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126019 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/tests')
-rw-r--r--ppapi/tests/test_view.cc9
-rw-r--r--ppapi/tests/testing_instance.cc9
-rw-r--r--ppapi/tests/testing_instance.h31
3 files changed, 21 insertions, 28 deletions
diff --git a/ppapi/tests/test_view.cc b/ppapi/tests/test_view.cc
index 3889285..6a8e748 100644
--- a/ppapi/tests/test_view.cc
+++ b/ppapi/tests/test_view.cc
@@ -93,9 +93,8 @@ std::string TestView::TestPageHideShow() {
ASSERT_FALSE(page_visibility_log_.empty());
ASSERT_TRUE(page_visibility_log_[0]);
- // Now that we're alive, set a cookie so the UI test knows it can change our
- // visibility.
- instance_->SetCookie("TestPageHideShow:Created", "TRUE");
+ // Now that we're alive, tell the test knows it can change our visibility.
+ instance_->ReportProgress("TestPageHideShow:Created");
// Wait until we get a hide event, being careful to handle spurious
// notifications of ViewChanged.
@@ -116,8 +115,8 @@ std::string TestView::TestPageHideShow() {
"tab, waiting 2 more secs, and closing the new tab.";
}
- // Set a cookie so the UI test knows it can show us again.
- instance_->SetCookie("TestPageHideShow:Hidden", "TRUE");
+ // Tell the test so it can show us again.
+ instance_->ReportProgress("TestPageHideShow:Hidden");
// Wait until we get a show event.
begin_time = pp::Module::Get()->core()->GetTime();
diff --git a/ppapi/tests/testing_instance.cc b/ppapi/tests/testing_instance.cc
index 58e0890..22dfccb 100644
--- a/ppapi/tests/testing_instance.cc
+++ b/ppapi/tests/testing_instance.cc
@@ -29,7 +29,6 @@ TestingInstance::TestingInstance(PP_Instance instance)
: pp::InstancePrivate(instance),
#endif
current_case_(NULL),
- progress_cookie_number_(0),
executed_tests_(false),
nacl_mode_(false) {
callback_factory_.Initialize(this);
@@ -233,10 +232,10 @@ void TestingInstance::LogHTML(const std::string& html) {
void TestingInstance::ReportProgress(const std::string& progress_value) {
// Use streams since nacl doesn't compile base yet (for StringPrintf).
- std::ostringstream cookie_name;
- cookie_name << "PPAPI_PROGRESS_" << progress_cookie_number_;
- SetCookie(cookie_name.str(), progress_value);
- progress_cookie_number_++;
+ std::ostringstream script;
+ script << "window.domAutomationController.setAutomationId(0);" <<
+ "window.domAutomationController.send(\"" << progress_value << "\")";
+ EvalScript(script.str());
}
class Module : public pp::Module {
diff --git a/ppapi/tests/testing_instance.h b/ppapi/tests/testing_instance.h
index 7b05174..55c7e3d 100644
--- a/ppapi/tests/testing_instance.h
+++ b/ppapi/tests/testing_instance.h
@@ -19,20 +19,19 @@ class TestCase;
// How signaling works:
//
-// We want to signal to the Chrome UI test harness
+// We want to signal to the Chrome browser test harness
// (chrome/test/ui/ppapi_uitest.cc) that we're making progress and when we're
-// done. The easiest thing in the UI test infrastructure is to wait for a
-// cookie to become nonempty. We don't want to have a big wait for all tests in
-// a TestCase since they can take a while and it might timeout. So we set a
-// series of cookies with an incrementing number in the name.
+// done. This is done using the DOM controlller. The browser test waits for a
+// message from it. We don't want to have a big wait for all tests in a TestCase
+// since they can take a while and it might timeout. So we send it pings
+// between each test to tell it that we're still running tests and aren't stuck.
//
-// If the value of the cookie is "..." then that tells the test runner that
-// the test is progressing. It then waits for the next numbered cookie until
-// it either times out or the value is something other than "...". In this
-// case, the value will be either "PASS" or "FAIL [optional message]"
-// corresponding to the outcome of the entire test case. Timeout will be
-// treated just like a failure of the entire test case and the test will be
-// terminated.
+// If the value of the message is "..." then that tells the test runner that
+// the test is progressing. It then waits for the next message until it either
+// times out or the value is something other than "...". In this case, the value
+// will be either "PASS" or "FAIL [optional message]" corresponding to the
+// outcome of the entire test case. Timeout will be treated just like a failure
+// of the entire test case and the test will be terminated.
//
// In trusted builds, we use InstancePrivate and allow tests that use
// synchronous scripting. NaCl does not support synchronous scripting.
@@ -89,6 +88,8 @@ pp::InstancePrivate {
// Sets the given cookie in the current document.
void SetCookie(const std::string& name, const std::string& value);
+ void ReportProgress(const std::string& progress_value);
+
private:
void ExecuteTests(int32_t unused);
@@ -115,8 +116,6 @@ pp::InstancePrivate {
// Appends the given HTML string to the console in the document.
void LogHTML(const std::string& html);
- void ReportProgress(const std::string& progress_value);
-
pp::CompletionCallbackFactory<TestingInstance> callback_factory_;
// Owning pointer to the current test case. Valid after Init has been called.
@@ -126,10 +125,6 @@ pp::InstancePrivate {
// runs only tests whose name contains test_filter_ as a substring.
std::string test_filter_;
- // The current step we're on starting at 0. This is incremented every time we
- // report progress via a cookie. See comment above the class.
- int progress_cookie_number_;
-
// Set once the tests are run so we know not to re-run when the view is sized.
bool executed_tests_;