| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "base/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
| 6 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 6 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
| 7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" | 9 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" |
| 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 ScopedVector<autofill::PasswordForm> local_credentials; | 173 ScopedVector<autofill::PasswordForm> local_credentials; |
| 174 autofill::PasswordForm form; | 174 autofill::PasswordForm form; |
| 175 form.origin = origin; | 175 form.origin = origin; |
| 176 form.display_name = base::ASCIIToUTF16("Peter"); | 176 form.display_name = base::ASCIIToUTF16("Peter"); |
| 177 form.username_value = base::ASCIIToUTF16("peter@pan.test"); | 177 form.username_value = base::ASCIIToUTF16("peter@pan.test"); |
| 178 form.icon_url = GURL("broken url"); | 178 form.icon_url = GURL("broken url"); |
| 179 local_credentials.push_back(new autofill::PasswordForm(form)); | 179 local_credentials.push_back(new autofill::PasswordForm(form)); |
| 180 GURL icon_url("https://google.com/icon.png"); | 180 GURL icon_url("https://google.com/icon.png"); |
| 181 form.icon_url = icon_url; | 181 form.icon_url = icon_url; |
| 182 form.display_name = base::ASCIIToUTF16("Peter Pen"); | 182 form.display_name = base::ASCIIToUTF16("Peter Pen"); |
| 183 form.federation_url = GURL("https://google.com/federation"); | 183 form.federation_origin = url::Origin(GURL("https://google.com/federation")); |
| 184 local_credentials.push_back(new autofill::PasswordForm(form)); | 184 local_credentials.push_back(new autofill::PasswordForm(form)); |
| 185 | 185 |
| 186 // Prepare to capture the network request. | 186 // Prepare to capture the network request. |
| 187 TestURLFetcherCallback url_callback; | 187 TestURLFetcherCallback url_callback; |
| 188 net::FakeURLFetcherFactory factory( | 188 net::FakeURLFetcherFactory factory( |
| 189 NULL, base::Bind(&TestURLFetcherCallback::CreateURLFetcher, | 189 NULL, base::Bind(&TestURLFetcherCallback::CreateURLFetcher, |
| 190 base::Unretained(&url_callback))); | 190 base::Unretained(&url_callback))); |
| 191 factory.SetFakeResponse(icon_url, std::string(), net::HTTP_OK, | 191 factory.SetFakeResponse(icon_url, std::string(), net::HTTP_OK, |
| 192 net::URLRequestStatus::FAILED); | 192 net::URLRequestStatus::FAILED); |
| 193 EXPECT_CALL(url_callback, OnRequestDone(icon_url)); | 193 EXPECT_CALL(url_callback, OnRequestDone(icon_url)); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 213 ScopedVector<autofill::PasswordForm> local_credentials; | 213 ScopedVector<autofill::PasswordForm> local_credentials; |
| 214 autofill::PasswordForm form; | 214 autofill::PasswordForm form; |
| 215 form.origin = origin; | 215 form.origin = origin; |
| 216 form.display_name = base::ASCIIToUTF16("Peter"); | 216 form.display_name = base::ASCIIToUTF16("Peter"); |
| 217 form.username_value = base::ASCIIToUTF16("peter@pan.test"); | 217 form.username_value = base::ASCIIToUTF16("peter@pan.test"); |
| 218 form.icon_url = GURL("broken url"); | 218 form.icon_url = GURL("broken url"); |
| 219 local_credentials.push_back(new autofill::PasswordForm(form)); | 219 local_credentials.push_back(new autofill::PasswordForm(form)); |
| 220 GURL icon_url("https://google.com/icon.png"); | 220 GURL icon_url("https://google.com/icon.png"); |
| 221 form.icon_url = icon_url; | 221 form.icon_url = icon_url; |
| 222 form.display_name = base::ASCIIToUTF16("Peter Pen"); | 222 form.display_name = base::ASCIIToUTF16("Peter Pen"); |
| 223 form.federation_url = GURL("https://google.com/federation"); | 223 form.federation_origin = url::Origin(GURL("https://google.com/federation")); |
| 224 local_credentials.push_back(new autofill::PasswordForm(form)); | 224 local_credentials.push_back(new autofill::PasswordForm(form)); |
| 225 | 225 |
| 226 SetupChooseCredentials(std::move(local_credentials), | 226 SetupChooseCredentials(std::move(local_credentials), |
| 227 ScopedVector<autofill::PasswordForm>(), origin); | 227 ScopedVector<autofill::PasswordForm>(), origin); |
| 228 ASSERT_TRUE(controller()->current_account_chooser()); | 228 ASSERT_TRUE(controller()->current_account_chooser()); |
| 229 | 229 |
| 230 // After picking a credential, we should pass it back to the caller via the | 230 // After picking a credential, we should pass it back to the caller via the |
| 231 // callback, but we should not pop up the autosignin prompt as there were | 231 // callback, but we should not pop up the autosignin prompt as there were |
| 232 // multiple credentials available. | 232 // multiple credentials available. |
| 233 EXPECT_CALL( | 233 EXPECT_CALL( |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 password_manager::prefs::kCredentialsEnableAutosignin, true); | 428 password_manager::prefs::kCredentialsEnableAutosignin, true); |
| 429 | 429 |
| 430 // Successful login with the same form after block will prompt: | 430 // Successful login with the same form after block will prompt: |
| 431 blocked_form.reset(new autofill::PasswordForm(form)); | 431 blocked_form.reset(new autofill::PasswordForm(form)); |
| 432 client()->NotifyUserAutoSigninBlockedOnFirstRun(std::move(blocked_form)); | 432 client()->NotifyUserAutoSigninBlockedOnFirstRun(std::move(blocked_form)); |
| 433 client()->NotifySuccessfulLoginWithExistingPassword(form); | 433 client()->NotifySuccessfulLoginWithExistingPassword(form); |
| 434 ASSERT_TRUE(controller()->current_autosignin_prompt()); | 434 ASSERT_TRUE(controller()->current_autosignin_prompt()); |
| 435 } | 435 } |
| 436 | 436 |
| 437 } // namespace | 437 } // namespace |
| OLD | NEW |