Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / sources / debugger / content-providers.html
1 <html>
2 <head>
3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4
5 <script>
6
7 function test()
8 {
9     function createMockScript(id, source, range)
10     {
11         range = range || [0, 0, 100, 0];
12         return {
13             requestContent: function(callback)
14             {
15                 callback(source);
16             },
17             get lineOffset() { return range[0]; },
18             get columnOffset() { return range[1]; },
19             get endLine() { return range[2]; },
20             get endColumn() { return range[3]; }
21         };
22     }
23
24     InspectorTest.runTestSuite([
25         function testConcatenatedScriptsContentProvider(next)
26         {
27             var scripts = [];
28             scripts.push(createMockScript("1", "\nfunction baz()\n{\n  return 0;\n}\n", [3, 20, 7, 0]));
29             scripts.push(createMockScript("2", "function foo() { return 0; }", [0, 10, 0, 38]));
30             scripts.push(createMockScript("3", "function bar() { return 0; }", [1, 70, 1, 98]));
31             scripts.push(createMockScript("4", "this should not appear in displayed content", [0, 20, 0, 63]));
32             var contentProvider = new WebInspector.ConcatenatedScriptsContentProvider(scripts);
33             function didRequestContent(content)
34             {
35                 InspectorTest.addResult(content);
36                 next();
37             }
38             contentProvider.requestContent(didRequestContent);
39         }
40     ]);
41 };
42
43 </script>
44
45 </head>
46
47 <body onload="runTest()">
48 <p>Tests ContentProvider implementations.</p>
49 </body>
50 </html>