summaryrefslogtreecommitdiffstats
path: root/content/browser/debugger/manual_tests/heap-profiler-test-snapshots-comparison.html
blob: 3a419d4e1b4fb885b3dc11ce1b5caa513ffa467a (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<html>
  <head>
    <title>Heap Profiler: heap snapshots comparison test</title>
    <script type="text/javascript">
      var aHolder = [], bHolder = [], cHolder = [], dHolder = [];

      function A(x) {
        this.x = x;
      }

      function B(x) {
        this.x = x;
      }

      function C() {}

      var i;
      for (i = 0; i < 100; ++i) {
        var b = new B('hello');
        bHolder.push(b);
        aHolder.push(new A(b));
        b = null;
      }
      for (i = 0; i < 25; ++i) {
        cHolder.push(new C());
      }

      function D() {}

      function changeStuff() {
        if (aHolder.length > 0) {
          aHolder.splice(aHolder.length - 25, 25);
        }
        for (i = 0; i < 25; ++i) {
          bHolder.push(new B('hello'));
        }
        cHolder = [];
        for (i = 0; i < 25; ++i) {
          dHolder.push(new D());
        }
      }
    </script>
  </head>
  <body>
    This is the test for heap snapshot comparison functionality.
    <br>
    <br>
    To use this test:
    <ul>
      <li>load file in the browser;
      <li>open DevTools (Ctrl+Shift+I on Win/Linux, Command+Option+I on Mac);
      <li>go to 'Profiles' page;
      <li>press 'Take heap snapshot' button
        (eye icon on the left side of the status bar);
      <li>press
        <input type="button" name="changeStuff" value="this button" onclick="changeStuff()" />;
      <li>press 'Take heap snapshot' button again;
    </ul>
    <br>
    On the left pane under 'Heap snapshots' section, items called
    'Snapshot 1' and 'Snapshot 2' must appear. Select 'Snapshot 2'. 
    Ensure that absolute values are shown (not percents).
    <br>
    <br>
    TEST 1. Verify the following:
    <ul>
      <li>the value in '+/- Count' column for 'A' must be '-25';
      <li>after expanding 'A' item, the value in '+/- Count' column
        for 'Array' child entry must also be '-25';
      <li>the value in '+/- Count' column for 'B' must be '+25';
      <li>after expanding 'B' item, the value in '+/- Count' column
        for 'Array' child entry must also be '+25'; the value for 'A'
        child must be '-25';
    </ul>
    <br>
    TEST 2. Change display to percent view (using the percent button on the
    status bar). Verify the following:
    <ul>
      <li>values in '+/- Count' and '+/- Size' columns for 'C' must be 'deleted';
      <li>values in '+/- Count' and '+/- Size' columns for 'D' must be 'new';
    </ul>
  </body>
</html>