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

Unified Diff: mojo/tools/testing/mojom_fetcher/mojom_gn_tests.py

Issue 1709333002: Remove mojom_fetcher. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: mojo/tools/testing/mojom_fetcher/mojom_gn_tests.py
diff --git a/mojo/tools/testing/mojom_fetcher/mojom_gn_tests.py b/mojo/tools/testing/mojom_fetcher/mojom_gn_tests.py
deleted file mode 100644
index 11e61b3afb1081012a31b568895be2357e198cdb..0000000000000000000000000000000000000000
--- a/mojo/tools/testing/mojom_fetcher/mojom_gn_tests.py
+++ /dev/null
@@ -1,88 +0,0 @@
-# Copyright 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import io
-import os.path
-import unittest
-
-from fakes import FakeMojomFile
-from fetcher.mojom_directory import MojomDirectory
-from fetcher.repository import Repository
-from mojom_gn import BuildGNGenerator
-
-class FakeRepository(Repository):
- def get_all_external_mojom_directories(self):
- mojom = FakeMojomFile(
- self, os.path.join(self.get_external_directory(),
- "domokit.org/bar/baz/foo.mojom"))
- mojom.add_dependency("example.com/dir/example.mojom")
- mojom.add_dependency("example.com/dir/dir.mojom")
- mojom.add_dependency("buzz.mojom")
- mojom.add_dependency("foo/bar.mojom")
- mojom.add_dependency(
- "mojo/public/interfaces/application/shell.mojom")
- directory = MojomDirectory(
- os.path.join(self.get_external_directory(),
- "domokit.org/bar/baz"))
- directory.add_mojom(mojom)
- return [directory]
-
-
-class FakeBuildGNGenerator(BuildGNGenerator):
- def __init__(self, *args, **kwargs):
- self.opened_files = {}
- BuildGNGenerator.__init__(self, *args, **kwargs)
-
- def _open(self, filepath, mode):
- if mode != "w":
- raise Exception("Invalid mode " + str(mode))
- self.opened_files[filepath] = io.StringIO()
- return self.opened_files[filepath]
-
-
-class TestBuildGNGenerator(unittest.TestCase):
- BAZ_BUILD_GN = u"""import("//build/module_args/mojo.gni")
-import("$mojo_sdk_root/mojo/public/tools/bindings/mojom.gni")
-
-mojom("baz") {
- deps = [
- ":foo",
- ]
-}
-
-mojom("foo") {
- sources = [
- "foo.mojom",
- ]
- import_dirs = [
- get_path_info("..", "abspath"),
- ]
- mojo_sdk_deps = [
- "mojo/public/interfaces/application",
- ]
- deps = [
- "//third_party/external/example.com/dir:example",
- "//third_party/external/example.com/dir:dir_mojom",
- ":buzz",
- "../foo:bar",
- ]
-}"""
- def test_generate(self):
- self.maxDiff = None
- repository = FakeRepository("/base/repo", "third_party/external")
- gn_generator = FakeBuildGNGenerator(repository, os.path.abspath(
- os.path.join(os.path.dirname(__file__),
- "../../../public/tools/mojom_fetcher")))
- gn_generator.generate()
- output_stream = gn_generator.opened_files[
- "/base/repo/third_party/external/domokit.org/bar/baz/BUILD.gn"]
- self.assertEquals(prepare_string(self.BAZ_BUILD_GN),
- prepare_string(output_stream.getvalue()))
-
-def prepare_string(value):
- lines = value.split("\n")
- lines = map(lambda l: l.strip().replace(" ", ""), lines)
- lines = filter(lambda l: not l.startswith("#"), lines)
- return ''.join(lines)
-
« no previous file with comments | « mojo/tools/testing/mojom_fetcher/mojom_file_tests.py ('k') | mojo/tools/testing/mojom_fetcher/repository_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698