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

Side by Side Diff: third_party/WebKit/Source/modules/bluetooth/testing/clusterfuzz/constraints.py

Issue 2166463002: bluetooth: Basic Web Bluetooth Fuzzer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Move to testing/clusterfuzz directory Created 4 years, 5 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
(Empty)
1 # Copyright 2016 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
5 """Module to get random numbers, strings, etc.
6
7 The values returned by the various functions can be replaced in
8 templates to generate test cases.
9 """
10
11 import random
12
13
14 def GetValidUUIDString():
15 """Constructs a valid UUID string.
16
17 Returns:
18 A string representating a valid UUID according to:
19 https://webbluetoothcg.github.io/web-bluetooth/#valid-uuid
20 """
21
22 return '\'{:08x}-{:04x}-{:04x}-{:04x}-{:012x}\''.format(
23 random.getrandbits(32),
24 random.getrandbits(16),
25 random.getrandbits(16),
26 random.getrandbits(16),
27 random.getrandbits(48))
28
29
30 def GetRequestDeviceOptions():
31 """Returns an object used by navigator.bluetooth.requestDevice."""
32 # TODO(ortuno): Randomize the members, number of filters, services, etc.
33
34 return '{filters: [{services: [ %s ]}]}' % GetValidUUIDString()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698