OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/host/setup/oauth_helper.h" | 5 #include "remoting/host/setup/oauth_helper.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 |
7 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
8 | 10 |
9 namespace { | 11 namespace { |
10 | 12 |
11 std::string Replace(const std::string& s, const std::string& old_substr, | 13 std::string Replace(const std::string& s, const std::string& old_substr, |
12 const std::string& new_substr) { | 14 const std::string& new_substr) { |
13 size_t pos = s.find(old_substr); | 15 size_t pos = s.find(old_substr); |
14 if (pos == std::string::npos) { | 16 if (pos == std::string::npos) { |
15 return s; | 17 return s; |
16 } | 18 } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 ASSERT_EQ("", GetOauthCodeInUrl(url, GetTestRedirectUrl())); | 68 ASSERT_EQ("", GetOauthCodeInUrl(url, GetTestRedirectUrl())); |
67 } | 69 } |
68 | 70 |
69 TEST(OauthHelperTest, TestBadHost) { | 71 TEST(OauthHelperTest, TestBadHost) { |
70 std::string url = GetTestRedirectUrl() + "?code=Dummy"; | 72 std::string url = GetTestRedirectUrl() + "?code=Dummy"; |
71 url = Replace(url, "google", "goggle"); | 73 url = Replace(url, "google", "goggle"); |
72 ASSERT_EQ("", GetOauthCodeInUrl(url, GetTestRedirectUrl())); | 74 ASSERT_EQ("", GetOauthCodeInUrl(url, GetTestRedirectUrl())); |
73 } | 75 } |
74 | 76 |
75 } // namespace remoting | 77 } // namespace remoting |
OLD | NEW |