Chromium Code Reviews| Index: chrome/test/functional/sync.py |
| =================================================================== |
| --- chrome/test/functional/sync.py (revision 109993) |
| +++ chrome/test/functional/sync.py (working copy) |
| @@ -134,8 +134,8 @@ |
| # Add a bookmark. |
| bookmarks = self.GetBookmarkModel() |
| bar_id = bookmarks.BookmarkBar()['id'] |
| - name = 'Google' |
| - url = 'http://www.google.com' |
| + name = 'Basic Page' |
| + url = self.GetHttpURLForDataPath('sync', 'basic_page.html') |
| self.NavigateToURL(url) |
| self.AddBookmarkURL(bar_id, 0, name, url) |
| @@ -144,6 +144,7 @@ |
| # Log into the account and sync the browser to the account. |
| test_utils.SignInToSyncAndVerifyState(browser2, account_key) |
| + self.AwaitSyncCycleCompletion() |
| # Verify browser 2 contains the bookmark. |
| browser2_bookmarks = browser2.GetBookmarkModel() |
| @@ -153,6 +154,67 @@ |
| self.assertEqual(bar_child['name'], name) |
| self.assertTrue(url in bar_child['url']) |
| + def testAddSingleProfileAndVerifySync(self): |
| + """Verify a single 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) |
|
dennis_jeffrey
2011/11/15 02:07:13
nit: period at end of sentence
dyu1
2011/11/15 02:56:08
Done.
|
| + browser2 = pyauto.ExtraBrowser( |
| + self.ChromeFlagsForSyncTestServer(**self._sync_server.ports)) |
| + |
| + account_key = 'test_sync_account' |
| + test_utils.SignInToSyncAndVerifyState(self, account_key) |
| + |
| + # Add a single profile. |
| + self.FillAutofillProfile(profiles=profile, credit_cards=credit_card) |
|
dennis_jeffrey
2011/11/15 02:07:13
where is "credit_card" defined?
dyu1
2011/11/15 02:56:08
Removed.
|
| + browser1_profile = self.GetAutofillProfile() |
| + |
| + # Log into the account and sync the browser to the account. |
|
dennis_jeffrey
2011/11/15 02:07:13
'...sync the second browser...'
dyu1
2011/11/15 02:56:08
Done.
|
| + test_utils.SignInToSyncAndVerifyState(browser2, account_key) |
| + self.AwaitSyncCycleCompletion() |
| + |
| + # Verify browser 2 contains the profile. |
| + browser2_profile = browser2.GetAutofillProfile() |
| + self.assertEqual( |
| + profile, browser2_profile['profiles'], |
| + msg=('Browser 1 profile %d does not match Browser 2 profile %d' |
|
dennis_jeffrey
2011/11/15 02:07:13
Do you mean '%s' instead of '%d'? I think the val
dyu1
2011/11/15 02:56:08
Done.
|
| + % (browser1_profile, browser2_profile))) |
| + |
| + def testAddCreditCardAndVerifyNoSync(self): |
| + """Verify credit card info does not sync between wto browsers.""" |
|
dennis_jeffrey
2011/11/15 02:07:13
'wto' --> 'two'
dyu1
2011/11/15 02:56:08
Done.
|
| + 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) |
|
dennis_jeffrey
2011/11/15 02:07:13
nit: period at end of sentence
dyu1
2011/11/15 02:56:08
Done.
|
| + browser2 = pyauto.ExtraBrowser( |
| + self.ChromeFlagsForSyncTestServer(**self._sync_server.ports)) |
| + |
| + account_key = 'test_sync_account' |
| + test_utils.SignInToSyncAndVerifyState(self, account_key) |
| + |
| + # Add a credit card. |
| + self.FillAutofillProfile(credit_cards=credit_card) |
| + browser1_profile = self.GetAutofillProfile() |
|
dennis_jeffrey
2011/11/15 02:07:13
This variable is unused. Should you use it to ver
dyu1
2011/11/15 02:56:08
I added a check.
|
| + |
| + # Log into the account and sync the browser to the account. |
|
dennis_jeffrey
2011/11/15 02:07:13
'...sync the second browser...'
dyu1
2011/11/15 02:56:08
Done.
|
| + test_utils.SignInToSyncAndVerifyState(browser2, account_key) |
| + self.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 contains credit card info.') |
|
dennis_jeffrey
2011/11/15 02:07:13
'Browser 2 unexpectedly contains...'
dyu1
2011/11/15 02:56:08
Done.
|
| + |
| + |
| if __name__ == '__main__': |
| pyauto_functional.Main() |