xref: /aosp_15_r20/external/cronet/net/websockets/websocket_handshake_challenge_test.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2014 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "net/websockets/websocket_handshake_challenge.h"
6 
7 #include <string>
8 
9 #include "testing/gtest/include/gtest/gtest.h"
10 
11 namespace net {
12 
13 namespace {
14 
15 // Test the example challenge from the RFC6455.
TEST(WebSocketHandshakeChallengeTest,RFC6455)16 TEST(WebSocketHandshakeChallengeTest, RFC6455) {
17   const std::string key = "dGhlIHNhbXBsZSBub25jZQ==";
18   std::string accept = ComputeSecWebSocketAccept(key);
19   EXPECT_EQ("s3pPLMBiTxaQ9kYGzzhZRbK+xOo=", accept);
20 }
21 
22 }  // namespace
23 
24 }  // namespace net
25