OLD | NEW |
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 <stdint.h> |
| 6 |
| 7 #include <limits> |
| 8 |
5 #include "base/guid.h" | 9 #include "base/guid.h" |
6 #include "base/hash.h" | 10 #include "base/hash.h" |
7 #include "base/rand_util.h" | 11 #include "base/rand_util.h" |
8 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/sync/test/integration/passwords_helper.h" | 13 #include "chrome/browser/sync/test/integration/passwords_helper.h" |
10 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" | 14 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" |
11 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h" | 15 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h" |
12 #include "chrome/browser/sync/test/integration/sync_test.h" | 16 #include "chrome/browser/sync/test/integration/sync_test.h" |
13 #include "sync/internal_api/public/engine/model_safe_worker.h" | 17 #include "sync/internal_api/public/engine/model_safe_worker.h" |
14 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" | 18 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 IN_PROC_BROWSER_TEST_F(TwoClientPasswordsSyncTest, E2E_ONLY(TwoClientAddPass)) { | 217 IN_PROC_BROWSER_TEST_F(TwoClientPasswordsSyncTest, E2E_ONLY(TwoClientAddPass)) { |
214 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 218 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
215 // All profiles should sync same passwords. | 219 // All profiles should sync same passwords. |
216 ASSERT_TRUE(AwaitAllProfilesContainSamePasswordForms()) << | 220 ASSERT_TRUE(AwaitAllProfilesContainSamePasswordForms()) << |
217 "Initial password forms did not match for all profiles"; | 221 "Initial password forms did not match for all profiles"; |
218 const int init_password_count = GetPasswordCount(0); | 222 const int init_password_count = GetPasswordCount(0); |
219 | 223 |
220 // Add one new password per profile. A unique form is created for each to | 224 // Add one new password per profile. A unique form is created for each to |
221 // prevent them from overwriting each other. | 225 // prevent them from overwriting each other. |
222 for (int i = 0; i < num_clients(); ++i) { | 226 for (int i = 0; i < num_clients(); ++i) { |
223 AddLogin(GetPasswordStore(i), | 227 AddLogin(GetPasswordStore(i), CreateTestPasswordForm(base::RandInt( |
224 CreateTestPasswordForm(base::RandInt(0, kint32max))); | 228 0, std::numeric_limits<int32_t>::max()))); |
225 } | 229 } |
226 | 230 |
227 // Blocks and waits for password forms in all profiles to match. | 231 // Blocks and waits for password forms in all profiles to match. |
228 ASSERT_TRUE(AwaitAllProfilesContainSamePasswordForms()); | 232 ASSERT_TRUE(AwaitAllProfilesContainSamePasswordForms()); |
229 | 233 |
230 // Check that total number of passwords is as expected. | 234 // Check that total number of passwords is as expected. |
231 for (int i = 0; i < num_clients(); ++i) { | 235 for (int i = 0; i < num_clients(); ++i) { |
232 ASSERT_EQ(GetPasswordCount(i), init_password_count + num_clients()) << | 236 ASSERT_EQ(GetPasswordCount(i), init_password_count + num_clients()) << |
233 "Total password count is wrong."; | 237 "Total password count is wrong."; |
234 } | 238 } |
235 } | 239 } |
OLD | NEW |