Simplify UnguessableToken::ToString, don't wrap it in ().
This change migrates unguessable tokens' serialization format from
`(790345...265EE7)` to `7903415...265EE7`.
When unguessable token is used for instrumentation and tracing, it can be used
as a handle. Having non-URL characters such as punctuation in the serialized
form of the token limits its use and requires it to be escaped / post-processed.
If wrapping in () is not essential to the token, I'm suggesting that we drop it.
Bug: 778263
Change-Id: Ib88c15c478f6dca89425f272e35893dd399f91fd
Reviewed-on: https://chromium-review.googlesource.com/845146
Reviewed-by: Primiano Tucci <primiano@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Pavel Feldman <pfeldman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#526627}
diff --git a/base/unguessable_token_unittest.cc b/base/unguessable_token_unittest.cc
index 0158257..287fca31 100644
--- a/base/unguessable_token_unittest.cc
+++ b/base/unguessable_token_unittest.cc
@@ -80,13 +80,14 @@
TEST(UnguessableTokenTest, VerifyToString) {
UnguessableToken token = UnguessableToken::Deserialize(0x123, 0xABC);
- std::string expected = "(0000012300000ABC)";
+ std::string expected = "0000012300000ABC";
EXPECT_EQ(expected, token.ToString());
+ std::string expected_stream = "(0000012300000ABC)";
std::stringstream stream;
stream << token;
- EXPECT_EQ(expected, stream.str());
+ EXPECT_EQ(expected_stream, stream.str());
}
TEST(UnguessableTokenTest, VerifySmallerThanOperator) {