OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 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 |
| 4 # found in the LICENSE file. |
| 5 |
| 6 import os |
| 7 import tempfile |
| 8 import unittest |
| 9 |
| 10 import pyauto_functional |
| 11 import pyauto |
| 12 import test_utils |
| 13 |
| 14 |
| 15 class SimpleTest(pyauto.PyUITest): |
| 16 |
| 17 def ExtraChromeFlags(self): |
| 18 """Ensures Chrome is launched with custom flags. |
| 19 |
| 20 Returns: |
| 21 A list of extra flags to pass to Chrome when it is launched. |
| 22 """ |
| 23 # Extra flag needed by scroll performance tests. |
| 24 fd, self._strace_log = tempfile.mkstemp() |
| 25 os.close(fd) |
| 26 extra_flags = ['--no-sandbox', '--renderer-clean-exit', |
| 27 '--renderer-cmd-prefix=/usr/bin/strace -o %s' % |
| 28 self._strace_log] |
| 29 return pyauto.PyUITest.ExtraChromeFlags(self) + extra_flags |
| 30 |
| 31 |
| 32 def testCleanExit(self): |
| 33 """Ensures the renderer process cleanly exits.""" |
| 34 url = self.GetHttpURLForDataPath('title2.html') |
| 35 self.NavigateToURL(url) |
| 36 test_utils.CrashBrowser(self) |
| 37 strace_contents = open(self._strace_log).read() |
| 38 self.assertTrue('exit_group' in strace_contents) |
| 39 os.remove(self._strace_log) |
| 40 |
| 41 |
| 42 if __name__ == '__main__': |
| 43 pyauto_functional.Main() |
OLD | NEW |