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

Side by Side Diff: chrome/test/functional/ispy/ispy_api_unittest.py

Issue 222873002: Remove pyauto tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: sync Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/test/functional/ispy/ispy_api.py ('k') | chrome/test/functional/ispy/server/app.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 #
3 # Copyright 2014 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 import json
8 import unittest
9 from PIL import Image
10
11 import ispy_api
12 from common import cloud_bucket
13 from common import mock_cloud_bucket
14
15
16 class ISpyApiTest(unittest.TestCase):
17 """Unittest for the ISpy API."""
18
19 def setUp(self):
20 self.cloud_bucket = mock_cloud_bucket.MockCloudBucket()
21 self.ispy = ispy_api.ISpyApi(self.cloud_bucket)
22 self.white_img = Image.new('RGBA', (10, 10), (255, 255, 255, 255))
23 self.black_img = Image.new('RGBA', (10, 10), (0, 0, 0, 255))
24
25 def testGenerateExpectationsRunComparison(self):
26 self.ispy.GenerateExpectation(
27 'device', 'test', '1.1.1.1', 'versions.json',
28 [self.white_img, self.white_img])
29 self.ispy.UpdateExpectationVersion('1.1.1.1', 'versions.json')
30 self.ispy.PerformComparison(
31 'test1', 'device', 'test', '1.1.1.1', 'versions.json', self.white_img)
32 expect_name = self.ispy._CreateExpectationName(
33 'device', 'test', '1.1.1.1')
34 self.assertFalse(self.ispy._ispy.FailureExists('test1', expect_name))
35 self.ispy.PerformComparison(
36 'test2', 'device', 'test', '1.1.1.1','versions.json', self.black_img)
37 self.assertTrue(self.ispy._ispy.FailureExists('test2', expect_name))
38
39 def testUpdateExpectationVersion(self):
40 self.ispy.UpdateExpectationVersion('1.0.0.0', 'versions.json')
41 self.ispy.UpdateExpectationVersion('1.0.4.0', 'versions.json')
42 self.ispy.UpdateExpectationVersion('2.1.5.0', 'versions.json')
43 self.ispy.UpdateExpectationVersion('1.1.5.0', 'versions.json')
44 self.ispy.UpdateExpectationVersion('0.0.0.0', 'versions.json')
45 self.ispy.UpdateExpectationVersion('1.1.5.0', 'versions.json')
46 self.ispy.UpdateExpectationVersion('0.0.0.1', 'versions.json')
47 versions = json.loads(self.cloud_bucket.DownloadFile('versions.json'))
48 self.assertEqual(versions,
49 ['2.1.5.0', '1.1.5.0', '1.0.4.0', '1.0.0.0', '0.0.0.1', '0.0.0.0'])
50
51 def testPerformComparisonAndPrepareExpectation(self):
52 self.assertFalse(self.ispy.CanRebaselineToTestRun('test'))
53 self.assertRaises(
54 cloud_bucket.FileNotFoundError,
55 self.ispy.PerformComparisonAndPrepareExpectation,
56 'test', 'device', 'expect', '1.0', 'versions.json',
57 [self.white_img, self.white_img])
58 self.assertTrue(self.ispy.CanRebaselineToTestRun('test'))
59 self.ispy.RebaselineToTestRun('test')
60 versions = json.loads(self.cloud_bucket.DownloadFile('versions.json'))
61 self.assertEqual(versions, ['1.0'])
62 self.ispy.PerformComparisonAndPrepareExpectation(
63 'test1', 'device', 'expect', '1.1', 'versions.json',
64 [self.white_img, self.white_img])
65
66
67 if __name__ == '__main__':
68 unittest.main()
OLDNEW
« no previous file with comments | « chrome/test/functional/ispy/ispy_api.py ('k') | chrome/test/functional/ispy/server/app.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698