diff options
author | dennisjeffrey@chromium.org <dennisjeffrey@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-18 18:47:27 +0000 |
---|---|---|
committer | dennisjeffrey@chromium.org <dennisjeffrey@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-18 18:47:27 +0000 |
commit | ee8edb8e7fa4bf32ba1e17ec7470cdf5527d2cc5 (patch) | |
tree | 1e0c1b73cc75a8190edd1531c0032606fa5a0859 /chrome/test/functional | |
parent | 8c1b235fe3a7bb9554e4b0065ec2907382d258f7 (diff) | |
download | chromium_src-ee8edb8e7fa4bf32ba1e17ec7470cdf5527d2cc5.zip chromium_src-ee8edb8e7fa4bf32ba1e17ec7470cdf5527d2cc5.tar.gz chromium_src-ee8edb8e7fa4bf32ba1e17ec7470cdf5527d2cc5.tar.bz2 |
Remove class MemoryBloatTest from pyauto test file perf.py.
This class is being removed in favor of class ChromeEndureGmailTest
in file perf_endure.py.
BUG=None
TEST=None
Review URL: https://chromiumcodereview.appspot.com/9251003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118115 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/functional')
-rwxr-xr-x | chrome/test/functional/perf.py | 149 |
1 files changed, 0 insertions, 149 deletions
diff --git a/chrome/test/functional/perf.py b/chrome/test/functional/perf.py index 858b655..0247c57 100755 --- a/chrome/test/functional/perf.py +++ b/chrome/test/functional/perf.py @@ -1156,155 +1156,6 @@ class ScrollTest(BasePerfTest): 'ScrollGooglePlusPage') -class MemoryBloatTest(BasePerfTest): - """Tests to analyze memory bloat in webapps.""" - - def setUp(self): - BasePerfTest.setUp(self) - - # Set up an object that takes v8 heap snapshots of the first opened tab - # (index 0). - self._snapshotter = perf_snapshot.PerformanceSnapshotter() - self._snapshot_results = [] - - def ExtraChromeFlags(self): - """Ensures Chrome is launched with custom flags. - - Returns: - A list of extra flags to pass to Chrome when it is launched. - """ - # Ensure Chrome enables remote debugging on port 9222. This is required to - # take v8 heap snapshots of tabs in Chrome. - return (super(MemoryBloatTest, self).ExtraChromeFlags() + - ['--remote-debugging-port=9222']) - - def _TakeHeapSnapshot(self): - """Takes a v8 heap snapshot using |self._snapshotter| and stores the result. - - This function will fail the current test if no snapshot can be taken. - - Returns: - The number of seconds it took to take the heap snapshot. - """ - start_time = time.time() - snapshot = self._snapshotter.HeapSnapshot() - elapsed_time = time.time() - start_time - self.assertTrue(snapshot, msg='Failed to take a v8 heap snapshot.') - self._snapshot_results.append(snapshot[0]) - return elapsed_time - - # TODO(dennisjeffrey): Remove this test once pyauto test - # perf_endure.ChromeEndureGmailTest.testGmailComposeDiscard starts running - # continuously. - def GmailBloat(self): - """Interact with Gmail while periodically taking v8 heap snapshots. - - This test is currently not enabled by default. It must be run manually. - """ - # The following cannot yet be imported on ChromeOS. - import selenium.common.exceptions - from selenium.webdriver.support.ui import WebDriverWait - - # Log into a test Google account and open up Gmail. - self._LoginToGoogleAccount() - self.NavigateToURL('http://www.gmail.com') - loaded_tab_title = self.GetActiveTabTitle() - self.assertTrue(loaded_tab_title.find('Gmail') >= 0, - msg='Loaded tab title does not contain "Gmail": "%s"' % - loaded_tab_title) - - driver = self.NewWebDriver() - # Any call to wait.until() will raise an exception if the timeout is hit. - wait = WebDriverWait(driver, timeout=60) - - def _SwitchToCanvasFrame(driver): - """Switch the WebDriver to Gmail's 'canvas_frame', if it's available. - - Args: - driver: A selenium.webdriver.remote.webdriver.WebDriver object. - - Returns: - True, if the switch to Gmail's 'canvas_frame' is successful, or - False if not. - """ - try: - driver.switch_to_frame('canvas_frame') - return True - except selenium.common.exceptions.NoSuchFrameException: - return False - - def _GetElement(find_by, value): - """Gets a WebDriver element object from the webpage DOM. - - Args: - find_by: A callable that queries WebDriver for an element from the DOM. - value: A string value that can be passed to the |find_by| callable. - - Returns: - The identified WebDriver element object, if found in the DOM, or - None if the element cannot be found. - """ - try: - return find_by(value) - except selenium.common.exceptions.NoSuchElementException: - return None - - # Wait until Gmail's 'canvas_frame' loads and the 'Inbox' link is present. - # TODO(dennisjeffrey): Check with the Gmail team to see if there's a better - # way to tell when the webpage is ready for user interaction. - wait.until(_SwitchToCanvasFrame) # Raises exception if the timeout is hit. - # Wait for the inbox to appear. - wait.until(lambda _: _GetElement( - driver.find_element_by_partial_link_text, 'Inbox')) - - # Interact with Gmail for awhile. Here, we repeat the following sequence of - # interactions: click the "Compose" button, enter some text into the "To" - # field, enter some text into the "Subject" field, then click the "Discard" - # button to discard the message. - num_iterations = 5 - for i in xrange(num_iterations): - logging.info('Chrome interaction iteration %d of %d.' % ( - i + 1, num_iterations)) - - compose_button = wait.until(lambda _: _GetElement( - driver.find_element_by_xpath, - '//div[text()="COMPOSE"]')) - compose_button.click() - - to_field = wait.until(lambda _: _GetElement( - driver.find_element_by_name, 'to')) - to_field.send_keys('nobody@nowhere.com') - - subject_field = wait.until(lambda _: _GetElement( - driver.find_element_by_name, 'subject')) - subject_field.send_keys('This message is about to be discarded') - - discard_button = wait.until(lambda _: _GetElement( - driver.find_element_by_xpath, - '//div[text()="Discard"]')) - discard_button.click() - - # Wait for the message to be discarded, assumed to be true after the - # "To" field is removed from the webpage DOM. - wait.until(lambda _: not _GetElement( - driver.find_element_by_name, 'to')) - - logging.info('Taking heap snapshot...') - sec_to_snapshot = self._TakeHeapSnapshot() - logging.info('Snapshot taken (%.2f sec).' % sec_to_snapshot) - - # Output the snapshot results. - assert len(self._snapshot_results) >= 1 - base_timestamp = self._snapshot_results[0]['timestamp'] - for snapshot_info in self._snapshot_results: - logging.info('Snapshot time: %.2f sec' % ( - snapshot_info['timestamp'] - base_timestamp)) - logging.info(' Total heap size: %.2f MB' % ( - snapshot_info['total_heap_size'] / (1024.0 * 1024.0))) - logging.info(' Total node count: %d nodes' % ( - snapshot_info['total_node_count'])) - - class FlashTest(BasePerfTest): """Tests to measure flash performance.""" |