websocket_handshake_challenge_test.cc 621 B

123456789101112131415161718192021222324
  1. // Copyright 2014 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. #include "net/websockets/websocket_handshake_challenge.h"
  5. #include <string>
  6. #include "testing/gtest/include/gtest/gtest.h"
  7. namespace net {
  8. namespace {
  9. // Test the example challenge from the RFC6455.
  10. TEST(WebSocketHandshakeChallengeTest, RFC6455) {
  11. const std::string key = "dGhlIHNhbXBsZSBub25jZQ==";
  12. std::string accept = ComputeSecWebSocketAccept(key);
  13. EXPECT_EQ("s3pPLMBiTxaQ9kYGzzhZRbK+xOo=", accept);
  14. }
  15. } // namespace
  16. } // namespace net