summaryrefslogtreecommitdiffstats
path: root/webkit/glue/cpp_bound_class_unittest.cc
diff options
context:
space:
mode:
authordglazkov@chromium.org <dglazkov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-13 20:16:34 +0000
committerdglazkov@chromium.org <dglazkov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-13 20:16:34 +0000
commit55a75d99c6609ed4f6dc7052fcf3d907efaf7137 (patch)
tree39a50ac51abdbee695ce494cfecefbbebfb38248 /webkit/glue/cpp_bound_class_unittest.cc
parent4eeb018cc6f4b3a1d6715facaa3a3c54a22b4951 (diff)
downloadchromium_src-55a75d99c6609ed4f6dc7052fcf3d907efaf7137.zip
chromium_src-55a75d99c6609ed4f6dc7052fcf3d907efaf7137.tar.gz
chromium_src-55a75d99c6609ed4f6dc7052fcf3d907efaf7137.tar.bz2
Implement getter/setter-based bound properties for CppBoundClass.
This is necessary for AccessibilityController, which has non-trivial property accessors. R=darin BUG=10322 TEST=CppBoundClassTest.SetAndGetPropertiesWithCallbacks Review URL: http://codereview.chromium.org/243064 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28872 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/cpp_bound_class_unittest.cc')
-rw-r--r--webkit/glue/cpp_bound_class_unittest.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/webkit/glue/cpp_bound_class_unittest.cc b/webkit/glue/cpp_bound_class_unittest.cc
index a368e62..919ffc5 100644
--- a/webkit/glue/cpp_bound_class_unittest.cc
+++ b/webkit/glue/cpp_bound_class_unittest.cc
@@ -209,6 +209,25 @@ TEST_F(CppBoundClassTest, SetAndGetProperties) {
}
}
+TEST_F(CppBoundClassTest, SetAndGetPropertiesWithCallbacks) {
+ // TODO(dglazkov): fix NPObject issues around failing property setters and
+ // getters and add tests for situations when GetProperty or SetProperty fail.
+ std::string js = "var result = 'SUCCESS';\n"
+ "example.my_value_with_callback = 10;\n"
+ "if (example.my_value_with_callback != 10)\n"
+ " result = 'FAIL: unable to set property.';\n"
+ "example.my_value_with_callback = 11;\n"
+ "if (example.my_value_with_callback != 11)\n"
+ " result = 'FAIL: unable to set property again';\n"
+ "if (example.same != 42)\n"
+ " result = 'FAIL: same property should always be 42';\n"
+ "example.same = 24;\n"
+ "if (example.same != 42)\n"
+ " result = 'FAIL: same property should always be 42';\n"
+ "document.writeln(result);\n";
+ CheckJavaScriptSuccess(js);
+}
+
TEST_F(CppBoundClassTest, InvokeMethods) {
// The expression on the left is expected to return the value on the right.
static const std::string tests[] = {