Upstream version 5.34.98.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / 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
14 function test()
15 {
16     WebInspector.showPanel("elements");
17     CSSAgent.getAllStyleSheets(styleSheetInfosLoaded);
18
19     function styleSheetInfosLoaded(error, infos)
20     {
21         if (error) {
22             InspectorTest.addResult("error: " + error);
23             InspectorTest.completeTest();
24             return;
25         }
26
27         for (var i = 0; i < infos.length; ++i)
28             CSSAgent.getStyleSheet(infos[i].styleSheetId, styleSheetLoaded);
29     }
30
31     function styleSheetLoaded(error, styleSheet)
32     {
33         if (error) {
34             InspectorTest.addResult("error: " + error);
35             InspectorTest.completeTest();
36             return;
37         }
38         editRule(styleSheet.rules[0]);
39     }
40
41     function editRule(rule)
42     {
43         var style = rule.style;
44         InspectorTest.addResult(style.cssProperties[0].text);
45
46         const outOfBOundsRuleIndex = 10;
47         CSSAgent.setPropertyText(style.styleId, outOfBOundsRuleIndex, "color:blue;", true, dumpErrorMessage);
48     }
49
50     function dumpErrorMessage(error)
51     {
52         InspectorTest.addResult(error);
53         InspectorTest.completeTest();
54     }   
55 }
56 </script>
57 </head>
58
59 <body onload="runTest()">
60 <p>
61 Tests that setting CSS property text out of boundaries does not crash.
62 </p>
63 </body>
64 </html>