Upstream version 7.35.144.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / elements / styles / set-property-boundaries.html
1 <html>
2 <head>
3
4 <style>
5 h1 {
6     color: red;
7 }
8 </style>
9
10 <script src="../../../http/tests/inspector/inspector-test.js"></script>
11 <script src="../../../http/tests/inspector/elements-test.js"></script>
12 <script>
13 function test()
14 {
15     WebInspector.inspectorView.showPanel("elements");
16     InspectorTest.nodeWithId("styler", onNodeLoaded);
17
18     function onNodeLoaded(node)
19     {
20         CSSAgent.getMatchedStylesForNode(node.id, onMatchedStyles);
21     }
22
23     function onMatchedStyles(error, matchedRules)
24     {
25         if (error) {
26             InspectorTest.addResult(error);
27             InspectorTest.completeTest();
28             return;
29         }
30         for(var i = 0; i < matchedRules.length; ++i) {
31             if (matchedRules[i].rule.origin !== "regular")
32                 continue;
33             editRule(matchedRules[i].rule);
34             return;
35         }
36         InspectorTest.addResult("Didn't find regular rule");
37         InspectorTest.completeTest();
38     }
39
40     function editRule(rule)
41     {
42         var style = rule.style;
43         InspectorTest.addResult(style.cssProperties[0].text);
44
45         const outOfBOundsRuleIndex = 10;
46         CSSAgent.setPropertyText(style.styleId, outOfBOundsRuleIndex, "color:blue;", true, dumpErrorMessage);
47     }
48
49     function dumpErrorMessage(error)
50     {
51         InspectorTest.addResult(error);
52         InspectorTest.completeTest();
53     }
54 }
55 </script>
56 </head>
57 <h1 id="styler"></h1>
58 <body onload="runTest()">
59 <p>
60 Tests that setting CSS property text out of boundaries does not crash.
61 </p>
62 </body>
63 </html>