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

Unified Diff: remoting/host/setup/oauth_helper_unittest.cc

Issue 2661153003: Moving oauth code from host to base to allow code sharing between host and client. (Closed)
Patch Set: Merge branch 'master' into auth_token Created 3 years, 11 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
« no previous file with comments | « remoting/host/setup/oauth_helper.cc ('k') | remoting/host/setup/start_host_main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/setup/oauth_helper_unittest.cc
diff --git a/remoting/host/setup/oauth_helper_unittest.cc b/remoting/host/setup/oauth_helper_unittest.cc
deleted file mode 100644
index f5e36164433182767b162c1c94b24a1b797e521d..0000000000000000000000000000000000000000
--- a/remoting/host/setup/oauth_helper_unittest.cc
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "remoting/host/setup/oauth_helper.h"
-
-#include <stddef.h>
-
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace {
-
-std::string Replace(const std::string& s, const std::string& old_substr,
- const std::string& new_substr) {
- size_t pos = s.find(old_substr);
- if (pos == std::string::npos) {
- return s;
- }
- return s.substr(0, pos) + new_substr +
- s.substr(pos + old_substr.length(), std::string::npos);
-}
-
-std::string GetTestRedirectUrl() {
- return std::string("https://google.com/redirect");
-}
-
-} // namespace
-
-namespace remoting {
-
-TEST(OauthHelperTest, TestNotCode) {
- ASSERT_EQ("", GetOauthCodeInUrl("notURL", GetTestRedirectUrl()));
-}
-
-TEST(OauthHelperTest, TestVeryShort) {
- ASSERT_EQ("", GetOauthCodeInUrl(GetTestRedirectUrl(), GetTestRedirectUrl()));
-}
-
-TEST(OauthHelperTest, TestEmptyQuery) {
- ASSERT_EQ("", GetOauthCodeInUrl(GetTestRedirectUrl() + "?",
- GetTestRedirectUrl()));
-}
-
-TEST(OauthHelperTest, TestNoQueryValue) {
- ASSERT_EQ("", GetOauthCodeInUrl(GetTestRedirectUrl() + "?code",
- GetTestRedirectUrl()));
-}
-
-TEST(OauthHelperTest, TestEmptyCode) {
- ASSERT_EQ("", GetOauthCodeInUrl(GetTestRedirectUrl() + "?code=",
- GetTestRedirectUrl()));
-}
-
-TEST(OauthHelperTest, TestCode) {
- ASSERT_EQ("Dummy", GetOauthCodeInUrl(GetTestRedirectUrl() + "?code=Dummy",
- GetTestRedirectUrl()));
-}
-
-TEST(OauthHelperTest, TestCodeInLongQuery) {
- ASSERT_EQ("Dummy", GetOauthCodeInUrl(GetTestRedirectUrl() +
- "?x=1&code=Dummy&y=2",
- GetTestRedirectUrl()));
-}
-
-TEST(OauthHelperTest, TestBadScheme) {
- std::string url = GetTestRedirectUrl() + "?code=Dummy";
- url = Replace(url, "https:", "http");
- ASSERT_EQ("", GetOauthCodeInUrl(url, GetTestRedirectUrl()));
-}
-
-TEST(OauthHelperTest, TestBadHost) {
- std::string url = GetTestRedirectUrl() + "?code=Dummy";
- url = Replace(url, "google", "goggle");
- ASSERT_EQ("", GetOauthCodeInUrl(url, GetTestRedirectUrl()));
-}
-
-} // namespace remoting
« no previous file with comments | « remoting/host/setup/oauth_helper.cc ('k') | remoting/host/setup/start_host_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698