| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/ui/login/login_handler.h" | 9 #include "chrome/browser/ui/login/login_handler.h" |
| 10 #include "net/base/auth.h" | 10 #include "net/base/auth.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 const char kHttpUrl[] = "http://example.com/foo/bar"; | 16 const char kHttpUrl[] = "http://example.com/foo/bar"; |
| 17 const char kBasicAuthScheme[] = "Basic"; | 17 const char kBasicAuthScheme[] = "Basic"; |
| 18 const char kFooRealm[] = "Foo"; | 18 const char kFooRealm[] = "Foo"; |
| 19 const char kInsecureProxy[] = "Your connection to this site is not private."; | 19 const char kInsecureProxy[] = "Your connection to this site is not secure"; |
| 20 | 20 |
| 21 enum TargetType { PROXY, SERVER }; | 21 enum TargetType { PROXY, SERVER }; |
| 22 | 22 |
| 23 const struct TestCase { | 23 const struct TestCase { |
| 24 const char* const request_url; | 24 const char* const request_url; |
| 25 struct { | 25 struct { |
| 26 TargetType target_type; | 26 TargetType target_type; |
| 27 const char* const scheme; | 27 const char* const scheme; |
| 28 const char* const realm; | 28 const char* const realm; |
| 29 const char* const challenger; | 29 const char* const challenger; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 &explanation); | 133 &explanation); |
| 134 EXPECT_STREQ(test_case.expected.authority, | 134 EXPECT_STREQ(test_case.expected.authority, |
| 135 base::UTF16ToASCII(authority).c_str()); | 135 base::UTF16ToASCII(authority).c_str()); |
| 136 EXPECT_STREQ(test_case.expected.explanation, | 136 EXPECT_STREQ(test_case.expected.explanation, |
| 137 base::UTF16ToASCII(explanation).c_str()); | 137 base::UTF16ToASCII(explanation).c_str()); |
| 138 | 138 |
| 139 EXPECT_STREQ(test_case.expected.signon_realm, | 139 EXPECT_STREQ(test_case.expected.signon_realm, |
| 140 LoginHandler::GetSignonRealm(request_url, *auth_info).c_str()); | 140 LoginHandler::GetSignonRealm(request_url, *auth_info).c_str()); |
| 141 } | 141 } |
| 142 } | 142 } |
| OLD | NEW |