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

Side by Side Diff: build/android/pylib/instrumentation/instrumentation_test_instance_test.py

Issue 2101243005: Add a snapshot of flutter/engine/src/build to our sdk (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: add README.dart Created 4 years, 5 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
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2014 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
7 """Unit tests for instrumentation.TestRunner."""
8
9 # pylint: disable=W0212
10
11 import os
12 import sys
13 import unittest
14
15 from pylib import constants
16 from pylib.base import base_test_result
17 from pylib.instrumentation import instrumentation_test_instance
18
19 sys.path.append(os.path.join(
20 constants.DIR_SOURCE_ROOT, 'third_party', 'pymock'))
21 import mock # pylint: disable=F0401
22
23
24 class InstrumentationTestInstanceTest(unittest.TestCase):
25
26 def setUp(self):
27 options = mock.Mock()
28 options.tool = ''
29
30 def testGenerateTestResults_noStatus(self):
31 results = instrumentation_test_instance.GenerateTestResults(
32 None, None, [], 0, 1000)
33 self.assertEqual([], results)
34
35 def testGenerateTestResults_testPassed(self):
36 statuses = [
37 (1, {
38 'class': 'test.package.TestClass',
39 'test': 'testMethod',
40 }),
41 (0, {
42 'class': 'test.package.TestClass',
43 'test': 'testMethod',
44 }),
45 ]
46 results = instrumentation_test_instance.GenerateTestResults(
47 None, None, statuses, 0, 1000)
48 self.assertEqual(1, len(results))
49 self.assertEqual(base_test_result.ResultType.PASS, results[0].GetType())
50
51 def testGenerateTestResults_testSkipped_true(self):
52 statuses = [
53 (1, {
54 'class': 'test.package.TestClass',
55 'test': 'testMethod',
56 }),
57 (0, {
58 'test_skipped': 'true',
59 'class': 'test.package.TestClass',
60 'test': 'testMethod',
61 }),
62 (0, {
63 'class': 'test.package.TestClass',
64 'test': 'testMethod',
65 }),
66 ]
67 results = instrumentation_test_instance.GenerateTestResults(
68 None, None, statuses, 0, 1000)
69 self.assertEqual(1, len(results))
70 self.assertEqual(base_test_result.ResultType.SKIP, results[0].GetType())
71
72 def testGenerateTestResults_testSkipped_false(self):
73 statuses = [
74 (1, {
75 'class': 'test.package.TestClass',
76 'test': 'testMethod',
77 }),
78 (0, {
79 'test_skipped': 'false',
80 }),
81 (0, {
82 'class': 'test.package.TestClass',
83 'test': 'testMethod',
84 }),
85 ]
86 results = instrumentation_test_instance.GenerateTestResults(
87 None, None, statuses, 0, 1000)
88 self.assertEqual(1, len(results))
89 self.assertEqual(base_test_result.ResultType.PASS, results[0].GetType())
90
91 def testGenerateTestResults_testFailed(self):
92 statuses = [
93 (1, {
94 'class': 'test.package.TestClass',
95 'test': 'testMethod',
96 }),
97 (-2, {
98 'class': 'test.package.TestClass',
99 'test': 'testMethod',
100 }),
101 ]
102 results = instrumentation_test_instance.GenerateTestResults(
103 None, None, statuses, 0, 1000)
104 self.assertEqual(1, len(results))
105 self.assertEqual(base_test_result.ResultType.FAIL, results[0].GetType())
106
107
108 if __name__ == '__main__':
109 unittest.main(verbosity=2)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698