Revert 187554 "Implement IPC::ChannelFactory, a class that accep..."
[chromium-blink-merge.git] / remoting / base / auth_token_util_unittest.cc
blob2732b441da4fb78d05b9a4af8f8f0faf70d32be1
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.
5 #include "remoting/base/auth_token_util.h"
6 #include "remoting/base/constants.h"
7 #include "testing/gtest/include/gtest/gtest.h"
9 namespace remoting {
10 namespace {
12 TEST(AuthTokenUtilTest, ParseAuthTokenWithService) {
13 std::string auth_token;
14 std::string auth_service;
16 ParseAuthTokenWithService("service:token", &auth_token, &auth_service);
17 EXPECT_EQ("token", auth_token);
18 EXPECT_EQ("service", auth_service);
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);
25 ParseAuthTokenWithService("just_service:", &auth_token, &auth_service);
26 EXPECT_EQ("", auth_token);
27 EXPECT_EQ("just_service", auth_service);
29 ParseAuthTokenWithService("yay:token:has:colons", &auth_token, &auth_service);
30 EXPECT_EQ("token:has:colons", auth_token);
31 EXPECT_EQ("yay", auth_service);
34 } // namespace
36 } // namespace remoting