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

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

Issue 9692072: Clean up some sync integration test code. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync/test/integration/search_engines_helper.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 } 55 }
56 56
57 // TCM ID - 9011135. 57 // TCM ID - 9011135.
58 IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTest, Duplicates) { 58 IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTest, Duplicates) {
59 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 59 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
60 ASSERT_TRUE(AllServicesMatch()); 60 ASSERT_TRUE(AllServicesMatch());
61 61
62 // Add two entries with the same Name and URL (but different keywords). 62 // Add two entries with the same Name and URL (but different keywords).
63 // Note that we have to change the GUID of the duplicate. 63 // Note that we have to change the GUID of the duplicate.
64 AddSearchEngine(0, 0); 64 AddSearchEngine(0, 0);
65 65 GetServiceForProfile(0)->Add(CreateTestTemplateURL(0,
66 TemplateURL* dupe = CreateTestTemplateURL(0); 66 ASCIIToUTF16("somethingelse"), "newguid"));
67 dupe->set_keyword(ASCIIToUTF16("somethingelse")); 67 GetVerifierService()->Add(CreateTestTemplateURL(0,
68 dupe->set_sync_guid("newguid"); 68 ASCIIToUTF16("somethingelse"), "newguid"));
69 GetServiceForProfile(0)->Add(dupe);
70
71 TemplateURL* verifier_dupe = CreateTestTemplateURL(0);
72 verifier_dupe->set_keyword(ASCIIToUTF16("somethingelse"));
73 verifier_dupe->set_sync_guid("newguid");
74 GetVerifierService()->Add(verifier_dupe);
75
76 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 69 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
77 ASSERT_TRUE(AllServicesMatch()); 70 ASSERT_TRUE(AllServicesMatch());
78 } 71 }
79 72
80 // TCM ID - 9004201. 73 // TCM ID - 9004201.
81 IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTest, UpdateKeyword) { 74 IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTest, UpdateKeyword) {
82 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 75 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
83 ASSERT_TRUE(AllServicesMatch()); 76 ASSERT_TRUE(AllServicesMatch());
84 77
85 AddSearchEngine(0, 0); 78 AddSearchEngine(0, 0);
86 79
87 // Change the keyword. 80 // Change the keyword.
88 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 81 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
89 ASSERT_TRUE(AllServicesMatch()); 82 ASSERT_TRUE(AllServicesMatch());
90 83
91 EditSearchEngine(0, "test0", "test0", "newkeyword", "http://www.test0.com/"); 84 EditSearchEngine(0, ASCIIToUTF16("test0"), ASCIIToUTF16("test0"),
85 ASCIIToUTF16("newkeyword"), "http://www.test0.com/");
92 86
93 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 87 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
94 ASSERT_TRUE(AllServicesMatch()); 88 ASSERT_TRUE(AllServicesMatch());
95 } 89 }
96 90
97 // TCM ID - 8894859. 91 // TCM ID - 8894859.
98 IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTest, UpdateUrl) { 92 IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTest, UpdateUrl) {
99 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 93 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
100 ASSERT_TRUE(AllServicesMatch()); 94 ASSERT_TRUE(AllServicesMatch());
101 95
102 AddSearchEngine(0, 0); 96 AddSearchEngine(0, 0);
103 97
104 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 98 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
105 ASSERT_TRUE(AllServicesMatch()); 99 ASSERT_TRUE(AllServicesMatch());
106 100
107 // Change the URL. 101 // Change the URL.
108 EditSearchEngine(0, "test0", "test0", "test0", 102 EditSearchEngine(0, ASCIIToUTF16("test0"), ASCIIToUTF16("test0"),
109 "http://www.wikipedia.org/q=%s"); 103 ASCIIToUTF16("test0"), "http://www.wikipedia.org/q=%s");
110 104
111 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 105 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
112 ASSERT_TRUE(AllServicesMatch()); 106 ASSERT_TRUE(AllServicesMatch());
113 } 107 }
114 108
115 // TCM ID - 8910490. 109 // TCM ID - 8910490.
116 IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTest, UpdateName) { 110 IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTest, UpdateName) {
117 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 111 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
118 ASSERT_TRUE(AllServicesMatch()); 112 ASSERT_TRUE(AllServicesMatch());
119 113
120 AddSearchEngine(0, 0); 114 AddSearchEngine(0, 0);
121 115
122 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 116 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
123 ASSERT_TRUE(AllServicesMatch()); 117 ASSERT_TRUE(AllServicesMatch());
124 118
125 // Change the short name. 119 // Change the short name.
126 EditSearchEngine(0, "test0", "New Name", "test0", "http://www.test0.com/"); 120 EditSearchEngine(0, ASCIIToUTF16("test0"), ASCIIToUTF16("New Name"),
121 ASCIIToUTF16("test0"), "http://www.test0.com/");
127 122
128 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 123 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
129 ASSERT_TRUE(AllServicesMatch()); 124 ASSERT_TRUE(AllServicesMatch());
130 } 125 }
131 126
132 // TCM ID - 8898660. 127 // TCM ID - 8898660.
133 IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTest, Delete) { 128 IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTest, Delete) {
134 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 129 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
135 ASSERT_TRUE(AllServicesMatch()); 130 ASSERT_TRUE(AllServicesMatch());
136 131
(...skipping 11 matching lines...) Expand all
148 // TCM ID - 9004196. 143 // TCM ID - 9004196.
149 IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTest, ConflictKeyword) { 144 IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTest, ConflictKeyword) {
150 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 145 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
151 DisableVerifier(); 146 DisableVerifier();
152 ASSERT_TRUE(AllServicesMatch()); 147 ASSERT_TRUE(AllServicesMatch());
153 148
154 // Add a different search engine to each client, but make their keywords 149 // Add a different search engine to each client, but make their keywords
155 // conflict. 150 // conflict.
156 AddSearchEngine(0, 0); 151 AddSearchEngine(0, 0);
157 AddSearchEngine(1, 1); 152 AddSearchEngine(1, 1);
158 const TemplateURL* turl = GetServiceForProfile(1)-> 153 const TemplateURL* turl = GetServiceForProfile(1)->GetTemplateURLForKeyword(
159 GetTemplateURLForKeyword(ASCIIToUTF16("test1")); 154 ASCIIToUTF16("test1"));
160 EXPECT_TRUE(turl); 155 EXPECT_TRUE(turl);
161 GetServiceForProfile(1)->ResetTemplateURL(turl, 156 GetServiceForProfile(1)->ResetTemplateURL(turl,
162 turl->short_name(), 157 turl->short_name(),
163 ASCIIToUTF16("test0"), 158 ASCIIToUTF16("test0"),
164 turl->url()->url()); 159 turl->url()->url());
165 160
166 ASSERT_TRUE(AwaitQuiescence()); 161 ASSERT_TRUE(AwaitQuiescence());
167 ASSERT_TRUE(AllServicesMatch()); 162 ASSERT_TRUE(AllServicesMatch());
168 } 163 }
169 164
170 // TCM ID - 9004187. 165 // TCM ID - 9004187.
171 IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTest, MergeMultiple) { 166 IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTest, MergeMultiple) {
172 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 167 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
173 DisableVerifier(); 168 DisableVerifier();
174 ASSERT_TRUE(AllServicesMatch()); 169 ASSERT_TRUE(AllServicesMatch());
175 170
176 // Set up some different search engines on each client, with some interesting 171 // Set up some different search engines on each client, with some interesting
177 // conflicts. 172 // conflicts.
178 // client0: { SE0, SE1, SE2 } 173 // client0: { SE0, SE1, SE2 }
179 for (int i = 0; i < 3; ++i) { 174 for (int i = 0; i < 3; ++i) {
180 AddSearchEngine(0, i); 175 AddSearchEngine(0, i);
181 } 176 }
182 177
183 // client1: { SE0, SE2, SE3, SE0 + different URL } 178 // client1: { SE0, SE2, SE3, SE0 + different URL }
184 AddSearchEngine(1, 0); 179 AddSearchEngine(1, 0);
185 AddSearchEngine(1, 2); 180 AddSearchEngine(1, 2);
186 AddSearchEngine(1, 3); 181 AddSearchEngine(1, 3);
187 TemplateURL* turl = CreateTestTemplateURL(0); 182 GetServiceForProfile(1)->Add(CreateTestTemplateURL(0,
188 turl->SetURL("http://www.somethingelse.com/", 0, 0); 183 "http://www.somethingelse.com/", ASCIIToUTF16("somethingelse.com"),
189 turl->set_keyword(ASCIIToUTF16("somethingelse.com")); 184 "somethingelse"));
190 turl->set_sync_guid("somethingelse");
191 GetServiceForProfile(1)->Add(turl);
192 185
193 ASSERT_TRUE(AwaitQuiescence()); 186 ASSERT_TRUE(AwaitQuiescence());
194 ASSERT_TRUE(AllServicesMatch()); 187 ASSERT_TRUE(AllServicesMatch());
195 } 188 }
196 189
197 // TCM ID - 8906436. 190 // TCM ID - 8906436.
198 IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTest, DisableSync) { 191 IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTest, DisableSync) {
199 ASSERT_TRUE(SetupSync()); 192 ASSERT_TRUE(SetupSync());
200 ASSERT_TRUE(AllServicesMatch()); 193 ASSERT_TRUE(AllServicesMatch());
201 194
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 235 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
243 ASSERT_TRUE(AllServicesMatch()); 236 ASSERT_TRUE(AllServicesMatch());
244 237
245 // Change the default on the first client and delete the old default. 238 // Change the default on the first client and delete the old default.
246 ChangeDefaultSearchProvider(0, 1); 239 ChangeDefaultSearchProvider(0, 1);
247 DeleteSearchEngineBySeed(0, 0); 240 DeleteSearchEngineBySeed(0, 0);
248 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 241 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
249 242
250 ASSERT_TRUE(AllServicesMatch()); 243 ASSERT_TRUE(AllServicesMatch());
251 } 244 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/test/integration/search_engines_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698