Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / trace-viewer / third_party / tvcm / tvcm / resource_loader_unittest.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 """Tests for resource_loader."""
6
7 import os
8 import unittest
9
10 from tvcm import module
11 from tvcm import resource_loader
12 from tvcm import project as project_module
13
14
15 class ResourceLoaderTest(unittest.TestCase):
16
17   def test_basic(self):
18     tvcm_project = project_module.Project()
19     loader = resource_loader.ResourceLoader(tvcm_project)
20     guid_module = loader.LoadModule(module_name='tvcm')
21     self.assertTrue(os.path.samefile(
22         guid_module.filename,
23         os.path.join(tvcm_project.tvcm_src_path, 'tvcm.html')))
24     expected_contents = ''
25     with open(os.path.join(tvcm_project.tvcm_src_path, 'tvcm.html')) as f:
26       expected_contents = f.read()
27     self.assertEquals(guid_module.contents, expected_contents)
28
29 if __name__ == '__main__':
30   unittest.main()