Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / runtime / runtime-getProperties.html
1 <html>
2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script>
5
6 var object1 = { get foo() { return 1; }, set foo(value) { } };
7 var object2 = { get foo() { return 1; } };
8
9 function test()
10 {
11     var obj1, obj2;
12
13     InspectorTest.runTestSuite([
14         function testSetUp(next)
15         {
16             InspectorTest.evaluateInPage("dumpObjects('Initial')", step0);
17
18             function step0()
19             {
20                 RuntimeAgent.evaluate("object1", step1);
21             }
22
23             function step1(error, result, wasThrown)
24             {
25                 obj1 = WebInspector.runtimeModel.createRemoteObject(result);
26                 RuntimeAgent.evaluate("object2", step2);
27             }
28
29             function step2(error, result, wasThrown)
30             {
31                 obj2 = WebInspector.runtimeModel.createRemoteObject(result);
32                 next();
33             }
34         },
35
36         function testGetterAndSetter(next)
37         {
38             obj1.getOwnProperties(step1);
39
40             function step1(properties)
41             {
42                 for (var i = 0; i < properties.length; ++i)
43                     dumpProperty(properties[i]);
44
45                 next();
46             }
47         },
48
49         function testGetterOnly(next)
50         {
51             obj2.getOwnProperties(step1);
52
53             function step1(properties)
54             {
55                 for (var i = 0; i < properties.length; ++i)
56                     dumpProperty(properties[i]);
57
58                 next();
59             }
60         }
61     ]);
62
63     function convertPropertyValueForTest(propertyObject, fieldName)
64     {
65         var value = propertyObject[fieldName];
66         if (value)
67             propertyObject[fieldName] = { type: value.type, description: value.description.replace("function foo", "function "), objectId: value.objectId };
68     }
69
70     function dumpProperty(property)
71     {
72         if (property.name === "__proto__")
73             return;
74
75         convertPropertyValueForTest(property, "value");
76         convertPropertyValueForTest(property, "getter");
77         convertPropertyValueForTest(property, "setter");
78         InspectorTest.dump(property, { objectId: "formatAsTypeName" });
79     }
80 }
81
82 </script>
83 </head>
84
85 <body onload="runTest()">
86 <p>
87 Tests RemoteObject.getProperties.
88 </p>
89
90 </body>
91 </html>