| Index: ppapi/tests/testing_instance.cc
|
| diff --git a/ppapi/tests/testing_instance.cc b/ppapi/tests/testing_instance.cc
|
| index 42021810fa968af604ebaf0209a22a607232bffd..41521390c0228780da49fbe608dc857572740fbc 100644
|
| --- a/ppapi/tests/testing_instance.cc
|
| +++ b/ppapi/tests/testing_instance.cc
|
| @@ -104,18 +104,12 @@ bool TestingInstance::HandleInputEvent(const pp::InputEvent& event) {
|
| }
|
|
|
| void TestingInstance::EvalScript(const std::string& script) {
|
| - std::string message("TESTING_MESSAGE:EvalScript:");
|
| - message.append(script);
|
| - PostMessage(pp::Var(message));
|
| + SendTestCommand("EvalScript", script);
|
| }
|
|
|
| void TestingInstance::SetCookie(const std::string& name,
|
| const std::string& value) {
|
| - std::string message("TESTING_MESSAGE:SetCookie:");
|
| - message.append(name);
|
| - message.append("=");
|
| - message.append(value);
|
| - PostMessage(pp::Var(message));
|
| + SendTestCommand("SetCookie", name + "=" + value);
|
| }
|
|
|
| void TestingInstance::LogTest(const std::string& test_name,
|
| @@ -152,7 +146,7 @@ void TestingInstance::ExecuteTests(int32_t unused) {
|
| ReportProgress(kProgressSignal);
|
|
|
| // Clear the console.
|
| - PostMessage(pp::Var("TESTING_MESSAGE:ClearConsole"));
|
| + SendTestCommand("ClearConsole");
|
|
|
| if (!errors_.empty()) {
|
| // Catch initialization errors and output the current error string to
|
| @@ -171,7 +165,9 @@ void TestingInstance::ExecuteTests(int32_t unused) {
|
|
|
| // Declare we're done by setting a cookie to either "PASS" or the errors.
|
| ReportProgress(errors_.empty() ? "PASS" : errors_);
|
| - PostMessage(pp::Var("TESTING_MESSAGE:DidExecuteTests"));
|
| + SendTestCommand("DidExecuteTests");
|
| + // Note, DidExecuteTests unloads the plugin. We can't really do anthing after
|
| + // this point.
|
| }
|
|
|
| TestCase* TestingInstance::CaseForTestName(const std::string& name) {
|
| @@ -192,6 +188,18 @@ std::string TestingInstance::FilterForTestName(const std::string& name) {
|
| return "";
|
| }
|
|
|
| +void TestingInstance::SendTestCommand(const std::string& command) {
|
| + std::string msg("TESTING_MESSAGE:");
|
| + msg += command;
|
| + PostMessage(pp::Var(msg));
|
| +}
|
| +
|
| +void TestingInstance::SendTestCommand(const std::string& command,
|
| + const std::string& params) {
|
| + SendTestCommand(command + ":" + params);
|
| +}
|
| +
|
| +
|
| void TestingInstance::LogAvailableTests() {
|
| // Print out a listing of all tests.
|
| std::vector<std::string> test_cases;
|
| @@ -228,9 +236,7 @@ void TestingInstance::LogError(const std::string& text) {
|
| }
|
|
|
| void TestingInstance::LogHTML(const std::string& html) {
|
| - std::string message("TESTING_MESSAGE:LogHTML:");
|
| - message.append(html);
|
| - PostMessage(pp::Var(message));
|
| + SendTestCommand("LogHTML", html);
|
| }
|
|
|
| void TestingInstance::ReportProgress(const std::string& progress_value) {
|
| @@ -241,6 +247,10 @@ void TestingInstance::ReportProgress(const std::string& progress_value) {
|
| EvalScript(script.str());
|
| }
|
|
|
| +void TestingInstance::AddPostCondition(const std::string& script) {
|
| + SendTestCommand("AddPostCondition", script);
|
| +}
|
| +
|
| class Module : public pp::Module {
|
| public:
|
| Module() : pp::Module() {}
|
|
|