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