| Index: net/http2/tools/random_util.h
|
| diff --git a/net/http2/tools/random_util.h b/net/http2/tools/random_util.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..b0ed03e3b3dfc214dab0ea2898c6b02cee366995
|
| --- /dev/null
|
| +++ b/net/http2/tools/random_util.h
|
| @@ -0,0 +1,48 @@
|
| +// Copyright 2016 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.
|
| +
|
| +#ifndef NET_HTTP2_TOOLS_RANDOM_UTIL_H_
|
| +#define NET_HTTP2_TOOLS_RANDOM_UTIL_H_
|
| +
|
| +#include <stddef.h>
|
| +
|
| +#include <string>
|
| +
|
| +#include "base/strings/string_piece.h"
|
| +#include "net/base/net_export.h"
|
| +
|
| +namespace net {
|
| +namespace test {
|
| +
|
| +class RandomBase;
|
| +
|
| +// Returns a random string of length |len|, each character drawn uniformly and
|
| +// independently fom |alphabet|.
|
| +std::string NET_EXPORT_PRIVATE RandomString(RandomBase* rng,
|
| + int len,
|
| + base::StringPiece alphabet);
|
| +
|
| +// Returns a random integer in the range [lo, hi).
|
| +size_t NET_EXPORT_PRIVATE GenerateUniformInRange(size_t lo,
|
| + size_t hi,
|
| + RandomBase* rng);
|
| +
|
| +// Generate a string with the allowed character set for HTTP/2 / HPACK header
|
| +// names.
|
| +std::string NET_EXPORT_PRIVATE GenerateHttp2HeaderName(size_t len,
|
| + RandomBase* rng);
|
| +
|
| +// Generate a string with the web-safe string character set of specified len.
|
| +std::string NET_EXPORT_PRIVATE GenerateWebSafeString(size_t len,
|
| + RandomBase* rng);
|
| +
|
| +// Generate a string with the web-safe string character set of length [lo, hi).
|
| +std::string NET_EXPORT_PRIVATE GenerateWebSafeString(size_t lo,
|
| + size_t hi,
|
| + RandomBase* rng);
|
| +
|
| +} // namespace test
|
| +} // namespace net
|
| +
|
| +#endif // NET_HTTP2_TOOLS_RANDOM_UTIL_H_
|
|
|