OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/python |
| 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. |
| 5 |
| 6 import pyauto_functional # Must be imported before pyauto |
| 7 import pyauto |
| 8 |
| 9 |
| 10 class SyncTest(pyauto.PyUITest): |
| 11 """Tests for sync.""" |
| 12 |
| 13 def testSignInToSync(self): |
| 14 """Sign in to sync.""" |
| 15 # Need to initialize username and password. See crbug.com/60970. |
| 16 username = '<username>@gmail.com' |
| 17 password = '<password>' |
| 18 self.assertTrue(self.GetSyncInfo()['summary'] == 'OFFLINE_UNUSABLE') |
| 19 self.assertTrue(self.GetSyncInfo()['last synced'] == 'Never') |
| 20 self.assertTrue(self.SignInToSync(username, password)) |
| 21 self.assertTrue(self.GetSyncInfo()['summary'] == 'READY') |
| 22 self.assertTrue(self.GetSyncInfo()['last synced'] == 'Just now') |
| 23 |
| 24 def testDisableAndEnableDatatype(self): |
| 25 """Sign in, disable and then enable sync for a datatype.""" |
| 26 # Need to initialize username and password. See crbug.com/60970. |
| 27 username = '<username>@gmail.com' |
| 28 password = '<password>' |
| 29 self.assertTrue(self.SignInToSync(username, password)) |
| 30 self.assertTrue(self.GetSyncInfo()['summary'] == 'READY') |
| 31 self.assertTrue(self.GetSyncInfo()['last synced'] == 'Just now') |
| 32 self.assertTrue(self.DisableSyncForDatatypes(['Bookmarks'])) |
| 33 self.assertFalse('Bookmarks' in self.GetSyncInfo()['synced datatypes']) |
| 34 self.assertTrue(self.EnableSyncForDatatypes(['Bookmarks'])) |
| 35 self.assertTrue('Bookmarks' in self.GetSyncInfo()['synced datatypes']) |
| 36 |
| 37 def testRestartBrowser(self): |
| 38 """Sign in to sync and restart the browser.""" |
| 39 # Need to initialize username and password. See crbug.com/60970. |
| 40 username = '<username>@gmail.com' |
| 41 password = '<password>' |
| 42 self.assertTrue(self.SignInToSync(username, password)) |
| 43 self.assertTrue(self.GetSyncInfo()['summary'] == 'READY') |
| 44 self.assertTrue(self.GetSyncInfo()['last synced'] == 'Just now') |
| 45 self.RestartBrowser(clear_profile=False) |
| 46 self.assertTrue(self.AwaitSyncCycleCompletion()) |
| 47 self.assertTrue(self.GetSyncInfo()['summary'] == 'READY') |
| 48 self.assertTrue(self.GetSyncInfo()['last synced'] == 'Just now') |
| 49 |
| 50 |
| 51 if __name__ == '__main__': |
| 52 pyauto_functional.Main() |
OLD | NEW |