OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/password_manager/core/browser/affiliation_utils.h" | 5 #include "components/password_manager/core/browser/affiliation_utils.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "components/autofill/core/common/password_form.h" | 10 #include "components/autofill/core/common/password_form.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 | 212 |
213 private: | 213 private: |
214 autofill::PasswordForm form_template_; | 214 autofill::PasswordForm form_template_; |
215 }; | 215 }; |
216 | 216 |
217 TEST_F(GetHumanReadableOriginTest, OriginFromHtmlForm) { | 217 TEST_F(GetHumanReadableOriginTest, OriginFromHtmlForm) { |
218 autofill::PasswordForm html_form(form_remplate()); | 218 autofill::PasswordForm html_form(form_remplate()); |
219 html_form.origin = GURL(kSchemeHostExample + "/LoginAuth"); | 219 html_form.origin = GURL(kSchemeHostExample + "/LoginAuth"); |
220 html_form.action = GURL(kSchemeHostExample + "/Login"); | 220 html_form.action = GURL(kSchemeHostExample + "/Login"); |
221 html_form.scheme = autofill::PasswordForm::SCHEME_HTML; | 221 html_form.scheme = autofill::PasswordForm::SCHEME_HTML; |
222 EXPECT_EQ(GetHumanReadableOrigin(html_form, ""), "http://example.com"); | 222 EXPECT_EQ(GetHumanReadableOrigin(html_form), "http://example.com"); |
223 } | 223 } |
224 | 224 |
225 TEST_F(GetHumanReadableOriginTest, OriginFromDigestForm) { | 225 TEST_F(GetHumanReadableOriginTest, OriginFromDigestForm) { |
226 autofill::PasswordForm non_html_form(form_remplate()); | 226 autofill::PasswordForm non_html_form(form_remplate()); |
227 non_html_form.scheme = autofill::PasswordForm::SCHEME_DIGEST; | 227 non_html_form.scheme = autofill::PasswordForm::SCHEME_DIGEST; |
228 non_html_form.action = GURL(); | 228 non_html_form.action = GURL(); |
229 non_html_form.signon_realm = kSchemeHostExample + "42"; | 229 non_html_form.signon_realm = kSchemeHostExample + "42"; |
230 EXPECT_EQ(GetHumanReadableOrigin(non_html_form, ""), "http://example.com"); | 230 EXPECT_EQ(GetHumanReadableOrigin(non_html_form), "http://example.com"); |
231 } | 231 } |
232 | 232 |
233 TEST_F(GetHumanReadableOriginTest, OriginFromAndroidForm) { | 233 TEST_F(GetHumanReadableOriginTest, OriginFromAndroidForm) { |
234 autofill::PasswordForm android_form(form_remplate()); | 234 autofill::PasswordForm android_form(form_remplate()); |
235 android_form.action = GURL(); | 235 android_form.action = GURL(); |
236 android_form.origin = GURL(); | 236 android_form.origin = GURL(); |
237 android_form.scheme = autofill::PasswordForm::SCHEME_OTHER; | 237 android_form.scheme = autofill::PasswordForm::SCHEME_OTHER; |
238 android_form.signon_realm = | 238 android_form.signon_realm = |
239 "android://" | 239 "android://" |
240 "m3HSJL1i83hdltRq0-o9czGb-8KJDKra4t_" | 240 "m3HSJL1i83hdltRq0-o9czGb-8KJDKra4t_" |
241 "3JRlnPKcjI8PZm6XBHXx6zG4UuMXaDEZjR1wuXDre9G9zvN7AQw==" | 241 "3JRlnPKcjI8PZm6XBHXx6zG4UuMXaDEZjR1wuXDre9G9zvN7AQw==" |
242 "@com.example.android"; | 242 "@com.example.android"; |
243 EXPECT_EQ(GetHumanReadableOrigin(android_form, ""), | 243 EXPECT_EQ(GetHumanReadableOrigin(android_form), |
244 "android://com.example.android"); | 244 "android://com.example.android"); |
245 } | 245 } |
246 | 246 |
247 } // namespace password_manager | 247 } // namespace password_manager |
OLD | NEW |