summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/inspector/user-metrics.html
blob: 44bbe71bffb3eb098fae8056903e601a40fd122e (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
55
56
57
58
59
60
61
62
<html>
<head>
<script src="../http/tests/inspector/inspector-test.js"></script>
<script>

function test()
{
    InspectorFrontendHost.recordActionTaken = function(actionCode)
    {
        InspectorTest.addResult("Action taken: " + nameOf(WebInspector.UserMetrics._ActionCodes, actionCode));
    }

    InspectorFrontendHost.recordPanelShown = function(panelCode)
    {
        InspectorTest.addResult("Panel shown: " + nameOf(WebInspector.UserMetrics._PanelCodes, panelCode));
    }

    InspectorFrontendHost.recordSettingChanged = function(settingCode)
    {
        InspectorTest.addResult("Setting changed: " + nameOf(WebInspector.UserMetrics._SettingCodes, settingCode));
    }

    function nameOf(object, code)
    {
        for (var name in object) {
            if (object[name] === code)
                return name;
        }
        return null;
    }

    InspectorTest.addResult("recordActionTaken:");
    InspectorTest.dump(WebInspector.UserMetrics._ActionCodes);
    WebInspector.userMetrics.WindowDocked.record();
    WebInspector.userMetrics.WindowUndocked.record();

    InspectorTest.addResult("\nrecordPanelShown:");
    InspectorTest.dump(WebInspector.UserMetrics._PanelCodes);
    WebInspector.showPanel("profiles");
    WebInspector.showPanel("timeline");
    WebInspector.showPanel("audits");

    InspectorTest.addResult("\nrecordSettingChanged:");
    InspectorTest.dump(WebInspector.UserMetrics._SettingCodes);
    WebInspector.settings.monitoringXHREnabled.set(true);
    WebInspector.settings.monitoringXHREnabled.set(false);
    WebInspector.settings.preserveConsoleLog.set(true);
    WebInspector.settings.preserveConsoleLog.set(false);
    WebInspector.settings.resourcesLargeRows.set(false);
    WebInspector.settings.resourcesLargeRows.set(true);

    InspectorTest.completeTest();
}

</script>
</head>

<body onload="runTest()">
<p>Tests list of user metrics codes and invocations.</p>

</body>
</html>