Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / tools / telemetry / telemetry / unittest / decorators_unittest.py
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import unittest
6
7 from telemetry import decorators
8
9
10 class Foo(object):
11   pass
12
13
14 def CreateFooUncached(_):
15   return Foo()
16
17
18 @decorators.Cache
19 def CreateFooCached(_):
20   return Foo()
21
22
23 class DecoratorsUnitTest(unittest.TestCase):
24
25   def testCacheDecorator(self):
26     self.assertNotEquals(CreateFooUncached(1), CreateFooUncached(2))
27     self.assertNotEquals(CreateFooCached(1), CreateFooCached(2))
28
29     self.assertNotEquals(CreateFooUncached(1), CreateFooUncached(1))
30     self.assertEquals(CreateFooCached(1), CreateFooCached(1))