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

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

Issue 11185037: [Chromoting] Let the Linux start-host app take a redirect-URL parameter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Windows include. Created 8 years, 2 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.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
index aff85d16023b91ba203e0959770c5085a2c15a25..cddb32a55d4461dadbab76ff9914cd50fc4b0998 100644
--- a/remoting/host/setup/oauth_helper_unittest.cc
+++ b/remoting/host/setup/oauth_helper_unittest.cc
@@ -18,49 +18,58 @@ std::string Replace(const std::string& s, const std::string& old_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"));
+ ASSERT_EQ("", GetOauthCodeInUrl("notURL", GetTestRedirectUrl()));
}
TEST(OauthHelperTest, TestVeryShort) {
- ASSERT_EQ("", GetOauthCodeInUrl(GetOauthRedirectUrl()));
+ ASSERT_EQ("", GetOauthCodeInUrl(GetTestRedirectUrl(), GetTestRedirectUrl()));
}
TEST(OauthHelperTest, TestEmptyQuery) {
- ASSERT_EQ("", GetOauthCodeInUrl(GetOauthRedirectUrl() + "?"));
+ ASSERT_EQ("", GetOauthCodeInUrl(GetTestRedirectUrl() + "?",
+ GetTestRedirectUrl()));
}
TEST(OauthHelperTest, TestNoQueryValue) {
- ASSERT_EQ("", GetOauthCodeInUrl(GetOauthRedirectUrl() + "?code"));
+ ASSERT_EQ("", GetOauthCodeInUrl(GetTestRedirectUrl() + "?code",
+ GetTestRedirectUrl()));
}
TEST(OauthHelperTest, TestEmptyCode) {
- ASSERT_EQ("", GetOauthCodeInUrl(GetOauthRedirectUrl() + "?code="));
+ ASSERT_EQ("", GetOauthCodeInUrl(GetTestRedirectUrl() + "?code=",
+ GetTestRedirectUrl()));
}
TEST(OauthHelperTest, TestCode) {
- ASSERT_EQ("Dummy", GetOauthCodeInUrl(GetOauthRedirectUrl() + "?code=Dummy"));
+ ASSERT_EQ("Dummy", GetOauthCodeInUrl(GetTestRedirectUrl() + "?code=Dummy",
+ GetTestRedirectUrl()));
}
TEST(OauthHelperTest, TestCodeInLongQuery) {
- ASSERT_EQ("Dummy", GetOauthCodeInUrl(GetOauthRedirectUrl() +
- "?x=1&code=Dummy&y=2"));
+ ASSERT_EQ("Dummy", GetOauthCodeInUrl(GetTestRedirectUrl() +
+ "?x=1&code=Dummy&y=2",
+ GetTestRedirectUrl()));
}
TEST(OauthHelperTest, TestBadScheme) {
- std::string url = GetOauthRedirectUrl() + "?code=Dummy";
+ std::string url = GetTestRedirectUrl() + "?code=Dummy";
url = Replace(url, "https:", "http");
- ASSERT_EQ("", GetOauthCodeInUrl(url));
+ ASSERT_EQ("", GetOauthCodeInUrl(url, GetTestRedirectUrl()));
}
TEST(OauthHelperTest, TestBadHost) {
- std::string url = GetOauthRedirectUrl() + "?code=Dummy";
+ std::string url = GetTestRedirectUrl() + "?code=Dummy";
url = Replace(url, "google", "goggle");
- ASSERT_EQ("", GetOauthCodeInUrl(url));
+ ASSERT_EQ("", GetOauthCodeInUrl(url, GetTestRedirectUrl()));
}
} // namespace remoting
« no previous file with comments | « remoting/host/setup/oauth_helper.cc ('k') | remoting/host/setup/start_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698