summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/inspector/script-execution-state-change-notification.html
blob: 84f2bd82327767a4b93b84e0d8572b84d68cca71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<html>
<head>
<script src="../http/tests/inspector/inspector-test.js"></script>
<script>

function enableJavaScriptForPage()
{
    if (window.testRunner)
        testRunner.overridePreference("WebKitJavaScriptEnabled", true);
}

function disableJavaScriptForPage()
{
    if (window.testRunner)
        testRunner.overridePreference("WebKitJavaScriptEnabled", false);
}

function test()
{
    function scriptsEnabled(isEnabled)
    {
        InspectorTest.addResult("PageDispatcher.scriptsEnabled should be invoked with isEnabled=" + isEnabled);
    }

    function disableJavaScriptTest()
    {
        InspectorTest.addResult("running disableJavaScriptTest...");
        InspectorTest.evaluateInPage("disableJavaScriptForPage();", enableJavaScriptTest);
    }

    function enableJavaScriptTest()
    {
        InspectorTest.addResult("running enableJavaScriptTest...");
        InspectorTest.evaluateInPage("enableJavaScriptForPage();", finish);
    }

    function finish()
    {
        InspectorTest.addResult("Finished verification.")
        InspectorTest.completeTest();
    }

    InspectorTest.addSniffer(WebInspector.PageDispatcher.prototype, "scriptsEnabled", scriptsEnabled, true);
    InspectorTest.addResult("Registered PageDispatcher.scriptsEnabled()");
    disableJavaScriptTest();
}
</script>
</head>

<body onload="runTest()">
<p>Tests that whenever Script Execution state is changed outside inspector, its notified to the Inspector front-end.</p>
</body>
</html>