Commit e7e02345 authored by chrishenry@google.com's avatar chrishenry@google.com

Add ForceGarbageCollection and PauseInteractive to ActionRunner

(previously JsCollectGarbageAction and InteractAction).

BUG=361809

Review URL: https://codereview.chromium.org/338883005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277975 0039d316-1c4b-4281-b951-d872f2087c98
parent b6432287
......@@ -32,7 +32,7 @@ class GmailPage(MobileMemoryPage):
def ReloadAndGc(self, action_runner):
action_runner.RunAction(ReloadAction())
action_runner.Wait(15)
action_runner.RunAction(JsCollectGarbageAction())
action_runner.ForceGarbageCollection()
def RunStressMemory(self, action_runner):
for _ in xrange(3):
......
......@@ -18,7 +18,7 @@ class Top2012Q3Page(page.Page):
def ReloadAndGc(self, action_runner):
action_runner.RunAction(ReloadAction())
action_runner.Wait(1)
action_runner.RunAction(JsCollectGarbageAction())
action_runner.ForceGarbageCollection()
def RunSmoothness(self, action_runner):
action_runner.RunAction(ScrollAction())
......
......@@ -238,6 +238,19 @@ class ActionRunner(object):
left_start_ratio=left_start_ratio, top_start_ratio=top_start_ratio,
direction=direction, distance=distance, speed=speed))
def ForceGarbageCollection(self):
"""Forces JavaScript garbage collection on the page."""
self._tab.CollectGarbage()
def PauseInteractive(self):
"""Pause the page execution and wait for terminal interaction.
This is typically used for debugging. You can use this to pause
the page execution and inspect the browser state before
continuing.
"""
raw_input("Interacting... Press Enter to continue.")
class Interaction(object):
......
......@@ -10,8 +10,6 @@ from telemetry.page.actions import page_action
# pylint: disable=W0611
# TODO(nednguyen): Remove all of these imports when we done porting all actions
# to action_runner
from telemetry.page.actions.interact import InteractAction
from telemetry.page.actions.js_collect_garbage import JsCollectGarbageAction
from telemetry.page.actions.loop import LoopAction
from telemetry.page.actions.media_action import MediaAction
from telemetry.page.actions.pinch import PinchAction
......
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page.actions import page_action
class InteractAction(page_action.PageAction):
def __init__(self, attributes=None):
super(InteractAction, self).__init__(attributes)
def RunAction(self, tab):
raw_input("Interacting... Press Enter to continue.")
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page.actions import page_action
class JsCollectGarbageAction(page_action.PageAction):
def __init__(self, attributes=None):
super(JsCollectGarbageAction, self).__init__(attributes)
def RunAction(self, tab):
tab.CollectGarbage()
......@@ -6,7 +6,6 @@ from telemetry.core import command_line
from telemetry.page import test_expectations
from telemetry.page.actions import action_runner as action_runner_module
from telemetry.page.actions import interact
class Failure(Exception):
......@@ -239,7 +238,7 @@ class PageTest(command_line.Command):
action_runner = action_runner_module.ActionRunner(tab)
self.WillRunActions(page, tab)
if interactive:
action_runner.RunAction(interact.InteractAction())
action_runner.PauseInteractive()
else:
self._RunMethod(page, self._action_name_to_run, action_runner)
self.DidRunActions(page, tab)
......
......@@ -19,7 +19,6 @@ from telemetry.page import page_test
from telemetry.page import profile_creator
from telemetry.page import test_expectations
from telemetry.page.actions import action_runner as action_runner_module
from telemetry.page.actions import interact
from telemetry.results import page_measurement_results
......@@ -70,7 +69,7 @@ class RecordPage(page_test.PageTest): # pylint: disable=W0223
self.RunNavigateSteps(page, tab)
action_runner = action_runner_module.ActionRunner(tab)
if interactive:
action_runner.RunAction(interact.InteractAction())
action_runner.PauseInteractive()
else:
self._RunMethod(page, action_name, action_runner)
should_reload = True
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment