OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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 #include "remoting/base/auth_token_util.h" |
| 6 #include "remoting/base/constants.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 |
| 9 namespace remoting { |
| 10 namespace { |
| 11 |
| 12 TEST(AuthTokenUtilTest, ParseAuthTokenWithService) { |
| 13 std::string auth_token; |
| 14 std::string auth_service; |
| 15 |
| 16 ParseAuthTokenWithService("service:token", &auth_token, &auth_service); |
| 17 EXPECT_EQ("token", auth_token); |
| 18 EXPECT_EQ("service", auth_service); |
| 19 |
| 20 // Check for legacy support. |
| 21 ParseAuthTokenWithService("token2", &auth_token, &auth_service); |
| 22 EXPECT_EQ("token2", auth_token); |
| 23 EXPECT_EQ(std::string(kChromotingTokenDefaultServiceName), auth_service); |
| 24 |
| 25 ParseAuthTokenWithService("just_service:", &auth_token, &auth_service); |
| 26 EXPECT_EQ("", auth_token); |
| 27 EXPECT_EQ("just_service", auth_service); |
| 28 |
| 29 ParseAuthTokenWithService("yay:token:has:colons", &auth_token, &auth_service); |
| 30 EXPECT_EQ("token:has:colons", auth_token); |
| 31 EXPECT_EQ("yay", auth_service); |
| 32 } |
| 33 |
| 34 } // namespace |
| 35 |
| 36 } // namespace remoting |
OLD | NEW |