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

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

Issue 23604005: [Telemetry] Implement dirty profile generation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@generate_profile
Patch Set: Fix unit tests Created 7 years, 3 months 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
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 profile_creator 7 from telemetry.core import util
8 from telemetry.page import page_runner
8 from telemetry.page import page_set 9 from telemetry.page import page_set
10 from telemetry.page import profile_creator
9 11
10 class SmallProfileCreator(profile_creator.ProfileCreator): 12 class SmallProfileCreator(profile_creator.ProfileCreator):
11 """ 13 """
12 Runs a browser through a series of operations to fill in a small test profile. 14 Runs a browser through a series of operations to fill in a small test profile.
13 """ 15 """
14 16
15 def CreateProfile(self): 17 def __init__(self):
16 top_25 = os.path.join(os.path.dirname(__file__), 18 super(SmallProfileCreator, self).__init__()
17 '..', 'page_sets', 'top_25.json') 19 top_25 = os.path.join(util.GetBaseDir(), 'page_sets', 'top_25.json')
18 pages_to_load = page_set.PageSet.FromFile(top_25) 20 self._page_set = page_set.PageSet.FromFile(top_25)
19 tab = self._browser.tabs[0] 21
20 for page in pages_to_load: 22 def CanRunForPage(self, page):
21 tab.Navigate(page.url) 23 return not page.page_set.pages.index(page)
tonyg 2013/08/28 00:09:58 Recommend a brief comment explaining this.
22 tab.WaitForDocumentReadyStateToBeComplete() 24
23 tab.Disconnect() 25 def DidNavigateToPage(self, page, tab):
26 for i in xrange(1, len(page.page_set.pages)):
27 t = tab.browser.tabs.New()
28
29 page_state = page_runner.PageState()
30 page_state.PreparePage(page.page_set.pages[i], t)
31 page_state.ImplicitPageNavigation(page.page_set.pages[i], t)
32
33 # Wait for all tabs to load.
34 for i in xrange(len(tab.browser.tabs)):
35 t = tab.browser.tabs[i]
36 t.WaitForDocumentReadyStateToBeComplete()
37
38 def MeasurePage(self, _, tab, results):
39 pass
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698