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

Unified Diff: ppapi/shared_impl/unittest_utils.cc

Issue 18599005: [PPAPI] Added PP_VARTYPE_RESOURCE as a PP_VarType enum value. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix tests; slightly better behaviour if user passes a resource to a message. Created 7 years, 3 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
Index: ppapi/shared_impl/unittest_utils.cc
diff --git a/ppapi/shared_impl/unittest_utils.cc b/ppapi/shared_impl/unittest_utils.cc
index f5d064b4db669e0ad939a55ebfca05cb2ce99ab0..aa8b7e89a6080681e76b33e7f88f46b98377d379 100644
--- a/ppapi/shared_impl/unittest_utils.cc
+++ b/ppapi/shared_impl/unittest_utils.cc
@@ -10,6 +10,7 @@
#include "base/logging.h"
#include "ppapi/shared_impl/array_var.h"
#include "ppapi/shared_impl/dictionary_var.h"
+#include "ppapi/shared_impl/resource_var.h"
#include "ppapi/shared_impl/var.h"
#include "ppapi/shared_impl/var_tracker.h"
@@ -151,6 +152,30 @@ bool Equals(const PP_Var& expected,
}
return true;
}
+ case PP_VARTYPE_RESOURCE: {
+ ResourceVar* expected_var = ResourceVar::FromPPVar(expected);
+ ResourceVar* actual_var = ResourceVar::FromPPVar(actual);
+ DCHECK(expected_var && actual_var);
+ if (expected_var->pp_resource() != actual_var->pp_resource()) {
+ LOG(ERROR) << "expected: " << expected_var->pp_resource() << " actual: "
+ << actual_var->pp_resource();
+ return false;
+ }
+ if (expected_var->creation_message().size() !=
+ actual_var->creation_message().size()) {
+ LOG(ERROR) << "expected creation message size: "
+ << expected_var->creation_message().size()
+ << " actual: " << actual_var->creation_message().size();
+ return false;
+ }
+ if (memcmp(expected_var->creation_message().data(),
+ actual_var->creation_message().data(),
+ expected_var->creation_message().size()) != 0) {
+ LOG(ERROR) << "expected creation message does not match actual.";
+ return false;
+ }
+ return true;
+ }
}
NOTREACHED();
return false;

Powered by Google App Engine
This is Rietveld 408576698