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

Side by Side Diff: chrome/browser/ui/views/passwords/password_dialog_view_browsertest.cc

Issue 1723583004: CREDENTIAL: Convert federations from URLs to origins throughout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
OLDNEW
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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 ScopedVector<autofill::PasswordForm> local_credentials; 172 ScopedVector<autofill::PasswordForm> local_credentials;
173 autofill::PasswordForm form; 173 autofill::PasswordForm form;
174 form.origin = origin; 174 form.origin = origin;
175 form.display_name = base::ASCIIToUTF16("Peter"); 175 form.display_name = base::ASCIIToUTF16("Peter");
176 form.username_value = base::ASCIIToUTF16("peter@pan.test"); 176 form.username_value = base::ASCIIToUTF16("peter@pan.test");
177 form.icon_url = GURL("broken url"); 177 form.icon_url = GURL("broken url");
178 local_credentials.push_back(new autofill::PasswordForm(form)); 178 local_credentials.push_back(new autofill::PasswordForm(form));
179 GURL icon_url("https://google.com/icon.png"); 179 GURL icon_url("https://google.com/icon.png");
180 form.icon_url = icon_url; 180 form.icon_url = icon_url;
181 form.display_name = base::ASCIIToUTF16("Peter Pen"); 181 form.display_name = base::ASCIIToUTF16("Peter Pen");
182 form.federation_url = GURL("https://google.com/federation"); 182 form.federation_origin = url::Origin(GURL("https://google.com/federation"));
183 local_credentials.push_back(new autofill::PasswordForm(form)); 183 local_credentials.push_back(new autofill::PasswordForm(form));
184 184
185 // Prepare to capture the network request. 185 // Prepare to capture the network request.
186 TestURLFetcherCallback url_callback; 186 TestURLFetcherCallback url_callback;
187 net::FakeURLFetcherFactory factory( 187 net::FakeURLFetcherFactory factory(
188 NULL, base::Bind(&TestURLFetcherCallback::CreateURLFetcher, 188 NULL, base::Bind(&TestURLFetcherCallback::CreateURLFetcher,
189 base::Unretained(&url_callback))); 189 base::Unretained(&url_callback)));
190 factory.SetFakeResponse(icon_url, std::string(), net::HTTP_OK, 190 factory.SetFakeResponse(icon_url, std::string(), net::HTTP_OK,
191 net::URLRequestStatus::FAILED); 191 net::URLRequestStatus::FAILED);
192 EXPECT_CALL(url_callback, OnRequestDone(icon_url)); 192 EXPECT_CALL(url_callback, OnRequestDone(icon_url));
(...skipping 19 matching lines...) Expand all
212 ScopedVector<autofill::PasswordForm> local_credentials; 212 ScopedVector<autofill::PasswordForm> local_credentials;
213 autofill::PasswordForm form; 213 autofill::PasswordForm form;
214 form.origin = origin; 214 form.origin = origin;
215 form.display_name = base::ASCIIToUTF16("Peter"); 215 form.display_name = base::ASCIIToUTF16("Peter");
216 form.username_value = base::ASCIIToUTF16("peter@pan.test"); 216 form.username_value = base::ASCIIToUTF16("peter@pan.test");
217 form.icon_url = GURL("broken url"); 217 form.icon_url = GURL("broken url");
218 local_credentials.push_back(new autofill::PasswordForm(form)); 218 local_credentials.push_back(new autofill::PasswordForm(form));
219 GURL icon_url("https://google.com/icon.png"); 219 GURL icon_url("https://google.com/icon.png");
220 form.icon_url = icon_url; 220 form.icon_url = icon_url;
221 form.display_name = base::ASCIIToUTF16("Peter Pen"); 221 form.display_name = base::ASCIIToUTF16("Peter Pen");
222 form.federation_url = GURL("https://google.com/federation"); 222 form.federation_origin = url::Origin(GURL("https://google.com/federation"));
223 local_credentials.push_back(new autofill::PasswordForm(form)); 223 local_credentials.push_back(new autofill::PasswordForm(form));
224 224
225 SetupChooseCredentials(std::move(local_credentials), 225 SetupChooseCredentials(std::move(local_credentials),
226 ScopedVector<autofill::PasswordForm>(), origin); 226 ScopedVector<autofill::PasswordForm>(), origin);
227 ASSERT_TRUE(controller()->current_account_chooser()); 227 ASSERT_TRUE(controller()->current_account_chooser());
228 228
229 // After picking a credential, we should pass it back to the caller via the 229 // After picking a credential, we should pass it back to the caller via the
230 // callback, but we should not pop up the autosignin prompt as there were 230 // callback, but we should not pop up the autosignin prompt as there were
231 // multiple credentials available. 231 // multiple credentials available.
232 EXPECT_CALL( 232 EXPECT_CALL(
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 431
432 // Successful login with the same form after block will prompt: 432 // Successful login with the same form after block will prompt:
433 blocked_form.reset(new autofill::PasswordForm(form)); 433 blocked_form.reset(new autofill::PasswordForm(form));
434 client()->NotifyUserAutoSigninBlockedOnFirstRun(std::move(blocked_form)); 434 client()->NotifyUserAutoSigninBlockedOnFirstRun(std::move(blocked_form));
435 client()->NotifySuccessfulLoginWithExistingPassword(form); 435 client()->NotifySuccessfulLoginWithExistingPassword(form);
436 EXPECT_CALL(*controller(), OnDialogClosed()); 436 EXPECT_CALL(*controller(), OnDialogClosed());
437 ASSERT_TRUE(controller()->current_autosignin_prompt()); 437 ASSERT_TRUE(controller()->current_autosignin_prompt());
438 } 438 }
439 439
440 } // namespace 440 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698