Commit dc61f78b authored by dyu@chromium.org's avatar dyu@chromium.org

Fixed and added new tests in SyncIntegrationTest class.

Added AwaitSyncCycleCompletion function to all tests after signing into sync to allow for full sync before proceeding.
Added Autofill sync test and Credit card sync test.
Changed test page from google.com to local web file using http server.

Disabled SyncIntegrationTest class in FULL suite due to History backend crash when logging into the sync server.

TEST=none
BUG=104227
Review URL: http://codereview.chromium.org/8510075

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110816 0039d316-1c4b-4281-b951-d872f2087c98
parent f1c9371c
...@@ -132,7 +132,7 @@ ...@@ -132,7 +132,7 @@
'win': [ 'win': [
# Enable sync.SyncIntegrationTest only for windows CONTINUIOUS, # Enable sync.SyncIntegrationTest only for windows CONTINUIOUS,
# which contains the sync protobufs. # which contains the sync protobufs.
'sync.SyncIntegrationTest', #'sync.SyncIntegrationTest',
# ================================================== # ==================================================
# Disabled tests that need to be investigated/fixed. # Disabled tests that need to be investigated/fixed.
...@@ -155,14 +155,14 @@ ...@@ -155,14 +155,14 @@
'-passwords.PasswordTest.testClearFetchedCredForNewUserName', '-passwords.PasswordTest.testClearFetchedCredForNewUserName',
# causes browser crash? crbug.com/99865 # causes browser crash? crbug.com/99865
'-prefs.PrefsTest.testGeolocationPref', '-prefs.PrefsTest.testGeolocationPref',
# crbug.com/104227
'-sync.SyncIntegrationTest',
# crbug.com/88679 # crbug.com/88679
'-sync.SyncTest', '-sync.SyncTest',
# crbug.com/86949 # crbug.com/86949
'-sync.SyncTest.testRestartBrowser', '-sync.SyncTest.testRestartBrowser',
# crbug.com/87642 # crbug.com/87642
'-sync.SyncTest.testDisableAndEnableDatatypes', '-sync.SyncTest.testDisableAndEnableDatatypes',
# crbug.com/104179
'-sync.SyncIntegrationTest.testAddBookmarkAndVerifySync',
# crbug.com/95621 # crbug.com/95621
'-youtube.YoutubeTest.testPlayerStatus', '-youtube.YoutubeTest.testPlayerStatus',
# crbug.com/98526 # crbug.com/98526
......
...@@ -130,12 +130,13 @@ class SyncIntegrationTest(pyauto.PyUITest): ...@@ -130,12 +130,13 @@ class SyncIntegrationTest(pyauto.PyUITest):
account_key = 'test_sync_account' account_key = 'test_sync_account'
test_utils.SignInToSyncAndVerifyState(self, account_key) test_utils.SignInToSyncAndVerifyState(self, account_key)
self.AwaitSyncCycleCompletion()
# Add a bookmark. # Add a bookmark.
bookmarks = self.GetBookmarkModel() bookmarks = self.GetBookmarkModel()
bar_id = bookmarks.BookmarkBar()['id'] bar_id = bookmarks.BookmarkBar()['id']
name = 'Google' name = 'Column test'
url = 'http://www.google.com' url = self.GetHttpURLForDataPath('columns.html')
self.NavigateToURL(url) self.NavigateToURL(url)
self.AddBookmarkURL(bar_id, 0, name, url) self.AddBookmarkURL(bar_id, 0, name, url)
...@@ -144,6 +145,7 @@ class SyncIntegrationTest(pyauto.PyUITest): ...@@ -144,6 +145,7 @@ class SyncIntegrationTest(pyauto.PyUITest):
# Log into the account and sync the browser to the account. # Log into the account and sync the browser to the account.
test_utils.SignInToSyncAndVerifyState(browser2, account_key) test_utils.SignInToSyncAndVerifyState(browser2, account_key)
browser2.AwaitSyncCycleCompletion()
# Verify browser 2 contains the bookmark. # Verify browser 2 contains the bookmark.
browser2_bookmarks = browser2.GetBookmarkModel() browser2_bookmarks = browser2.GetBookmarkModel()
...@@ -153,6 +155,72 @@ class SyncIntegrationTest(pyauto.PyUITest): ...@@ -153,6 +155,72 @@ class SyncIntegrationTest(pyauto.PyUITest):
self.assertEqual(bar_child['name'], name) self.assertEqual(bar_child['name'], name)
self.assertTrue(url in bar_child['url']) self.assertTrue(url in bar_child['url'])
def testAutofillProfileSync(self):
"""Verify a single Autofill profile syncs between two browsers.
Integration tests between Autofill and sync feature. A single profile is
added to one instance of the browser, the profile is synced to the account,
a new instance of the browser is launched, the account is synced and the
profile is synced to the new browser.
"""
profile = [{'NAME_FIRST': ['Bob',], 'NAME_LAST': ['Smith',],
'ADDRESS_HOME_ZIP': ['94043',],
'EMAIL_ADDRESS': ['bsmith@gmail.com',],
'COMPANY_NAME': ['Smith, Inc',],}]
# Launch a new instance of the browser with a clean profile (Browser 2).
browser2 = pyauto.ExtraBrowser(
self.ChromeFlagsForSyncTestServer(**self._sync_server.ports))
account_key = 'test_sync_account'
test_utils.SignInToSyncAndVerifyState(self, account_key)
self.AwaitSyncCycleCompletion()
# Add a single profile.
self.FillAutofillProfile(profiles=profile)
browser1_profile = self.GetAutofillProfile()
# Log into the account and sync the second browser to the account.
test_utils.SignInToSyncAndVerifyState(browser2, account_key)
browser2.AwaitSyncCycleCompletion()
# Verify browser 2 contains the profile.
browser2_profile = browser2.GetAutofillProfile()
self.assertEqual(
profile, browser2_profile['profiles'],
msg=('Browser 1 profile %s does not match Browser 2 profile %s'
% (browser1_profile, browser2_profile)))
def testNoCreditCardSync(self):
"""Verify credit card info does not sync between two browsers."""
credit_card = [{'CREDIT_CARD_NUMBER': '6011111111111117',
'CREDIT_CARD_EXP_MONTH': '12',
'CREDIT_CARD_EXP_4_DIGIT_YEAR': '2011',
'CREDIT_CARD_NAME': 'Bob C. Smith'}]
# Launch a new instance of the browser with a clean profile (Browser 2).
browser2 = pyauto.ExtraBrowser(
self.ChromeFlagsForSyncTestServer(**self._sync_server.ports))
account_key = 'test_sync_account'
test_utils.SignInToSyncAndVerifyState(self, account_key)
self.AwaitSyncCycleCompletion()
# Add a credit card.
self.FillAutofillProfile(credit_cards=credit_card)
browser1_profile = self.GetAutofillProfile()
# Verify credit card was added successfully.
self.assertEqual(credit_card, browser1_profile['credit_cards'],
msg='Credit card info was not added to browser 1.')
# Log into the account and sync the second browser to the account.
test_utils.SignInToSyncAndVerifyState(browser2, account_key)
browser2.AwaitSyncCycleCompletion()
# Verify browser 2 does not contain credit card info.
browser2_profile = browser2.GetAutofillProfile()
num_cc_profiles = len(browser2_profile['credit_cards'])
self.assertEqual(0, num_cc_profiles,
msg='Browser 2 unexpectedly contains credit card info.')
if __name__ == '__main__': if __name__ == '__main__':
pyauto_functional.Main() pyauto_functional.Main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment