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

Unified Diff: ppapi/tests/testing_instance.cc

Issue 9403039: PPAPI: Really force-free NPObjects on Instance destruction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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 58e08907fc217d7e8d4c3a0aa83d67becad7865e..042e703dcf77c2d337791f4031da0cc06c0481f2 100644
--- a/ppapi/tests/testing_instance.cc
+++ b/ppapi/tests/testing_instance.cc
@@ -102,18 +102,16 @@ 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::AddPostCondition(const std::string& script) {
+ SendTestCommand("AddPostCondition", script);
}
void TestingInstance::LogTest(const std::string& test_name,
@@ -150,7 +148,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
@@ -169,7 +167,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) {
@@ -190,6 +190,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;
@@ -226,9 +238,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) {
« 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