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

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

Issue 8334030: Merge search engines sync data type with Preferences. Sync the default search provider. Add some ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Merge to TOT and fixed additional conflicts from rsimha. Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/utf_string_conversions.h" 5 #include "base/utf_string_conversions.h"
6 #include "chrome/browser/search_engines/template_url.h" 6 #include "chrome/browser/search_engines/template_url.h"
7 #include "chrome/browser/search_engines/template_url_service.h" 7 #include "chrome/browser/search_engines/template_url_service.h"
8 #include "chrome/browser/sync/profile_sync_service_harness.h" 8 #include "chrome/browser/sync/profile_sync_service_harness.h"
9 #include "chrome/browser/sync/test/integration/search_engines_helper.h" 9 #include "chrome/browser/sync/test/integration/search_engines_helper.h"
10 #include "chrome/browser/sync/test/integration/sync_test.h" 10 #include "chrome/browser/sync/test/integration/sync_test.h"
11 11
12 using search_engines_helper::AddSearchEngine; 12 using search_engines_helper::AddSearchEngine;
13 using search_engines_helper::AllServicesMatch; 13 using search_engines_helper::AllServicesMatch;
14 using search_engines_helper::ChangeDefaultSearchProvider;
14 using search_engines_helper::CreateTestTemplateURL; 15 using search_engines_helper::CreateTestTemplateURL;
15 using search_engines_helper::DeleteSearchEngine; 16 using search_engines_helper::DeleteSearchEngineByKeyword;
17 using search_engines_helper::DeleteSearchEngineBySeed;
16 using search_engines_helper::EditSearchEngine; 18 using search_engines_helper::EditSearchEngine;
17 using search_engines_helper::GetServiceForProfile; 19 using search_engines_helper::GetServiceForProfile;
18 using search_engines_helper::GetVerifierService; 20 using search_engines_helper::GetVerifierService;
19 using search_engines_helper::ServiceMatchesVerifier; 21 using search_engines_helper::ServiceMatchesVerifier;
20 22
21 class TwoClientSearchEnginesSyncTest : public SyncTest { 23 class TwoClientSearchEnginesSyncTest : public SyncTest {
22 public: 24 public:
23 TwoClientSearchEnginesSyncTest() : SyncTest(TWO_CLIENT) {} 25 TwoClientSearchEnginesSyncTest() : SyncTest(TWO_CLIENT) {}
24 virtual ~TwoClientSearchEnginesSyncTest() {} 26 virtual ~TwoClientSearchEnginesSyncTest() {}
25 27
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // TCM ID - 8898660. 92 // TCM ID - 8898660.
91 IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTest, Delete) { 93 IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTest, Delete) {
92 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 94 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
93 ASSERT_TRUE(AllServicesMatch()); 95 ASSERT_TRUE(AllServicesMatch());
94 96
95 AddSearchEngine(0, 0); 97 AddSearchEngine(0, 0);
96 98
97 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 99 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
98 ASSERT_TRUE(AllServicesMatch()); 100 ASSERT_TRUE(AllServicesMatch());
99 101
100 DeleteSearchEngine(0, "test0"); 102 DeleteSearchEngineBySeed(0, 0);
101 103
102 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 104 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
103 ASSERT_TRUE(AllServicesMatch()); 105 ASSERT_TRUE(AllServicesMatch());
104 } 106 }
105 107
106 // TCM ID - 8906436. 108 // TCM ID - 8906436.
107 IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTest, DisableSync) { 109 IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTest, DisableSync) {
108 ASSERT_TRUE(SetupSync()); 110 ASSERT_TRUE(SetupSync());
109 ASSERT_TRUE(AllServicesMatch()); 111 ASSERT_TRUE(AllServicesMatch());
110 112
111 ASSERT_TRUE(GetClient(1)->DisableSyncForAllDatatypes()); 113 ASSERT_TRUE(GetClient(1)->DisableSyncForAllDatatypes());
112 AddSearchEngine(0, 0); 114 AddSearchEngine(0, 0);
113 ASSERT_TRUE( 115 ASSERT_TRUE(
114 GetClient(0)->AwaitFullSyncCompletion("Added a search engine.")); 116 GetClient(0)->AwaitFullSyncCompletion("Added a search engine."));
115 ASSERT_TRUE(ServiceMatchesVerifier(0)); 117 ASSERT_TRUE(ServiceMatchesVerifier(0));
116 ASSERT_FALSE(ServiceMatchesVerifier(1)); 118 ASSERT_FALSE(ServiceMatchesVerifier(1));
117 119
118 ASSERT_TRUE(GetClient(1)->EnableSyncForAllDatatypes()); 120 ASSERT_TRUE(GetClient(1)->EnableSyncForAllDatatypes());
119 ASSERT_TRUE(AwaitQuiescence()); 121 ASSERT_TRUE(AwaitQuiescence());
120 ASSERT_TRUE(AllServicesMatch()); 122 ASSERT_TRUE(AllServicesMatch());
121 } 123 }
124
125 // TCM ID - 8891809.
126 IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTest, SyncDefault) {
127 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
128 ASSERT_TRUE(AllServicesMatch());
129
130 AddSearchEngine(0, 0);
131 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
132
133 // Change the default to the new search engine, sync, and ensure that it
134 // changed in the second client. AllServicesMatch does a default search
135 // provider check.
136 ChangeDefaultSearchProvider(0, 0);
137 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
138
139 ASSERT_TRUE(AllServicesMatch());
140 }
141
142 // Ensure that we can change the search engine and immediately delete it
143 // without putting the clients out of sync.
144 IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTest, DeleteSyncedDefault) {
145 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
146 ASSERT_TRUE(AllServicesMatch());
147
148 AddSearchEngine(0, 0);
149 AddSearchEngine(0, 1);
150 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
151
152 ChangeDefaultSearchProvider(0, 0);
153 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
154 ASSERT_TRUE(AllServicesMatch());
155
156 // Change the default on the first client and delete the old default.
157 ChangeDefaultSearchProvider(0, 1);
158 DeleteSearchEngineBySeed(0, 0);
159 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
160
161 ASSERT_TRUE(AllServicesMatch());
162 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698