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

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

Issue 8341092: Verify that VERSION_CHANGE transactions are rolled back after crash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 | « chrome/test/data/indexeddb/version_change_crash.js ('k') | 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/python 1 #!/usr/bin/python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 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 IndexedDBTest(pyauto.PyUITest): 10 class IndexedDBTest(pyauto.PyUITest):
11 """Test of IndexedDB.""" 11 """Test of IndexedDB."""
12 12
13 def _CrashBrowser(self):
14 """Crashes the browser by navigating to special URL"""
15 crash_url = 'about:inducebrowsercrashforrealz'
16 self.NavigateToURL(crash_url)
17
13 def _GetTestResult(self): 18 def _GetTestResult(self):
14 """Returns the result of an asynchronous test""" 19 """Returns the result of an asynchronous test"""
15 js = """ 20 js = """
16 window.domAutomationController.send(window.testResult); 21 window.domAutomationController.send(window.testResult);
17 """ 22 """
18 return self.ExecuteJavascript(js) 23 return self.ExecuteJavascript(js)
19 24
20 def _WaitForTestResult(self): 25 def _WaitForTestResult(self):
21 """Waits until a non-empty asynchronous test result is recorded""" 26 """Waits until a non-empty asynchronous test result is recorded"""
22 self.assertTrue(self.WaitUntil(lambda: self._GetTestResult() != '', 27 self.assertTrue(self.WaitUntil(lambda: self._GetTestResult() != '',
(...skipping 12 matching lines...) Expand all
35 msg='Key paths had unexpected values') 40 msg='Key paths had unexpected values')
36 41
37 self.RestartBrowser(clear_profile=False) 42 self.RestartBrowser(clear_profile=False)
38 43
39 self.NavigateToURL(url) 44 self.NavigateToURL(url)
40 self._WaitForTestResult() 45 self._WaitForTestResult()
41 self.assertEqual(self._GetTestResult(), 46 self.assertEqual(self._GetTestResult(),
42 'pass - second run', 47 'pass - second run',
43 msg='Key paths had unexpected values') 48 msg='Key paths had unexpected values')
44 49
50 def testVersionChangeCrashResilience(self):
51 """Verify that a VERSION_CHANGE transaction is rolled back
52 after a renderer/browser crash"""
53
54 url = self.GetFileURLForDataPath('indexeddb', 'version_change_crash.html')
Nirnimesh 2011/11/04 22:25:09 maybe use GetHttpUrlForDataPath? (here and above a
55
56 self.NavigateToURL(url + '#part1')
57 self.WaitUntil(lambda: self._GetTestResult() == 'part1 - complete')
Nirnimesh 2011/11/04 22:25:09 you need to wrap this inside self.assertTrue()
58
59 self.RestartBrowser(clear_profile=False)
60
61 self.NavigateToURL(url + '#part2')
62 self.WaitUntil(lambda: self._GetTestResult() != 'part2 - crash me')
63 self._CrashBrowser()
64
65 self.RestartBrowser(clear_profile=False)
Nirnimesh 2011/11/04 22:25:09 RestartBrowser works by quitting the current brows
66
67 self.NavigateToURL(url + '#part3')
68 self._WaitForTestResult()
69 self.assertEqual(self._GetTestResult(),
70 'part3 - pass',
71 msg='VERSION_CHANGE not completely aborted')
72
45 if __name__ == '__main__': 73 if __name__ == '__main__':
46 pyauto_functional.Main() 74 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « chrome/test/data/indexeddb/version_change_crash.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698