diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-09 23:14:13 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-09 23:14:13 +0000 |
commit | 2bbd2c670008e30aaaef6c3c25ae37e0c17f8c3f (patch) | |
tree | 79595eeb026dd29841a7380fd7753f992c2e466b /ppapi/tests | |
parent | 32131b9030d8313f7adc9b765f706ffbee7ca709 (diff) | |
download | chromium_src-2bbd2c670008e30aaaef6c3c25ae37e0c17f8c3f.zip chromium_src-2bbd2c670008e30aaaef6c3c25ae37e0c17f8c3f.tar.gz chromium_src-2bbd2c670008e30aaaef6c3c25ae37e0c17f8c3f.tar.bz2 |
Unify var tracking between webkit and the proxy.
This replaces the var tracking in the proxy with the var tracking in the
shared_impl that's used by the implementation. It adds a new ProxyObjectVar
to be the proxied plugin analog of NPObjectVar in the impl. This new object
just keeps track of the host data.
The tricky part is to make the var tracker able to do all the crazy messaging.
This adds some virtual functions to the shared var tracker that we override
in the plugin in PluginVarTracker.
This removes the calls to the GetLiveObjectsForInstance in the var deprecated
test. It turns out this function really can't be implemented properly in the
proxy, and I don't know why it even worked before. A Release() call posts a
non-nestable task so the object isn't released until later. So to implement
the proxy for GetLiveObjectsForInstance we would also need to post a
non-nestable task. But when the test runs we're getting called from within
the plugin, so blocking on a non-nestable task deadlocks. So I just gave up
and deleted the parts of the test that uses it.
TEST=included
BUG=none
Review URL: http://codereview.chromium.org/7578001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96094 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/tests')
-rw-r--r-- | ppapi/tests/test_var_deprecated.cc | 132 |
1 files changed, 62 insertions, 70 deletions
diff --git a/ppapi/tests/test_var_deprecated.cc b/ppapi/tests/test_var_deprecated.cc index 07ccf91..253058d 100644 --- a/ppapi/tests/test_var_deprecated.cc +++ b/ppapi/tests/test_var_deprecated.cc @@ -294,78 +294,70 @@ std::string TestVarDeprecated::TestVarToUtf8ForWrongType() { } std::string TestVarDeprecated::TestHasPropertyAndMethod() { - uint32_t before_objects = testing_interface_->GetLiveObjectsForInstance( - instance_->pp_instance()); - { - pp::VarPrivate window = instance_->GetWindowObject(); - ASSERT_TRUE(window.is_object()); - - // Regular property. - pp::Var exception; - ASSERT_TRUE(window.HasProperty("scrollX", &exception)); - ASSERT_TRUE(exception.is_undefined()); - ASSERT_FALSE(window.HasMethod("scrollX", &exception)); - ASSERT_TRUE(exception.is_undefined()); - - // Regular method (also counts as HasProperty). - ASSERT_TRUE(window.HasProperty("find", &exception)); - ASSERT_TRUE(exception.is_undefined()); - ASSERT_TRUE(window.HasMethod("find", &exception)); - ASSERT_TRUE(exception.is_undefined()); - - // Nonexistant ones should return false and not set the exception. - ASSERT_FALSE(window.HasProperty("superEvilBit", &exception)); - ASSERT_TRUE(exception.is_undefined()); - ASSERT_FALSE(window.HasMethod("superEvilBit", &exception)); - ASSERT_TRUE(exception.is_undefined()); - - // Check exception and return false on invalid property name. - ASSERT_FALSE(window.HasProperty(3.14159, &exception)); - ASSERT_FALSE(exception.is_undefined()); - exception = pp::Var(); - - exception = pp::Var(); - ASSERT_FALSE(window.HasMethod(3.14159, &exception)); - ASSERT_FALSE(exception.is_undefined()); - - // Try to use something not an object. - exception = pp::Var(); - pp::VarPrivate string_object("asdf"); - ASSERT_FALSE(string_object.HasProperty("find", &exception)); - ASSERT_FALSE(exception.is_undefined()); - exception = pp::Var(); - ASSERT_FALSE(string_object.HasMethod("find", &exception)); - ASSERT_FALSE(exception.is_undefined()); - - // Try to use an invalid object (need to use the C API). - PP_Var invalid_object; - invalid_object.type = PP_VARTYPE_OBJECT; - invalid_object.value.as_id = static_cast<int64_t>(-1234567); - PP_Var exception2 = PP_MakeUndefined(); - ASSERT_FALSE(var_interface_->HasProperty(invalid_object, - pp::Var("find").pp_var(), - &exception2)); - ASSERT_NE(PP_VARTYPE_UNDEFINED, exception2.type); - var_interface_->Release(exception2); - - exception2 = PP_MakeUndefined(); - ASSERT_FALSE(var_interface_->HasMethod(invalid_object, + pp::VarPrivate window = instance_->GetWindowObject(); + ASSERT_TRUE(window.is_object()); + + // Regular property. + pp::Var exception; + ASSERT_TRUE(window.HasProperty("scrollX", &exception)); + ASSERT_TRUE(exception.is_undefined()); + ASSERT_FALSE(window.HasMethod("scrollX", &exception)); + ASSERT_TRUE(exception.is_undefined()); + + // Regular method (also counts as HasProperty). + ASSERT_TRUE(window.HasProperty("find", &exception)); + ASSERT_TRUE(exception.is_undefined()); + ASSERT_TRUE(window.HasMethod("find", &exception)); + ASSERT_TRUE(exception.is_undefined()); + + // Nonexistant ones should return false and not set the exception. + ASSERT_FALSE(window.HasProperty("superEvilBit", &exception)); + ASSERT_TRUE(exception.is_undefined()); + ASSERT_FALSE(window.HasMethod("superEvilBit", &exception)); + ASSERT_TRUE(exception.is_undefined()); + + // Check exception and return false on invalid property name. + ASSERT_FALSE(window.HasProperty(3.14159, &exception)); + ASSERT_FALSE(exception.is_undefined()); + exception = pp::Var(); + + exception = pp::Var(); + ASSERT_FALSE(window.HasMethod(3.14159, &exception)); + ASSERT_FALSE(exception.is_undefined()); + + // Try to use something not an object. + exception = pp::Var(); + pp::VarPrivate string_object("asdf"); + ASSERT_FALSE(string_object.HasProperty("find", &exception)); + ASSERT_FALSE(exception.is_undefined()); + exception = pp::Var(); + ASSERT_FALSE(string_object.HasMethod("find", &exception)); + ASSERT_FALSE(exception.is_undefined()); + + // Try to use an invalid object (need to use the C API). + PP_Var invalid_object; + invalid_object.type = PP_VARTYPE_OBJECT; + invalid_object.value.as_id = static_cast<int64_t>(-1234567); + PP_Var exception2 = PP_MakeUndefined(); + ASSERT_FALSE(var_interface_->HasProperty(invalid_object, pp::Var("find").pp_var(), &exception2)); - ASSERT_NE(PP_VARTYPE_UNDEFINED, exception2.type); - var_interface_->Release(exception2); - - // Get a valid property/method when the exception is set returns false. - exception = pp::Var("Bad something-or-other exception"); - ASSERT_FALSE(window.HasProperty("find", &exception)); - ASSERT_FALSE(exception.is_undefined()); - ASSERT_FALSE(window.HasMethod("find", &exception)); - ASSERT_FALSE(exception.is_undefined()); - } - - // Make sure nothing leaked. - ASSERT_TRUE(testing_interface_->GetLiveObjectsForInstance( - instance_->pp_instance()) == before_objects); + ASSERT_NE(PP_VARTYPE_UNDEFINED, exception2.type); + var_interface_->Release(exception2); + + exception2 = PP_MakeUndefined(); + ASSERT_FALSE(var_interface_->HasMethod(invalid_object, + pp::Var("find").pp_var(), + &exception2)); + ASSERT_NE(PP_VARTYPE_UNDEFINED, exception2.type); + var_interface_->Release(exception2); + + // Getting a valid property/method when the exception is set returns false. + exception = pp::Var("Bad something-or-other exception"); + ASSERT_FALSE(window.HasProperty("find", &exception)); + ASSERT_FALSE(exception.is_undefined()); + ASSERT_FALSE(window.HasMethod("find", &exception)); + ASSERT_FALSE(exception.is_undefined()); PASS(); } |