mojo/public/tools/mojom/check_stable_mojom_compatibility_unittest.py
def testWithUnmodifiedImport(self):
    """Unchanged files in the filesystem are still parsed by the compatibility
    checking tool if they're imported by a changed file."""
    self.assertBackwardCompatible([
        UnchangedFile('foo/foo.mojom', 'module foo; [Stable] struct S {};'),
        Change('bar/bar.mojom',
               old="""\
               module bar;
               import "foo/foo.mojom";
               [Stable] struct T { foo.S s; };
               """,
               new="""\
               module bar;
               import "foo/foo.mojom";
               [Stable] struct T { foo.S s; [MinVersion=1] int32 x; };
               """)
    ])

    self.assertNotBackwardCompatible([
        UnchangedFile('foo/foo.mojom', 'module foo; [Stable] struct S {};'),
        Change('bar/bar.mojom',
               old="""\
               module bar;
               import "foo/foo.mojom";
               [Stable] struct T { foo.S s; };
               """,
               new="""\
               module bar;
               import "foo/foo.mojom";
               [Stable] struct T { foo.S s; int32 x; };
               """)
    ])
Unchanged files in the filesystem are still parsed by the compatibility
    checking tool if they're imported by a changed file.
Unchanged files in the filesystem are still parsed by the compatibility
checking tool if they're imported by a changed file.
Unchanged files in the filesystem are still parsed by the compatibility checking tool if they ' re imported by a changed file .
def testWithUnmodifiedImport(self):
    self.assertBackwardCompatible([
        UnchangedFile('foo/foo.mojom', 'module foo; [Stable] struct S {};'),
        Change('bar/bar.mojom',
               old="""\
               module bar;
               import "foo/foo.mojom";
               [Stable] struct T { foo.S s; };
               """,
               new="""\
               module bar;
               import "foo/foo.mojom";
               [Stable] struct T { foo.S s; [MinVersion=1] int32 x; };
               """)
    ])
    self.assertNotBackwardCompatible([
        UnchangedFile('foo/foo.mojom', 'module foo; [Stable] struct S {};'),
        Change('bar/bar.mojom',
               old="""\
               module bar;
               import "foo/foo.mojom";
               [Stable] struct T { foo.S s; };
               """,
               new="""\
               module bar;
               import "foo/foo.mojom";
               [Stable] struct T { foo.S s; int32 x; };
               """)
    ])
def testWithUnmodifiedImport ( self ) : self . assertBackwardCompatible ( [ UnchangedFile ( 'foo/foo.mojom' , 'module foo; [Stable] struct S {};' ) , Change ( 'bar/bar.mojom' , old = """\
               module bar;
               import "foo/foo.mojom";
               [Stable] struct T { foo.S s; };
               """ , new = """\
               module bar;
               import "foo/foo.mojom";
               [Stable] struct T { foo.S s; [MinVersion=1] int32 x; };
               """ ) ] ) self . assertNotBackwardCompatible ( [ UnchangedFile ( 'foo/foo.mojom' , 'module foo; [Stable] struct S {};' ) , Change ( 'bar/bar.mojom' , old = """\
               module bar;
               import "foo/foo.mojom";
               [Stable] struct T { foo.S s; };
               """ , new = """\
               module bar;
               import "foo/foo.mojom";
               [Stable] struct T { foo.S s; int32 x; };
               """ ) ] )
Unchanged files in the filesystem are still parsed by the compatibility
checking tool if they're imported by a changed file.
Unchanged files in the filesystem are still parsed by the compatibility checking tool if they ' re imported by a changed file .
"""Unchanged files in the filesystem are still parsed by the compatibility
    checking tool if they're imported by a changed file."""
self