| OLD | NEW |
| (Empty) |
| 1 # Copyright 2015 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 os.path | |
| 6 import unittest | |
| 7 | |
| 8 from fakes import FakeMojomFile | |
| 9 from fetcher.dependency import Dependency | |
| 10 from fetcher.mojom_directory import MojomDirectory | |
| 11 from fetcher.mojom_file import MojomFile | |
| 12 from fetcher.repository import Repository | |
| 13 | |
| 14 | |
| 15 class TestMojomDirectory(unittest.TestCase): | |
| 16 def test_build_gn_path(self): | |
| 17 directory = MojomDirectory( | |
| 18 "/base/repo/third_party/external/domokit.org/bar/baz") | |
| 19 self.assertEquals( | |
| 20 "/base/repo/third_party/external/domokit.org/bar/baz/BUILD.gn", | |
| 21 directory.get_build_gn_path()) | |
| 22 | |
| 23 def test_jinja_parameters(self): | |
| 24 mojom = FakeMojomFile( | |
| 25 Repository("/base/repo", "third_party/external"), | |
| 26 "/base/repo/third_party/external/domokit.org/bar/baz/foo.mojom") | |
| 27 mojom.add_dependency("example.com/dir/example.mojom") | |
| 28 mojom.add_dependency("example.com/dir/dir.mojom") | |
| 29 mojom.add_dependency("buzz.mojom") | |
| 30 mojom.add_dependency("foo/bar.mojom") | |
| 31 mojom.add_dependency( | |
| 32 "mojo/public/interfaces/application/shell.mojom") | |
| 33 directory = MojomDirectory( | |
| 34 "/base/repo/third_party/external/domokit.org/bar/baz") | |
| 35 directory.add_mojom(mojom) | |
| 36 params = directory.get_jinja_parameters([]) | |
| 37 self.assertEquals( | |
| 38 {"group_name": "baz", | |
| 39 "mojoms": [{ | |
| 40 "target_name": "foo", | |
| 41 "filename": "foo.mojom", | |
| 42 "import_dirs": [".."], | |
| 43 "mojo_sdk_deps": ["mojo/public/interfaces/application"], | |
| 44 "deps": [ | |
| 45 '//third_party/external/example.com/dir:example', | |
| 46 '//third_party/external/example.com/dir:dir_mojom', | |
| 47 ':buzz', | |
| 48 '../foo:bar'] | |
| 49 }]}, params) | |
| 50 | |
| OLD | NEW |