Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(848)

Unified Diff: remoting/base/auth_token_util_unittest.cc

Issue 7008003: Wire in OAuth2 support into non-sandboxed connections in libjingle. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/base/auth_token_util_unittest.cc
diff --git a/remoting/base/auth_token_util_unittest.cc b/remoting/base/auth_token_util_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..96ca3faaed38561e7c4a4116564294f25ba0c3c2
--- /dev/null
+++ b/remoting/base/auth_token_util_unittest.cc
@@ -0,0 +1,35 @@
+// 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.
+// found in the LICENSE file.
+
+#include "remoting/base/auth_token_util.h"
+#include "remoting/base/constants.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace remoting {
+namespace {
+
+TEST(AuthTokenUtilTest, ParseAuthTokenWithService) {
+ std::string auth_token;
+ std::string auth_service;
+
+ ParseAuthTokenWithService("service:token", &auth_token, &auth_service);
+ EXPECT_EQ("token", auth_token);
+ EXPECT_EQ("service", auth_service);
+
+ // Check for legacy support.
+ ParseAuthTokenWithService("token2", &auth_token, &auth_service);
+ EXPECT_EQ("token2", auth_token);
+ EXPECT_EQ(kChromotingTokenDefaultServiceName, auth_service);
+
+ ParseAuthTokenWithService("just_service:", &auth_token, &auth_service);
+ EXPECT_EQ("", auth_token);
+ EXPECT_EQ("just_service", auth_service);
+
+ ParseAuthTokenWithService("yay:token:has:colons", &auth_token, &auth_service);
+ EXPECT_EQ("token:has:colons", auth_token);
+ EXPECT_EQ("yay", auth_service);
+}
+
+} // namespace
+
+} // namespace remoting

Powered by Google App Engine
This is Rietveld 408576698