Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / tools / telemetry / telemetry / core / backends / chrome / inspector_memory_unittest.py
1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 from telemetry import benchmark
6 from telemetry.unittest import tab_test_case
7
8
9 class InspectorMemoryTest(tab_test_case.TabTestCase):
10
11   @benchmark.Enabled('has tabs')
12   @benchmark.Disabled  # http://crbug.com/422244
13   def testGetDOMStats(self):
14     # Due to an issue with CrOS, we create a new tab here rather than
15     # using the existing tab to get a consistent starting page on all platforms.
16     self._tab = self._browser.tabs.New()
17
18     self.Navigate('dom_counter_sample.html')
19
20     # Document_count > 1 indicates that WebCore::Document loaded in Chrome
21     # is leaking! The baseline should exactly match the numbers on:
22     # unittest_data/dom_counter_sample.html
23     # Please contact kouhei@, hajimehoshi@ when rebaselining.
24     counts = self._tab.dom_stats
25     self.assertEqual(counts['document_count'], 1,
26         'Document leak is detected! '+
27         'The previous document is likely retained unexpectedly.')
28     self.assertEqual(counts['node_count'], 14,
29         'Node leak is detected!')
30     self.assertEqual(counts['event_listener_count'], 2,
31         'EventListener leak is detected!')