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

Unified Diff: ppapi/tests/test_var_deprecated.cc

Issue 6995083: Proxy PPB_Var, fix o-o-p string var id tracking. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated copyright header Created 9 years, 6 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/test_var.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/test_var_deprecated.cc
diff --git a/ppapi/tests/test_var_deprecated.cc b/ppapi/tests/test_var_deprecated.cc
index 7b77b18054446750dc49733726c19d8edfb11818..34309ee980d193dda18f2a3b456c702a9656c1e1 100644
--- a/ppapi/tests/test_var_deprecated.cc
+++ b/ppapi/tests/test_var_deprecated.cc
@@ -8,6 +8,7 @@
#include <limits>
+#include "base/basictypes.h"
#include "ppapi/c/pp_var.h"
#include "ppapi/c/dev/ppb_testing_dev.h"
#include "ppapi/c/dev/ppb_var_deprecated.h"
@@ -67,7 +68,7 @@ pp::Var VarScriptableObject::Call(const pp::Var& method_name,
REGISTER_TEST_CASE(VarDeprecated);
bool TestVarDeprecated::Init() {
- var_interface_ = reinterpret_cast<PPB_Var_Deprecated const*>(
+ var_interface_ = static_cast<const PPB_Var_Deprecated*>(
pp::Module::Get()->GetBrowserInterface(PPB_VAR_DEPRECATED_INTERFACE));
return var_interface_ && InitTestingInterface();
}
@@ -92,10 +93,10 @@ std::string TestVarDeprecated::TestBasicString() {
uint32_t before_object = testing_interface_->GetLiveObjectsForInstance(
instance_->pp_instance());
{
- const uint32_t kStrLen = 5;
- const char kStr[kStrLen + 1] = "Hello";
+ const char kStr[] = "Hello";
+ const uint32_t kStrLen(arraysize(kStr) - 1);
PP_Var str = var_interface_->VarFromUtf8(pp::Module::Get()->pp_module(),
- kStr, sizeof(kStr) - 1);
+ kStr, kStrLen);
ASSERT_EQ(PP_VARTYPE_STRING, str.type);
// Reading back the string should work.
@@ -106,15 +107,9 @@ std::string TestVarDeprecated::TestBasicString() {
// Destroy the string, readback should now fail.
var_interface_->Release(str);
- /*
- Note: this will crash in the current out-of-process implementation since
- we don't do actual tracking of strings (we just convert the ID to a
- pointer).
- TODO(brettw) This should be fixed and this checking code re-enabled.
result = var_interface_->VarToUtf8(str, &len);
ASSERT_EQ(0, len);
ASSERT_EQ(NULL, result);
- */
}
// Make sure nothing leaked.
@@ -157,7 +152,7 @@ std::string TestVarDeprecated::TestInvalidUtf8() {
static const char kSjisString[] = "utf8\x82\xb6\x82\xe1\x82\xc8\x82\xa2";
pp::Var sjis(kSjisString);
if (!sjis.is_null())
- return "Non-UTF8 string permitted.";
+ return "Non-UTF8 string was permitted erroneously.";
PASS();
}
« no previous file with comments | « ppapi/tests/test_var.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698