| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 | 6 import pyauto_functional |
| 7 import pyauto | 7 import pyauto |
| 8 | 8 |
| 9 | 9 |
| 10 class MultiprofileTest(pyauto.PyUITest): | 10 class MultiprofileTest(pyauto.PyUITest): |
| 11 """Tests for Multi-Profile / Multi-users""" | 11 """Tests for Multi-Profile / Multi-users""" |
| 12 | 12 |
| 13 def Debug(self): | 13 def Debug(self): |
| 14 """Test method for experimentation. | 14 """Test method for experimentation. |
| 15 | 15 |
| 16 This method will not run automatically. | 16 This method will not run automatically. |
| 17 """ | 17 """ |
| 18 while True: | 18 while True: |
| 19 raw_input('Hit <enter> to dump info.. ') | 19 raw_input('Hit <enter> to dump info.. ') |
| 20 self.pprint(self.GetMultiProfileInfo()) | 20 self.pprint(self.GetMultiProfileInfo()) |
| 21 | 21 |
| 22 def ExtraChromeFlags(self): | |
| 23 """Enable multi-profiles on linux too.""" | |
| 24 # TODO: Remove when --multi-profiles is enabled by default on linux. | |
| 25 flags = pyauto.PyUITest.ExtraChromeFlags(self) | |
| 26 if self.IsLinux(): | |
| 27 flags.append('--multi-profiles') | |
| 28 return flags | |
| 29 | |
| 30 def _CheckNumProfiles(self, expected_number): | 22 def _CheckNumProfiles(self, expected_number): |
| 31 """Returns True if |expected_number| is equal to the number of profiles.""" | 23 """Returns True if |expected_number| is equal to the number of profiles.""" |
| 32 # TODO: Remove when crbug.com/108761 is fixed. | 24 # TODO: Remove when crbug.com/108761 is fixed. |
| 33 multi_profile = self.GetMultiProfileInfo() | 25 multi_profile = self.GetMultiProfileInfo() |
| 34 return expected_number == len(multi_profile['profiles']) | 26 return expected_number == len(multi_profile['profiles']) |
| 35 | 27 |
| 36 def testBasic(self): | 28 def testBasic(self): |
| 37 """Multi-profile windows can open.""" | 29 """Multi-profile windows can open.""" |
| 38 self.assertEqual(1, self.GetBrowserWindowCount()) | 30 self.assertEqual(1, self.GetBrowserWindowCount()) |
| 39 self.assertTrue(self.GetMultiProfileInfo()['enabled'], | 31 self.assertTrue(self.GetMultiProfileInfo()['enabled'], |
| (...skipping 23 matching lines...) Expand all Loading... |
| 63 # TODO: Remove when crbug.com/108761 is fixed. | 55 # TODO: Remove when crbug.com/108761 is fixed. |
| 64 self.WaitUntil(self._CheckNumProfiles, args=[index + 1]) | 56 self.WaitUntil(self._CheckNumProfiles, args=[index + 1]) |
| 65 multi_profile = self.GetMultiProfileInfo() | 57 multi_profile = self.GetMultiProfileInfo() |
| 66 self.assertEqual(index + 1, len(multi_profile['profiles']), | 58 self.assertEqual(index + 1, len(multi_profile['profiles']), |
| 67 msg='Expected %d profiles after adding %d new users. Got %d' % ( | 59 msg='Expected %d profiles after adding %d new users. Got %d' % ( |
| 68 index + 1, index, len(multi_profile['profiles']))) | 60 index + 1, index, len(multi_profile['profiles']))) |
| 69 | 61 |
| 70 | 62 |
| 71 if __name__ == '__main__': | 63 if __name__ == '__main__': |
| 72 pyauto_functional.Main() | 64 pyauto_functional.Main() |
| OLD | NEW |