[Extension API Extern Generation] Support inline object definitions

The Extension APIs can define their objects "inlined", i.e., at the place of
their use (for instance, as a function parameter). The generated externs need
to reflect this, rather than simply call the parameter an 'Object'.

BUG=469920

Review URL: https://codereview.chromium.org/1033223007

Cr-Commit-Position: refs/heads/master@{#322804}
diff --git a/tools/json_schema_compiler/code_test.py b/tools/json_schema_compiler/code_test.py
index c6ca33f..7d64b6c 100755
--- a/tools/json_schema_compiler/code_test.py
+++ b/tools/json_schema_compiler/code_test.py
@@ -48,7 +48,7 @@
         .Append('1')
       .Eblock('1')
     )
-    self.assertEquals(
+    self.assertMultiLineEqual(
       '1\n'
       '  2\n'
       '    2\n'
@@ -169,5 +169,36 @@
         '// 20% of 80%s',
         d.Render())
 
+  def testLinePrefixes(self):
+    c = Code()
+    c.Sblock(line='/**', line_prefix=' * ')
+    c.Sblock('@typedef {{')
+    c.Append('foo: bar,')
+    c.Sblock('baz: {')
+    c.Append('x: y')
+    c.Eblock('}')
+    c.Eblock('}}')
+    c.Eblock(line=' */')
+    output = c.Render()
+    self.assertMultiLineEqual(
+        '/**\n'
+        ' * @typedef {{\n'
+        ' *   foo: bar,\n'
+        ' *   baz: {\n'
+        ' *     x: y\n'
+        ' *   }\n'
+        ' * }}\n'
+        ' */',
+        output)
+
+  def testSameLineAppendAndConcat(self):
+    c = Code()
+    c.Append('This is a line.')
+    c.Append('This too.', new_line=False)
+    d = Code()
+    d.Append('And this.')
+    c.Concat(d, new_line=False)
+    self.assertEquals('This is a line.This too.And this.', c.Render())
+
 if __name__ == '__main__':
   unittest.main()