summaryrefslogtreecommitdiffstats
path: root/ppapi/tests/test_var_deprecated.cc
diff options
context:
space:
mode:
authordmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-08 20:22:02 +0000
committerdmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-08 20:22:02 +0000
commit0925622c1495325dfe3d3b25273f4439361936bc (patch)
treed84e13ff0c89660b3c0353095a59e296f3582ccb /ppapi/tests/test_var_deprecated.cc
parent67b85487bf8e376297a8cc0cbf5fa3f0fa1d078b (diff)
downloadchromium_src-0925622c1495325dfe3d3b25273f4439361936bc.zip
chromium_src-0925622c1495325dfe3d3b25273f4439361936bc.tar.gz
chromium_src-0925622c1495325dfe3d3b25273f4439361936bc.tar.bz2
Proxy PPB_Var, fix o-o-p string var id tracking.
Note this doesn't need to use IPC at all, so it's a little strange. Made test for pp::Var/PPB_Var that does only strings (copied from test_var_deprecated.cc). Fixed string var tracking so test can pass out-of-process (aside from invalid UTF8 checking, which is still not implemented o-o-p). BUG=85236 TEST=test_var.cc, run tests manually out-of-process. Review URL: http://codereview.chromium.org/6995083 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88384 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/tests/test_var_deprecated.cc')
-rw-r--r--ppapi/tests/test_var_deprecated.cc17
1 files changed, 6 insertions, 11 deletions
diff --git a/ppapi/tests/test_var_deprecated.cc b/ppapi/tests/test_var_deprecated.cc
index 7b77b18..34309ee 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();
}