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

Side by Side Diff: chrome/test/functional/ispy/client/chrome_utils_unittest.py

Issue 58623002: [I-Spy] Add utilities to help manage expectations that track Chrome versions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit: slight changes to a docstring Created 7 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
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 #
3 # Copyright 2013 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 chrome_utils
12 from ..common import mock_cloud_bucket
13
14
15 class ChromeUtilsTest(unittest.TestCase):
16 """Unittest for ChromeUtils."""
17
18 def setUp(self):
19 self.cloud_bucket = mock_cloud_bucket.MockCloudBucket()
20 self.white_utils = chrome_utils.ChromeUtils(
21 self.cloud_bucket, 'versions.json',
22 lambda: Image.new('RGBA', (10, 10), (255, 255, 255, 255)))
23 self.black_utils = chrome_utils.ChromeUtils(
24 self.cloud_bucket, 'versions.json',
25 lambda: Image.new('RGBA', (10, 10), (0, 0, 0, 255)))
26
27 def testGenerateExpectationsRunComparison(self):
28 self.white_utils.GenerateExpectation('device', 'test', '1.1.1.1')
29 self.white_utils.UpdateExpectationVersion('1.1.1.1')
30 self.white_utils.PerformComparison('test1', 'device', 'test', '1.1.1.1')
31 expect_name = self.white_utils._CreateExpectationName(
32 'device', 'test', '1.1.1.1')
33 self.assertFalse(self.white_utils._ispy.FailureExists('test1', expect_name))
34 self.black_utils.PerformComparison('test2', 'device', 'test', '1.1.1.1')
35 self.assertTrue(self.white_utils._ispy.FailureExists('test2', expect_name))
36
37 def testUpdateExpectationVersion(self):
38 self.white_utils.UpdateExpectationVersion('1.0.0.0')
39 self.white_utils.UpdateExpectationVersion('1.0.4.0')
40 self.white_utils.UpdateExpectationVersion('2.1.5.0')
41 self.white_utils.UpdateExpectationVersion('1.1.5.0')
42 self.white_utils.UpdateExpectationVersion('0.0.0.0')
43 self.white_utils.UpdateExpectationVersion('1.1.5.0')
44 self.white_utils.UpdateExpectationVersion('0.0.0.1')
45 versions = json.loads(self.cloud_bucket.DownloadFile('versions.json'))
46 self.assertEqual(versions,
47 ['2.1.5.0', '1.1.5.0', '1.0.4.0', '1.0.0.0', '0.0.0.1', '0.0.0.0'])
48
49
50 if __name__ == '__main__':
51 unittest.main()
OLDNEW
« no previous file with comments | « chrome/test/functional/ispy/client/chrome_utils.py ('k') | chrome/test/functional/ispy/common/ispy_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698