| Index: tools/perf/page_sets/alexa_top_500.py
|
| diff --git a/tools/perf/page_sets/alexa_top_500.py b/tools/perf/page_sets/alexa_top_500.py
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..88b8ad1410dbf6f366966da96e51743a089dd15f
|
| --- /dev/null
|
| +++ b/tools/perf/page_sets/alexa_top_500.py
|
| @@ -0,0 +1,62 @@
|
| +# Copyright 2015 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.
|
| +import json
|
| +import os
|
| +
|
| +from telemetry.page import page as page_module
|
| +from telemetry.page import shared_page_state
|
| +from telemetry import story
|
| +
|
| +
|
| +_ALEXA_TOP500_JSON = os.path.join(
|
| + os.path.abspath(os.path.dirname(__file__)), 'alexa_top_500.json')
|
| +_ALEXA_TOP500_JSON_BLACKLIST = os.path.join(
|
| + os.path.abspath(os.path.dirname(__file__)), 'alexa_top_500_blacklist.json')
|
| +
|
| +class AlexaTop500Page(page_module.Page):
|
| +
|
| + def __init__(self, url, page_set):
|
| + super(AlexaTop500Page, self).__init__(
|
| + url=url, page_set=page_set,
|
| + shared_page_state_class=shared_page_state.SharedDesktopPageState)
|
| +
|
| + def RunPageInteractions(self, action_runner):
|
| + with action_runner.CreateGestureInteraction('ScrollAction'):
|
| + action_runner.ScrollPage()
|
| +
|
| +
|
| +class AlexaTop500PageSet(story.StorySet):
|
| + def __init__(self):
|
| + super(AlexaTop500PageSet, self).__init__(
|
| + archive_data_file='data/alexa_top_500.json',
|
| + )
|
| +
|
| + excludes = set([
|
| + 'qq.com',
|
| + 'telegraph.co.uk',
|
| + 'googleusercontent.com',
|
| + 'nba.com',
|
| + 'seznam.cz',
|
| + 'sina.com.cn',
|
| + 'youku.com',
|
| + 'zhihu.com',
|
| + 'huffingtonpost.com',
|
| + 't-online.de',
|
| + ])
|
| +
|
| + # with open(_ALEXA_TOP500_JSON_BLACKLIST) as f:
|
| + # excludes = set(json.load(f))
|
| +
|
| + sites = []
|
| + with open(_ALEXA_TOP500_JSON) as f:
|
| + site_entries = json.load(f)
|
| + for entry in site_entries:
|
| + if entry['url'] in excludes:
|
| + continue
|
| + sites.append(entry['url'])
|
| +
|
| + MAX_PAGES = 300
|
| + for i, site in enumerate(sites):
|
| + if i < MAX_PAGES:
|
| + self.AddStory(AlexaTop500Page('http://' + site, self))
|
|
|