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

Unified Diff: chrome/browser/sync/test/integration/two_client_autofill_sync_test.cc

Issue 8787006: Delay autofill commits to reduce client to server traffic. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for commit. Created 9 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sync/internal_api/syncapi_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/test/integration/two_client_autofill_sync_test.cc
diff --git a/chrome/browser/sync/test/integration/two_client_autofill_sync_test.cc b/chrome/browser/sync/test/integration/two_client_autofill_sync_test.cc
index ebe6e535599d5184a794471589f3e8bee21affd0..f542c4ae4655e8dde630a8282873c7ca7a45cca1 100644
--- a/chrome/browser/sync/test/integration/two_client_autofill_sync_test.cc
+++ b/chrome/browser/sync/test/integration/two_client_autofill_sync_test.cc
@@ -6,6 +6,7 @@
#include "chrome/browser/autofill/autofill_profile.h"
#include "chrome/browser/sync/profile_sync_service_harness.h"
#include "chrome/browser/sync/test/integration/autofill_helper.h"
+#include "chrome/browser/sync/test/integration/bookmarks_helper.h"
#include "chrome/browser/sync/test/integration/sync_test.h"
#include "chrome/browser/webdata/autofill_entry.h"
#include "chrome/browser/webdata/autofill_table.h"
@@ -24,13 +25,25 @@ using autofill_helper::PROFILE_NULL;
using autofill_helper::RemoveKey;
using autofill_helper::RemoveProfile;
using autofill_helper::UpdateProfile;
+using bookmarks_helper::AddFolder;
+using bookmarks_helper::AddURL;
+using bookmarks_helper::IndexedURL;
+using bookmarks_helper::IndexedURLTitle;
class TwoClientAutofillSyncTest : public SyncTest {
public:
- TwoClientAutofillSyncTest() : SyncTest(TWO_CLIENT) {}
+ TwoClientAutofillSyncTest() : SyncTest(TWO_CLIENT) { count = 0; }
virtual ~TwoClientAutofillSyncTest() {}
+ // We do this so as to make a change that will trigger the autofill to sync.
+ // By default autofill does not sync unless there is some other change.
+ void MakeABookmarkChange(int profile) {
+ ASSERT_TRUE(
+ AddURL(profile, IndexedURLTitle(count), GURL(IndexedURL(count))));
+ ++count;
+ }
private:
+ int count;
DISALLOW_COPY_AND_ASSIGN(TwoClientAutofillSyncTest);
};
@@ -42,6 +55,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, FLAKY_WebDataServiceSanity) {
std::set<AutofillKey> keys;
keys.insert(AutofillKey("name0", "value0"));
AddKeys(0, keys);
+ MakeABookmarkChange(0);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(KeysMatch(0, 1));
ASSERT_EQ(1U, GetAllKeys(0).size());
@@ -50,6 +64,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, FLAKY_WebDataServiceSanity) {
keys.clear();
keys.insert(AutofillKey("name1", "value1-0"));
AddKeys(1, keys);
+ MakeABookmarkChange(1);
ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0)));
ASSERT_TRUE(KeysMatch(0, 1));
ASSERT_EQ(2U, GetAllKeys(0).size());
@@ -58,12 +73,14 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, FLAKY_WebDataServiceSanity) {
keys.clear();
keys.insert(AutofillKey("name1", "value1-1"));
AddKeys(0, keys);
+ MakeABookmarkChange(0);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(KeysMatch(0, 1));
ASSERT_EQ(3U, GetAllKeys(0).size());
// Client1 removes a key.
RemoveKey(1, AutofillKey("name1", "value1-0"));
+ MakeABookmarkChange(1);
ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0)));
ASSERT_TRUE(KeysMatch(0, 1));
ASSERT_EQ(2U, GetAllKeys(0).size());
@@ -71,6 +88,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, FLAKY_WebDataServiceSanity) {
// Client0 removes the rest.
RemoveKey(0, AutofillKey("name0", "value0"));
RemoveKey(0, AutofillKey("name1", "value1-1"));
+ MakeABookmarkChange(0);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(KeysMatch(0, 1));
ASSERT_EQ(0U, GetAllKeys(0).size());
@@ -131,24 +149,28 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest,
// Client0 adds a profile.
AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
+ MakeABookmarkChange(0);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(ProfilesMatch(0, 1));
ASSERT_EQ(1U, GetAllProfiles(0).size());
// Client1 adds a profile.
AddProfile(1, CreateAutofillProfile(PROFILE_MARION));
+ MakeABookmarkChange(1);
ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0)));
ASSERT_TRUE(ProfilesMatch(0, 1));
ASSERT_EQ(2U, GetAllProfiles(0).size());
// Client0 adds the same profile.
AddProfile(0, CreateAutofillProfile(PROFILE_MARION));
+ MakeABookmarkChange(0);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(ProfilesMatch(0, 1));
ASSERT_EQ(2U, GetAllProfiles(0).size());
// Client1 removes a profile.
RemoveProfile(1, GetAllProfiles(1)[0]->guid());
+ MakeABookmarkChange(1);
ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0)));
ASSERT_TRUE(ProfilesMatch(0, 1));
ASSERT_EQ(1U, GetAllProfiles(0).size());
@@ -158,12 +180,14 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest,
GetAllProfiles(0)[0]->guid(),
AutofillType(NAME_FIRST),
ASCIIToUTF16("Bart"));
+ MakeABookmarkChange(0);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(ProfilesMatch(0, 1));
ASSERT_EQ(1U, GetAllProfiles(0).size());
// Client1 removes remaining profile.
RemoveProfile(1, GetAllProfiles(1)[0]->guid());
+ MakeABookmarkChange(1);
ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0)));
ASSERT_TRUE(ProfilesMatch(0, 1));
ASSERT_EQ(0U, GetAllProfiles(0).size());
@@ -212,6 +236,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddProfile) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
+ MakeABookmarkChange(0);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(ProfilesMatch(0, 1));
ASSERT_EQ(1U, GetAllProfiles(0).size());
@@ -224,6 +249,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddMultipleProfiles) {
AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
AddProfile(0, CreateAutofillProfile(PROFILE_MARION));
AddProfile(0, CreateAutofillProfile(PROFILE_FRASIER));
+ MakeABookmarkChange(0);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(ProfilesMatch(0, 1));
ASSERT_EQ(3U, GetAllProfiles(0).size());
@@ -234,11 +260,13 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DeleteProfile) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
+ MakeABookmarkChange(0);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(ProfilesMatch(0, 1));
ASSERT_EQ(1U, GetAllProfiles(0).size());
RemoveProfile(1, GetAllProfiles(1)[0]->guid());
+ MakeABookmarkChange(1);
ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0)));
ASSERT_TRUE(ProfilesMatch(0, 1));
ASSERT_EQ(0U, GetAllProfiles(0).size());
@@ -262,6 +290,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, UpdateFields) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
+ MakeABookmarkChange(0);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(ProfilesMatch(0, 1));
ASSERT_EQ(1U, GetAllProfiles(0).size());
@@ -274,6 +303,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, UpdateFields) {
GetAllProfiles(0)[0]->guid(),
AutofillType(EMAIL_ADDRESS),
ASCIIToUTF16("grrrl@TV.com"));
+ MakeABookmarkChange(0);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(ProfilesMatch(0, 1));
ASSERT_EQ(1U, GetAllProfiles(0).size());
@@ -284,6 +314,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, ConflictingFields) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
+ MakeABookmarkChange(0);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(ProfilesMatch(0, 1));
ASSERT_EQ(1U, GetAllProfiles(0).size());
@@ -291,10 +322,12 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, ConflictingFields) {
GetAllProfiles(0)[0]->guid(),
AutofillType(NAME_FIRST),
ASCIIToUTF16("Lisa"));
+ MakeABookmarkChange(0);
UpdateProfile(1,
GetAllProfiles(1)[0]->guid(),
AutofillType(NAME_FIRST),
ASCIIToUTF16("Bart"));
+ MakeABookmarkChange(1);
ASSERT_TRUE(AwaitQuiescence());
ASSERT_TRUE(ProfilesMatch(0, 1));
ASSERT_EQ(1U, GetAllProfiles(0).size());
@@ -305,18 +338,21 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DisableAutofill) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
+ MakeABookmarkChange(0);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(ProfilesMatch(0, 1));
ASSERT_EQ(1U, GetAllProfiles(0).size());
ASSERT_TRUE(GetClient(0)->DisableSyncForDatatype(syncable::AUTOFILL));
AddProfile(0, CreateAutofillProfile(PROFILE_FRASIER));
+ MakeABookmarkChange(0);
ASSERT_TRUE(AwaitQuiescence());
ASSERT_FALSE(ProfilesMatch(0, 1));
ASSERT_EQ(2U, GetAllProfiles(0).size());
ASSERT_EQ(1U, GetAllProfiles(1).size());
ASSERT_TRUE(GetClient(0)->EnableSyncForDatatype(syncable::AUTOFILL));
+ MakeABookmarkChange(0);
ASSERT_TRUE(AwaitQuiescence());
ASSERT_TRUE(ProfilesMatch(0, 1));
ASSERT_EQ(2U, GetAllProfiles(0).size());
@@ -327,12 +363,14 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DisableSync) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
+ MakeABookmarkChange(0);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(ProfilesMatch(0, 1));
ASSERT_EQ(1U, GetAllProfiles(0).size());
ASSERT_TRUE(GetClient(1)->DisableSyncForAllDatatypes());
AddProfile(0, CreateAutofillProfile(PROFILE_FRASIER));
+ MakeABookmarkChange(0);
ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion("Added a profile."));
ASSERT_FALSE(ProfilesMatch(0, 1));
ASSERT_EQ(2U, GetAllProfiles(0).size());
@@ -349,6 +387,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, MaxLength) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
+ MakeABookmarkChange(0);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(ProfilesMatch(0, 1));
ASSERT_EQ(1U, GetAllProfiles(0).size());
@@ -371,6 +410,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, MaxLength) {
AutofillType(ADDRESS_HOME_LINE1),
max_length_string);
+ MakeABookmarkChange(0);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(ProfilesMatch(0, 1));
}
@@ -379,6 +419,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, ExceedsMaxLength) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
+ MakeABookmarkChange(0);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(ProfilesMatch(0, 1));
ASSERT_EQ(1U, GetAllProfiles(0).size());
@@ -401,6 +442,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, ExceedsMaxLength) {
AutofillType(ADDRESS_HOME_LINE1),
exceeds_max_length_string);
+ MakeABookmarkChange(0);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_FALSE(ProfilesMatch(0, 1));
}
« no previous file with comments | « chrome/browser/sync/internal_api/syncapi_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698