Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(897)

Unified Diff: ppapi/tests/testing_instance.cc

Issue 9564024: Re-land http://codereview.chromium.org/9403039/, r124106 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove unnecessary change to ppapi_uitest.cc timer_ Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/tests/testing_instance.h ('k') | webkit/plugins/ppapi/host_var_tracker.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {}
« no previous file with comments | « ppapi/tests/testing_instance.h ('k') | webkit/plugins/ppapi/host_var_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698