Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Use of this source code is governed by a BSD-style license that can be | |
|
Wez
2011/05/25 03:57:46
Missing Copyright line.
awong
2011/05/25 16:56:56
Done.
| |
| 2 // found in the LICENSE file. | |
| 3 | |
| 4 #include "remoting/base/auth_token_util.h" | |
| 5 #include "remoting/base/constants.h" | |
| 6 #include "testing/gtest/include/gtest/gtest.h" | |
| 7 | |
| 8 namespace remoting { | |
| 9 namespace { | |
| 10 | |
| 11 TEST(AuthTokenUtilTest, ParseAuthTokenWithService) { | |
| 12 std::string auth_token; | |
| 13 std::string auth_service; | |
| 14 | |
| 15 ParseAuthTokenWithService("service:token", &auth_token, &auth_service); | |
| 16 EXPECT_EQ("token", auth_token); | |
| 17 EXPECT_EQ("service", auth_service); | |
| 18 | |
| 19 // Check for legacy support. | |
| 20 ParseAuthTokenWithService("token2", &auth_token, &auth_service); | |
| 21 EXPECT_EQ("token2", auth_token); | |
| 22 EXPECT_EQ(kChromotingTokenDefaultServiceName, auth_service); | |
| 23 | |
| 24 ParseAuthTokenWithService("just_service:", &auth_token, &auth_service); | |
| 25 EXPECT_EQ("", auth_token); | |
| 26 EXPECT_EQ("just_service", auth_service); | |
| 27 | |
| 28 ParseAuthTokenWithService("yay:token:has:colons", &auth_token, &auth_service); | |
| 29 EXPECT_EQ("token:has:colons", auth_token); | |
| 30 EXPECT_EQ("yay", auth_service); | |
| 31 } | |
| 32 | |
| 33 } // namespace | |
| 34 | |
| 35 } // namespace remoting | |
| OLD | NEW |