summaryrefslogtreecommitdiffstats
path: root/ppapi/tests/test_var.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-05 23:52:49 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-05 23:52:49 +0000
commita4f10d1ed4c8921a2a47354f78753032d0b6a999 (patch)
treef45726ef6b68ea48e80f1996079bf7049fd71a96 /ppapi/tests/test_var.cc
parent4ccc9dd43bc25978691045cd4dba6664fd8afa1f (diff)
downloadchromium_src-a4f10d1ed4c8921a2a47354f78753032d0b6a999.zip
chromium_src-a4f10d1ed4c8921a2a47354f78753032d0b6a999.tar.gz
chromium_src-a4f10d1ed4c8921a2a47354f78753032d0b6a999.tar.bz2
Fix some egregious bugs in Var.
Self-assignment was broken and would lose the reference. I uncovered this when running a test. It outputted a warning to the console, but we never looked at it. I made a more explicit test. This also fixes output exceptions. The OutException helper class detected whether the existing object had an exception or not incorrectly. This was exposed when var assignment was fixed. TEST=included BUG=none Review URL: http://codereview.chromium.org/7511026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95690 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/tests/test_var.cc')
-rw-r--r--ppapi/tests/test_var.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/ppapi/tests/test_var.cc b/ppapi/tests/test_var.cc
index 3e15795..9e91dc4 100644
--- a/ppapi/tests/test_var.cc
+++ b/ppapi/tests/test_var.cc
@@ -64,6 +64,13 @@ std::string TestVar::TestBasicString() {
ASSERT_EQ(NULL, result);
}
+ // Make sure we can assign a C++ object to itself and it stays alive.
+ {
+ pp::Var a("test");
+ a = a;
+ ASSERT_TRUE(a.AsString() == "test");
+ }
+
// Make sure nothing leaked.
ASSERT_TRUE(testing_interface_->GetLiveObjectsForInstance(
instance_->pp_instance()) == before_object);