| 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 # pyauto_functional must come before pyauto. | 6 import pyauto_functional # pyauto_functional must come before pyauto. |
| 7 import pyauto | 7 import pyauto |
| 8 | 8 |
| 9 | 9 |
| 10 class ChromeosBrowserTest(pyauto.PyUITest): | 10 class ChromeosBrowserTest(pyauto.PyUITest): |
| 11 | 11 |
| 12 def testCannotCloseLastIncognito(self): | 12 def testCannotCloseLastIncognito(self): |
| 13 """Verify that last incognito window cannot be closed if it's the | 13 """Verify that last incognito window cannot be closed if it's the |
| 14 last window""" | 14 last window""" |
| 15 self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) | 15 self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) |
| 16 self.assertTrue(self.GetBrowserInfo()['windows'][1]['incognito'], | 16 self.assertTrue(self.GetBrowserInfo()['windows'][1]['incognito'], |
| 17 msg='Incognito window is not displayed') | 17 msg='Incognito window is not displayed') |
| 18 | 18 |
| 19 self.CloseBrowserWindow(0) | 19 self.CloseBrowserWindow(0) |
| 20 info = self.GetBrowserInfo()['windows'] | 20 info = self.GetBrowserInfo()['windows'] |
| 21 self.assertEqual(1, len(info)) | 21 self.assertEqual(1, len(info)) |
| 22 url = info[0]['tabs'][0]['url'] | 22 url = info[0]['tabs'][0]['url'] |
| 23 self.assertEqual('chrome://newtab/', url, | 23 self.assertEqual('chrome://newtab/', url, |
| 24 msg='Unexpected URL: %s' % url) | 24 msg='Unexpected URL: %s' % url) |
| 25 self.assertTrue(info[0]['incognito'], | 25 self.assertTrue(info[0]['incognito'], |
| 26 msg='Incognito window is not displayed.') | 26 msg='Incognito window is not displayed.') |
| 27 | 27 |
| 28 def testCrashBrowser(self): |
| 29 """Verify that after broswer crash is recovered, user can still navigate |
| 30 to other URL.""" |
| 31 crash_url = 'about:inducebrowsercrashforrealz' |
| 32 self.NavigateToURL(crash_url) |
| 33 url = self.GetHttpURLForDataPath('english_page.html') |
| 34 self.NavigateToURL(url) |
| 35 self.assertEqual('This page is in English', self.GetActiveTabTitle()) |
| 36 |
| 28 def testFullScreen(self): | 37 def testFullScreen(self): |
| 29 """Verify that a browser window can enter and exit full screen mode.""" | 38 """Verify that a browser window can enter and exit full screen mode.""" |
| 30 self.ApplyAccelerator(pyauto.IDC_FULLSCREEN) | 39 self.ApplyAccelerator(pyauto.IDC_FULLSCREEN) |
| 31 self.assertTrue(self.WaitUntil(lambda: | 40 self.assertTrue(self.WaitUntil(lambda: |
| 32 self.GetBrowserInfo()['windows'][0]['fullscreen']), | 41 self.GetBrowserInfo()['windows'][0]['fullscreen']), |
| 33 msg='Full Screen is not displayed.') | 42 msg='Full Screen is not displayed.') |
| 34 | 43 |
| 35 self.ApplyAccelerator(pyauto.IDC_FULLSCREEN) | 44 self.ApplyAccelerator(pyauto.IDC_FULLSCREEN) |
| 36 self.assertTrue(self.WaitUntil(lambda: not | 45 self.assertTrue(self.WaitUntil(lambda: not |
| 37 self.GetBrowserInfo()['windows'][0]['fullscreen']), | 46 self.GetBrowserInfo()['windows'][0]['fullscreen']), |
| 38 msg='Normal screen is not displayed.') | 47 msg='Normal screen is not displayed.') |
| 39 | 48 |
| 40 | 49 |
| 41 if __name__ == '__main__': | 50 if __name__ == '__main__': |
| 42 pyauto_functional.Main() | 51 pyauto_functional.Main() |
| OLD | NEW |