Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / tools / perf / profile_creators / profile_safe_url_list.py
blob3bb6cf3d4576065a018a144ac4fa820e0bb72822
1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4 import json
5 import os
6 import random
9 def GetShuffledSafeUrls():
10 """Returns a deterministic shuffling of safe urls.
12 The profile generators access the urls in order, and the urls are grouped by
13 domain. The shuffling reduces the load on external servers.
14 """
15 random.seed(0)
16 url_list_copy = list(GetSafeUrls())
17 random.shuffle(url_list_copy)
18 return url_list_copy
21 def GetSafeUrls():
22 """Returns a list of safe urls by loading them from a pre-generated file."""
23 safe_url_dir = os.path.dirname(os.path.realpath(__file__))
24 safe_url_path = os.path.join(safe_url_dir, "profile_safe_url_list.json")
25 with open(safe_url_path, 'r') as safe_url_file:
26 return json.load(safe_url_file)