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

Side by Side Diff: chrome/test/functional/sync.py

Issue 8510075: Fixed and added new tests in SyncIntegrationTest class. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' 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
« no previous file with comments | « chrome/test/functional/PYAUTO_TESTS ('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 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import pyauto_functional # Must be imported before pyauto 6 import pyauto_functional # Must be imported before pyauto
7 import pyauto 7 import pyauto
8 import test_utils 8 import test_utils
9 9
10 10
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 added to one instance of the browser, the bookmark is synced to the account, 123 added to one instance of the browser, the bookmark is synced to the account,
124 a new instance of the browser is launched, the account is synced and the 124 a new instance of the browser is launched, the account is synced and the
125 bookmark info is synced on the new browser. 125 bookmark info is synced on the new browser.
126 """ 126 """
127 # Launch a new instance of the browser with a clean profile (Browser 2) 127 # Launch a new instance of the browser with a clean profile (Browser 2)
128 browser2 = pyauto.ExtraBrowser( 128 browser2 = pyauto.ExtraBrowser(
129 self.ChromeFlagsForSyncTestServer(**self._sync_server.ports)) 129 self.ChromeFlagsForSyncTestServer(**self._sync_server.ports))
130 130
131 account_key = 'test_sync_account' 131 account_key = 'test_sync_account'
132 test_utils.SignInToSyncAndVerifyState(self, account_key) 132 test_utils.SignInToSyncAndVerifyState(self, account_key)
133 self.AwaitSyncCycleCompletion()
133 134
134 # Add a bookmark. 135 # Add a bookmark.
135 bookmarks = self.GetBookmarkModel() 136 bookmarks = self.GetBookmarkModel()
136 bar_id = bookmarks.BookmarkBar()['id'] 137 bar_id = bookmarks.BookmarkBar()['id']
137 name = 'Google' 138 name = 'Column test'
138 url = 'http://www.google.com' 139 url = self.GetHttpURLForDataPath('columns.html')
139 self.NavigateToURL(url) 140 self.NavigateToURL(url)
140 self.AddBookmarkURL(bar_id, 0, name, url) 141 self.AddBookmarkURL(bar_id, 0, name, url)
141 142
142 # Refresh the bookmarks in the first browser. 143 # Refresh the bookmarks in the first browser.
143 bookmarks = self.GetBookmarkModel() 144 bookmarks = self.GetBookmarkModel()
144 145
145 # Log into the account and sync the browser to the account. 146 # Log into the account and sync the browser to the account.
146 test_utils.SignInToSyncAndVerifyState(browser2, account_key) 147 test_utils.SignInToSyncAndVerifyState(browser2, account_key)
148 browser2.AwaitSyncCycleCompletion()
147 149
148 # Verify browser 2 contains the bookmark. 150 # Verify browser 2 contains the bookmark.
149 browser2_bookmarks = browser2.GetBookmarkModel() 151 browser2_bookmarks = browser2.GetBookmarkModel()
150 self.assertEqual(browser2_bookmarks.NodeCount(), bookmarks.NodeCount()) 152 self.assertEqual(browser2_bookmarks.NodeCount(), bookmarks.NodeCount())
151 bar_child = browser2_bookmarks.BookmarkBar()['children'][0] 153 bar_child = browser2_bookmarks.BookmarkBar()['children'][0]
152 self.assertEqual(bar_child['type'], 'url') 154 self.assertEqual(bar_child['type'], 'url')
153 self.assertEqual(bar_child['name'], name) 155 self.assertEqual(bar_child['name'], name)
154 self.assertTrue(url in bar_child['url']) 156 self.assertTrue(url in bar_child['url'])
155 157
158 def testAutofillProfileSync(self):
159 """Verify a single Autofill profile syncs between two browsers.
160
161 Integration tests between Autofill and sync feature. A single profile is
162 added to one instance of the browser, the profile is synced to the account,
163 a new instance of the browser is launched, the account is synced and the
164 profile is synced to the new browser.
165 """
166 profile = [{'NAME_FIRST': ['Bob',], 'NAME_LAST': ['Smith',],
167 'ADDRESS_HOME_ZIP': ['94043',],
168 'EMAIL_ADDRESS': ['bsmith@gmail.com',],
169 'COMPANY_NAME': ['Smith, Inc',],}]
170 # Launch a new instance of the browser with a clean profile (Browser 2).
171 browser2 = pyauto.ExtraBrowser(
172 self.ChromeFlagsForSyncTestServer(**self._sync_server.ports))
173
174 account_key = 'test_sync_account'
175 test_utils.SignInToSyncAndVerifyState(self, account_key)
176 self.AwaitSyncCycleCompletion()
177
178 # Add a single profile.
179 self.FillAutofillProfile(profiles=profile)
180 browser1_profile = self.GetAutofillProfile()
181
182 # Log into the account and sync the second browser to the account.
183 test_utils.SignInToSyncAndVerifyState(browser2, account_key)
184 browser2.AwaitSyncCycleCompletion()
185
186 # Verify browser 2 contains the profile.
187 browser2_profile = browser2.GetAutofillProfile()
188 self.assertEqual(
189 profile, browser2_profile['profiles'],
190 msg=('Browser 1 profile %s does not match Browser 2 profile %s'
191 % (browser1_profile, browser2_profile)))
192
193 def testNoCreditCardSync(self):
194 """Verify credit card info does not sync between two browsers."""
195 credit_card = [{'CREDIT_CARD_NUMBER': '6011111111111117',
196 'CREDIT_CARD_EXP_MONTH': '12',
197 'CREDIT_CARD_EXP_4_DIGIT_YEAR': '2011',
198 'CREDIT_CARD_NAME': 'Bob C. Smith'}]
199 # Launch a new instance of the browser with a clean profile (Browser 2).
200 browser2 = pyauto.ExtraBrowser(
201 self.ChromeFlagsForSyncTestServer(**self._sync_server.ports))
202
203 account_key = 'test_sync_account'
204 test_utils.SignInToSyncAndVerifyState(self, account_key)
205 self.AwaitSyncCycleCompletion()
206
207 # Add a credit card.
208 self.FillAutofillProfile(credit_cards=credit_card)
209 browser1_profile = self.GetAutofillProfile()
210 # Verify credit card was added successfully.
211 self.assertEqual(credit_card, browser1_profile['credit_cards'],
212 msg='Credit card info was not added to browser 1.')
213
214 # Log into the account and sync the second browser to the account.
215 test_utils.SignInToSyncAndVerifyState(browser2, account_key)
216 browser2.AwaitSyncCycleCompletion()
217
218 # Verify browser 2 does not contain credit card info.
219 browser2_profile = browser2.GetAutofillProfile()
220 num_cc_profiles = len(browser2_profile['credit_cards'])
221 self.assertEqual(0, num_cc_profiles,
222 msg='Browser 2 unexpectedly contains credit card info.')
223
156 224
157 if __name__ == '__main__': 225 if __name__ == '__main__':
158 pyauto_functional.Main() 226 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « chrome/test/functional/PYAUTO_TESTS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698