- add third_party src.
[platform/framework/web/crosswalk.git] / src / tools / swarming_client / googletest / tests / list_test_cases_smoke_test.py
1 #!/usr/bin/env python
2 # Copyright 2013 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 logging
7 import os
8 import subprocess
9 import sys
10 import unittest
11
12 ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
13
14
15 class ListTestCases(unittest.TestCase):
16   def capture(self, cmd):
17     p = subprocess.Popen(
18         [sys.executable] + cmd,
19         stdout=subprocess.PIPE,
20         stderr=subprocess.PIPE,
21         cwd=ROOT_DIR,
22         universal_newlines=True)
23     out, err = p.communicate()
24     self.assertEqual('', err)
25     self.assertEqual(0, p.returncode)
26     return out
27
28   def test_default(self):
29     out = self.capture(
30         [
31           'list_test_cases.py',
32           os.path.join('tests', 'gtest_fake', 'gtest_fake_pass.py'),
33         ])
34     self.assertEqual('Foo.Bar/3\nFoo.Bar1\nFoo.Bar2\n', out)
35
36
37 if __name__ == '__main__':
38   logging.basicConfig(
39       level=(logging.DEBUG if '-v' in sys.argv else logging.FATAL))
40   unittest.main()