summaryrefslogtreecommitdiffstats
path: root/webkit/glue/cpp_bound_class_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'webkit/glue/cpp_bound_class_unittest.cc')
-rw-r--r--webkit/glue/cpp_bound_class_unittest.cc27
1 files changed, 25 insertions, 2 deletions
diff --git a/webkit/glue/cpp_bound_class_unittest.cc b/webkit/glue/cpp_bound_class_unittest.cc
index b080478..1f412cc 100644
--- a/webkit/glue/cpp_bound_class_unittest.cc
+++ b/webkit/glue/cpp_bound_class_unittest.cc
@@ -17,9 +17,21 @@
namespace {
+class CppBindingExampleSubObject : public CppBindingExample {
+ public:
+ CppBindingExampleSubObject() {
+ sub_value_.Set("sub!");
+ BindProperty("sub_value", &sub_value_);
+ }
+ private:
+ CppVariant sub_value_;
+};
+
+
class CppBindingExampleWithOptionalFallback : public CppBindingExample {
public:
CppBindingExampleWithOptionalFallback() {
+ BindProperty("sub_object", sub_object_.GetAsCppVariant());
}
void set_fallback_method_enabled(bool state) {
@@ -30,9 +42,11 @@ class CppBindingExampleWithOptionalFallback : public CppBindingExample {
// The fallback method does nothing, but because of it the JavaScript keeps
// running when a nonexistent method is called on an object.
- void fallbackMethod(const CppArgumentList& args,
- CppVariant* result) {
+ void fallbackMethod(const CppArgumentList& args, CppVariant* result) {
}
+
+ private:
+ CppBindingExampleSubObject sub_object_;
};
class ExampleTestShell : public TestShell {
@@ -158,6 +172,15 @@ TEST_F(CppBoundClassTest, PropertiesAreInitialized) {
CheckJavaScriptSuccess(js);
}
+TEST_F(CppBoundClassTest, SubOject) {
+ std::string js = BuildJSCondition("typeof window.example.sub_object",
+ "'object'");
+ CheckJavaScriptSuccess(js);
+
+ js = BuildJSCondition("example.sub_object.sub_value", "'sub!'");
+ CheckJavaScriptSuccess(js);
+}
+
TEST_F(CppBoundClassTest, SetAndGetProperties) {
// The property on the left will be set to the value on the right, then
// checked to make sure it holds that same value.