small_profile_creator.py revision 58537e28ecd584eab876aee8be7156509866d23a
190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)# Copyright (c) 2013 The Chromium Authors. All rights reserved. 290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)# Use of this source code is governed by a BSD-style license that can be 390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)# found in the LICENSE file. 490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)import os 690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 7424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)from telemetry.core import util 890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)from telemetry.page import page_set 9424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)from telemetry.page import profile_creator 1090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 1190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)class SmallProfileCreator(profile_creator.ProfileCreator): 1290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) """ 1390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) Runs a browser through a series of operations to fill in a small test profile. 1490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) """ 1590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 16424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) def __init__(self): 17424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) super(SmallProfileCreator, self).__init__() 18424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) top_25 = os.path.join(util.GetBaseDir(), 'page_sets', 'top_25.json') 19424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) self._page_set = page_set.PageSet.FromFile(top_25) 20424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 21424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) def MeasurePage(self, _, tab, results): 22424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) # Multiple tabs would help make this faster, but that can't be done until 23424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) # crbug.com/258113 is fixed. 2458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 2558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) # Can't use WaitForDocumentReadyStateToBeComplete() here due to 2658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) # crbug.com/280750 . 2758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) tab.WaitForDocumentReadyStateToBeInteractiveOrBetter() 28