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

Side by Side Diff: components/password_manager/core/browser/password_store_unittest.cc

Issue 1548203002: Convert Pass()→std::move() in //components/[n-z]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bad headers Created 4 years, 11 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 (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 // The passwords in the tests below are all empty because PasswordStoreDefault 5 // The passwords in the tests below are all empty because PasswordStoreDefault
6 // does not store the actual passwords on OS X (they are stored in the Keychain 6 // does not store the actual passwords on OS X (they are stored in the Keychain
7 // instead). We could special-case it, but it is easier to just have empty 7 // instead). We could special-case it, but it is easier to just have empty
8 // passwords. This will not be needed anymore if crbug.com/466638 is fixed. 8 // passwords. This will not be needed anymore if crbug.com/466638 is fixed.
9 9
10 #include <stddef.h> 10 #include <stddef.h>
11 #include <utility>
11 12
12 #include "base/bind.h" 13 #include "base/bind.h"
13 #include "base/files/scoped_temp_dir.h" 14 #include "base/files/scoped_temp_dir.h"
14 #include "base/macros.h" 15 #include "base/macros.h"
15 #include "base/stl_util.h" 16 #include "base/stl_util.h"
16 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
17 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
18 #include "base/synchronization/waitable_event.h" 19 #include "base/synchronization/waitable_event.h"
19 #include "base/thread_task_runner_handle.h" 20 #include "base/thread_task_runner_handle.h"
20 #include "base/time/time.h" 21 #include "base/time/time.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 L"username_element", 163 L"username_element",
163 L"password_element", 164 L"password_element",
164 L"username_value", 165 L"username_value",
165 L"", 166 L"",
166 true, false, cutoff - 1 }, 167 true, false, cutoff - 1 },
167 }; 168 };
168 169
169 // Build the forms vector and add the forms to the store. 170 // Build the forms vector and add the forms to the store.
170 ScopedVector<PasswordForm> all_forms; 171 ScopedVector<PasswordForm> all_forms;
171 for (size_t i = 0; i < arraysize(form_data); ++i) { 172 for (size_t i = 0; i < arraysize(form_data); ++i) {
172 all_forms.push_back( 173 all_forms.push_back(CreatePasswordFormFromDataForTesting(form_data[i]));
173 CreatePasswordFormFromDataForTesting(form_data[i]).Pass());
174 store->AddLogin(*all_forms.back()); 174 store->AddLogin(*all_forms.back());
175 } 175 }
176 base::MessageLoop::current()->RunUntilIdle(); 176 base::MessageLoop::current()->RunUntilIdle();
177 177
178 // We expect to get back only the "recent" www.google.com login. 178 // We expect to get back only the "recent" www.google.com login.
179 // Theoretically these should never actually exist since there are no longer 179 // Theoretically these should never actually exist since there are no longer
180 // any login forms on www.google.com to save, but we technically allow them. 180 // any login forms on www.google.com to save, but we technically allow them.
181 // We should not get back the older saved password though. 181 // We should not get back the older saved password though.
182 PasswordForm www_google; 182 PasswordForm www_google;
183 www_google.scheme = PasswordForm::SCHEME_HTML; 183 www_google.scheme = PasswordForm::SCHEME_HTML;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 old_primary_key.signon_realm = old_form->signon_realm; 333 old_primary_key.signon_realm = old_form->signon_realm;
334 old_primary_key.origin = old_form->origin; 334 old_primary_key.origin = old_form->origin;
335 old_primary_key.username_element = old_form->username_element; 335 old_primary_key.username_element = old_form->username_element;
336 old_primary_key.username_value = old_form->username_value; 336 old_primary_key.username_value = old_form->username_value;
337 old_primary_key.password_element = old_form->password_element; 337 old_primary_key.password_element = old_form->password_element;
338 store->UpdateLoginWithPrimaryKey(*new_form, old_primary_key); 338 store->UpdateLoginWithPrimaryKey(*new_form, old_primary_key);
339 base::MessageLoop::current()->RunUntilIdle(); 339 base::MessageLoop::current()->RunUntilIdle();
340 340
341 MockPasswordStoreConsumer mock_consumer; 341 MockPasswordStoreConsumer mock_consumer;
342 ScopedVector<autofill::PasswordForm> expected_forms; 342 ScopedVector<autofill::PasswordForm> expected_forms;
343 expected_forms.push_back(new_form.Pass()); 343 expected_forms.push_back(std::move(new_form));
344 EXPECT_CALL(mock_consumer, 344 EXPECT_CALL(mock_consumer,
345 OnGetPasswordStoreResultsConstRef( 345 OnGetPasswordStoreResultsConstRef(
346 UnorderedPasswordFormElementsAre(expected_forms.get()))); 346 UnorderedPasswordFormElementsAre(expected_forms.get())));
347 store->GetAutofillableLogins(&mock_consumer); 347 store->GetAutofillableLogins(&mock_consumer);
348 base::MessageLoop::current()->RunUntilIdle(); 348 base::MessageLoop::current()->RunUntilIdle();
349 349
350 store->RemoveObserver(&mock_observer); 350 store->RemoveObserver(&mock_observer);
351 store->ShutdownOnUIThread(); 351 store->ShutdownOnUIThread();
352 base::MessageLoop::current()->RunUntilIdle(); 352 base::MessageLoop::current()->RunUntilIdle();
353 } 353 }
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 OnGetPasswordStoreResultsConstRef(UnorderedPasswordFormElementsAre( 793 OnGetPasswordStoreResultsConstRef(UnorderedPasswordFormElementsAre(
794 expected_credentials_after_update.get()))); 794 expected_credentials_after_update.get())));
795 store->GetAutofillableLogins(&mock_consumer); 795 store->GetAutofillableLogins(&mock_consumer);
796 store->ShutdownOnUIThread(); 796 store->ShutdownOnUIThread();
797 base::MessageLoop::current()->RunUntilIdle(); 797 base::MessageLoop::current()->RunUntilIdle();
798 } 798 }
799 } 799 }
800 } 800 }
801 801
802 } // namespace password_manager 802 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698