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

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: incorporating feedback 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() != '',
23 timeout=120), 28 timeout=120),
24 msg='Test did not finish') 29 msg='Test did not finish')
25 30
26 def testIndexedDBNullKeyPathPersistence(self): 31 def testIndexedDBNullKeyPathPersistence(self):
27 """Verify null key path persists after restarting browser.""" 32 """Verify null key path persists after restarting browser."""
28 33
29 url = self.GetFileURLForDataPath('indexeddb', 'bug_90635.html') 34 url = self.GetHttpURLForDataPath('indexeddb', 'bug_90635.html')
30 35
31 self.NavigateToURL(url) 36 self.NavigateToURL(url)
32 self._WaitForTestResult() 37 self._WaitForTestResult()
33 self.assertEqual(self._GetTestResult(), 38 self.assertEqual(self._GetTestResult(),
34 'pass - first run', 39 'pass - first run',
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.GetHttpURLForDataPath('indexeddb', 'version_change_crash.html')
55
56 self.NavigateToURL(url + '#part1')
57 self.assertTrue(self.WaitUntil(
58 lambda: self._GetTestResult() == 'part1 - complete'))
59
60 self.RestartBrowser(clear_profile=False)
61
62 self.NavigateToURL(url + '#part2')
63 self.assertTrue(self.WaitUntil(
64 lambda: self._GetTestResult() != 'part2 - crash me'))
65 self._CrashBrowser()
66
67 self.RestartBrowser(clear_profile=False)
68
69 self.NavigateToURL(url + '#part3')
70 self._WaitForTestResult()
71 self.assertEqual(self._GetTestResult(),
72 'part3 - pass',
73 msg='VERSION_CHANGE not completely aborted')
74
45 if __name__ == '__main__': 75 if __name__ == '__main__':
46 pyauto_functional.Main() 76 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