Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: tools/perf/profile_creators/small_profile_creator.py

Issue 44883004: [telemetry] Move tab from RunState to PageState. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment nit. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/perf/metrics/io.py ('k') | tools/telemetry/telemetry/page/page_runner.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import os 5 import os
6 6
7 from telemetry.core import util 7 from telemetry.core import util
8 from telemetry.page import page_set 8 from telemetry.page import page_set
9 from telemetry.page import profile_creator 9 from telemetry.page import profile_creator
10 10
11 class SmallProfileCreator(profile_creator.ProfileCreator): 11 class SmallProfileCreator(profile_creator.ProfileCreator):
12 """ 12 """
13 Runs a browser through a series of operations to fill in a small test profile. 13 Runs a browser through a series of operations to fill in a small test profile.
14 """ 14 """
15 15
16 def __init__(self): 16 def __init__(self):
17 super(SmallProfileCreator, self).__init__() 17 super(SmallProfileCreator, self).__init__()
18 typical_25 = os.path.join(util.GetBaseDir(), 'page_sets', 'typical_25.json') 18 typical_25 = os.path.join(util.GetBaseDir(), 'page_sets', 'typical_25.json')
19 self._page_set = page_set.PageSet.FromFile(typical_25) 19 self._page_set = page_set.PageSet.FromFile(typical_25)
20 20
21 # Open all links in the same tab save for the last _NUM_TABS links which 21 # Open all links in the same tab save for the last _NUM_TABS links which
22 # are each opened in a new tab. 22 # are each opened in a new tab.
23 self._NUM_TABS = 5 23 self._NUM_TABS = 5
24 24
25 def TabForPage(self, page, tab): 25 def TabForPage(self, page, browser):
26 idx = page.page_set.pages.index(page) 26 idx = page.page_set.pages.index(page)
27 # The last _NUM_TABS pages open a new tab. 27 # The last _NUM_TABS pages open a new tab.
28 if idx <= (len(page.page_set.pages) - self._NUM_TABS): 28 if idx <= (len(page.page_set.pages) - self._NUM_TABS):
29 return tab 29 return browser.tabs[0]
30 else: 30 else:
31 return tab.browser.tabs.New() 31 return browser.tabs.New()
32 32
33 def MeasurePage(self, _, tab, results): 33 def MeasurePage(self, _, tab, results):
34 # Can't use WaitForDocumentReadyStateToBeComplete() here due to 34 # Can't use WaitForDocumentReadyStateToBeComplete() here due to
35 # crbug.com/280750 . 35 # crbug.com/280750 .
36 tab.WaitForDocumentReadyStateToBeInteractiveOrBetter() 36 tab.WaitForDocumentReadyStateToBeInteractiveOrBetter()
OLDNEW
« no previous file with comments | « tools/perf/metrics/io.py ('k') | tools/telemetry/telemetry/page/page_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698