Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: chrome/test/functional/chromeos_browser.py

Issue 10134043: Used test util to crash the browser, and restart the browser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
13 def testCloseAllTabs(self):
Nirnimesh 2012/04/24 22:01:45 did you forget to sync?
tturchetto 2012/04/24 22:09:51 Done.
14 """Close all tabs and verify 1 tab is still open on Chrome OS."""
15 tab_count = self.GetTabCount()
16
17 for tab_index in xrange(tab_count - 1, -1, -1):
18 self.GetBrowserWindow(0).GetTab(tab_index).Close(True)
19
20 info = self.GetBrowserInfo()
21 self.assertEqual(1, len(info['windows']))
22 self.assertEqual(1, len(info['windows'][0]['tabs']))
23 url = info['windows'][0]['tabs'][0]['url']
24 self.assertEqual('chrome://newtab/', url,
25 msg='Unexpected URL: %s' % url)
26
12 def testCannotCloseLastIncognito(self): 27 def testCannotCloseLastIncognito(self):
13 """Verify that last incognito window cannot be closed if it's the 28 """Verify that last incognito window cannot be closed if it's the
14 last window""" 29 last window"""
15 self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) 30 self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW)
16 self.assertTrue(self.GetBrowserInfo()['windows'][1]['incognito'], 31 self.assertTrue(self.GetBrowserInfo()['windows'][1]['incognito'],
17 msg='Incognito window is not displayed') 32 msg='Incognito window is not displayed')
18 33
19 self.CloseBrowserWindow(0) 34 self.CloseBrowserWindow(0)
20 info = self.GetBrowserInfo()['windows'] 35 info = self.GetBrowserInfo()['windows']
21 self.assertEqual(1, len(info)) 36 self.assertEqual(1, len(info))
22 url = info[0]['tabs'][0]['url'] 37 url = info[0]['tabs'][0]['url']
23 self.assertEqual('chrome://newtab/', url, 38 self.assertEqual('chrome://newtab/', url,
24 msg='Unexpected URL: %s' % url) 39 msg='Unexpected URL: %s' % url)
25 self.assertTrue(info[0]['incognito'], 40 self.assertTrue(info[0]['incognito'],
26 msg='Incognito window is not displayed.') 41 msg='Incognito window is not displayed.')
27 42
28 def testCrashBrowser(self): 43 def testCrashBrowser(self):
29 """Verify that after broswer crash is recovered, user can still navigate 44 """Verify that after broswer crash is recovered, user can still navigate
30 to other URL.""" 45 to other URL."""
31 crash_url = 'about:inducebrowsercrashforrealz' 46 test_utils.CrashBrowser(self)
32 self.NavigateToURL(crash_url) 47 self.RestartBrowser(clear_profile=False)
33 url = self.GetHttpURLForDataPath('english_page.html') 48 url = self.GetHttpURLForDataPath('english_page.html')
34 self.NavigateToURL(url) 49 self.NavigateToURL(url)
35 self.assertEqual('This page is in English', self.GetActiveTabTitle()) 50 self.assertEqual('This page is in English', self.GetActiveTabTitle())
36 51
37 def testFullScreen(self): 52 def testFullScreen(self):
38 """Verify that a browser window can enter and exit full screen mode.""" 53 """Verify that a browser window can enter and exit full screen mode."""
39 self.ApplyAccelerator(pyauto.IDC_FULLSCREEN) 54 self.ApplyAccelerator(pyauto.IDC_FULLSCREEN)
40 self.assertTrue(self.WaitUntil(lambda: 55 self.assertTrue(self.WaitUntil(lambda:
41 self.GetBrowserInfo()['windows'][0]['fullscreen']), 56 self.GetBrowserInfo()['windows'][0]['fullscreen']),
42 msg='Full Screen is not displayed.') 57 msg='Full Screen is not displayed.')
43 58
44 self.ApplyAccelerator(pyauto.IDC_FULLSCREEN) 59 self.ApplyAccelerator(pyauto.IDC_FULLSCREEN)
45 self.assertTrue(self.WaitUntil(lambda: not 60 self.assertTrue(self.WaitUntil(lambda: not
46 self.GetBrowserInfo()['windows'][0]['fullscreen']), 61 self.GetBrowserInfo()['windows'][0]['fullscreen']),
47 msg='Normal screen is not displayed.') 62 msg='Normal screen is not displayed.')
48 63
49 64
50 if __name__ == '__main__': 65 if __name__ == '__main__':
51 pyauto_functional.Main() 66 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698