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

Side by Side Diff: chrome/browser/sync/test/integration/performance/passwords_sync_perf_test.cc

Issue 866983003: GetLoginsRequest: Use ScopedVector to express ownership of forms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@324291_scopedvector
Patch Set: Second fix of the rebase Created 5 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 (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 #include "base/strings/stringprintf.h" 5 #include "base/strings/stringprintf.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "chrome/browser/sync/test/integration/passwords_helper.h" 7 #include "chrome/browser/sync/test/integration/passwords_helper.h"
8 #include "chrome/browser/sync/test/integration/performance/sync_timing_helper.h" 8 #include "chrome/browser/sync/test/integration/performance/sync_timing_helper.h"
9 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" 9 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
10 #include "chrome/browser/sync/test/integration/sync_test.h" 10 #include "chrome/browser/sync/test/integration/sync_test.h"
11 #include "components/password_manager/core/browser/password_store.h" 11 #include "components/password_manager/core/browser/password_store.h"
12 12
13 using passwords_helper::AddLogin; 13 using passwords_helper::AddLogin;
14 using passwords_helper::CreateTestPasswordForm; 14 using passwords_helper::CreateTestPasswordForm;
15 using passwords_helper::GetLogins;
16 using passwords_helper::GetPasswordCount; 15 using passwords_helper::GetPasswordCount;
17 using passwords_helper::GetPasswordStore; 16 using passwords_helper::GetPasswordStore;
18 using passwords_helper::UpdateLogin; 17 using passwords_helper::UpdateLogin;
19 18
20 static const int kNumPasswords = 150; 19 static const int kNumPasswords = 150;
21 20
22 class PasswordsSyncPerfTest : public SyncTest { 21 class PasswordsSyncPerfTest : public SyncTest {
23 public: 22 public:
24 PasswordsSyncPerfTest() : SyncTest(TWO_CLIENT), password_number_(0) {} 23 PasswordsSyncPerfTest() : SyncTest(TWO_CLIENT), password_number_(0) {}
25 24
(...skipping 17 matching lines...) Expand all
43 DISALLOW_COPY_AND_ASSIGN(PasswordsSyncPerfTest); 42 DISALLOW_COPY_AND_ASSIGN(PasswordsSyncPerfTest);
44 }; 43 };
45 44
46 void PasswordsSyncPerfTest::AddLogins(int profile, int num_logins) { 45 void PasswordsSyncPerfTest::AddLogins(int profile, int num_logins) {
47 for (int i = 0; i < num_logins; ++i) { 46 for (int i = 0; i < num_logins; ++i) {
48 AddLogin(GetPasswordStore(profile), NextLogin()); 47 AddLogin(GetPasswordStore(profile), NextLogin());
49 } 48 }
50 } 49 }
51 50
52 void PasswordsSyncPerfTest::UpdateLogins(int profile) { 51 void PasswordsSyncPerfTest::UpdateLogins(int profile) {
53 std::vector<autofill::PasswordForm> logins; 52 ScopedVector<autofill::PasswordForm> logins =
54 GetLogins(GetPasswordStore(profile), logins); 53 passwords_helper::GetLogins(GetPasswordStore(profile));
55 for (std::vector<autofill::PasswordForm>::iterator it = logins.begin(); 54 for (autofill::PasswordForm* login : logins) {
56 it != logins.end(); ++it) { 55 login->password_value = base::ASCIIToUTF16(NextPassword());
57 (*it).password_value = base::ASCIIToUTF16(NextPassword()); 56 UpdateLogin(GetPasswordStore(profile), *login);
58 UpdateLogin(GetPasswordStore(profile), (*it));
59 } 57 }
60 } 58 }
61 59
62 void PasswordsSyncPerfTest::RemoveLogins(int profile) { 60 void PasswordsSyncPerfTest::RemoveLogins(int profile) {
63 passwords_helper::RemoveLogins(GetPasswordStore(profile)); 61 passwords_helper::RemoveLogins(GetPasswordStore(profile));
64 } 62 }
65 63
66 autofill::PasswordForm PasswordsSyncPerfTest::NextLogin() { 64 autofill::PasswordForm PasswordsSyncPerfTest::NextLogin() {
67 return CreateTestPasswordForm(password_number_++); 65 return CreateTestPasswordForm(password_number_++);
68 } 66 }
(...skipping 23 matching lines...) Expand all
92 dt = SyncTimingHelper::TimeUntilQuiescence(clients()); 90 dt = SyncTimingHelper::TimeUntilQuiescence(clients());
93 ASSERT_EQ(kNumPasswords, GetPasswordCount(1)); 91 ASSERT_EQ(kNumPasswords, GetPasswordCount(1));
94 SyncTimingHelper::PrintResult("passwords", "update_passwords", dt); 92 SyncTimingHelper::PrintResult("passwords", "update_passwords", dt);
95 93
96 // TCM ID - 7557852 94 // TCM ID - 7557852
97 RemoveLogins(0); 95 RemoveLogins(0);
98 dt = SyncTimingHelper::TimeUntilQuiescence(clients()); 96 dt = SyncTimingHelper::TimeUntilQuiescence(clients());
99 ASSERT_EQ(0, GetPasswordCount(1)); 97 ASSERT_EQ(0, GetPasswordCount(1));
100 SyncTimingHelper::PrintResult("passwords", "delete_passwords", dt); 98 SyncTimingHelper::PrintResult("passwords", "delete_passwords", dt);
101 } 99 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/test/integration/passwords_helper.cc ('k') | chrome/browser/ui/passwords/password_manager_presenter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698