3 <script src=
"../../http/tests/inspector/inspector-test.js"></script>
6 var object1
= { foo
: 1 };
7 var object2
= { bar
: 2 };
9 function dumpObject(label
)
11 console
.log("===== " + label
+ " =====");
12 console
.log(JSON
.stringify(object1
, replacer
));
15 function replacer(key
, value
)
17 if (typeof value
=== "number" && !isFinite(value
))
23 function checkNegativeZero()
25 console
.log("===== Checking negative zero =====");
26 console
.log("1/-0 = " + (1 / object1
.foo
));
32 var nameFoo
= WebInspector
.RemoteObject
.toCallArgument("foo");
34 InspectorTest
.runTestSuite([
35 function testSetUp(next
)
37 InspectorTest
.evaluateInPage("dumpObject('Initial')", step0
);
41 InspectorTest
.RuntimeAgent
.evaluate("object1", step1
);
44 function step1(error
, result
, wasThrown
)
46 obj1
= InspectorTest
.runtimeModel
.createRemoteObject(result
);
47 InspectorTest
.RuntimeAgent
.evaluate("object2", step2
);
50 function step2(error
, result
, wasThrown
)
52 obj2
= InspectorTest
.runtimeModel
.createRemoteObject(result
);
57 function testSetPrimitive(next
)
59 obj1
.setPropertyValue(nameFoo
, "2", step1
);
63 InspectorTest
.evaluateInPage("dumpObject('Set primitive')", next
);
67 function testSetHandle(next
)
69 obj1
.setPropertyValue(nameFoo
, "object2", step1
);
73 InspectorTest
.evaluateInPage("dumpObject('Set handle')", next
);
77 function testSetUndefined(next
)
79 obj1
.setPropertyValue(nameFoo
, "undefined", step1
);
83 InspectorTest
.evaluateInPage("dumpObject('Set undefined')", next
);
87 function testSetZero(next
)
89 obj1
.setPropertyValue(nameFoo
, "0", step1
);
93 InspectorTest
.evaluateInPage("dumpObject('Set zero')", next
);
97 function testSetNull(next
)
99 obj1
.setPropertyValue(nameFoo
, "null", step1
);
103 InspectorTest
.evaluateInPage("dumpObject('Set null')", next
);
107 function testSetEmptyString(next
)
109 obj1
.setPropertyValue(nameFoo
, "\"\"", step1
);
113 InspectorTest
.evaluateInPage("dumpObject('Set empty string')", next
);
117 function testSetException(next
)
119 obj1
.setPropertyValue(nameFoo
, "throw 'exception'", step1
);
121 function step1(error
)
123 InspectorTest
.addResult(error
);
124 InspectorTest
.evaluateInPage("dumpObject('Set exception')", next
);
128 function testSetNonFiniteNumbers(next
)
130 obj1
.setPropertyValue(nameFoo
, "NaN", step1
);
132 function step1(error
)
134 obj1
.setPropertyValue(WebInspector
.RemoteObject
.toCallArgument("foo1"), "Infinity", step2
);
137 function step2(error
)
139 obj1
.setPropertyValue(WebInspector
.RemoteObject
.toCallArgument("foo2"), "-Infinity", step3
);
142 function step3(error
)
144 InspectorTest
.evaluateInPage("dumpObject('Set non-finite numbers')", next
);
148 function testNegativeZero(next
)
150 obj1
.setPropertyValue(nameFoo
, "1/-Infinity", step1
);
152 function step1(error
)
154 InspectorTest
.evaluateInPage("checkNegativeZero()", next
);
158 function testReleaseObjectIsCalled(next
)
160 // If failed, this test will time out.
161 InspectorTest
.addSniffer(InspectorTest
.RuntimeAgent
, "releaseObject", next
);
162 obj1
.setPropertyValue(nameFoo
, "[1,2,3]", function(){});
170 <body onload=
"runTest()">
172 Tests WebInspector.RemoveObject.setPropertyValue implementation.