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

Unified Diff: tools/json_schema_compiler/js_externs_generator_test.py

Issue 1488773003: Add js_interface_generator for generating extensions interfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + shorten line Created 5 years 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: tools/json_schema_compiler/js_externs_generator_test.py
diff --git a/tools/json_schema_compiler/js_externs_generator_test.py b/tools/json_schema_compiler/js_externs_generator_test.py
index cdf49301c7b7372a99a401d2212f6e22d3e39356..c3376598610ae17674f68d77a9e1933023fc7a03 100755
--- a/tools/json_schema_compiler/js_externs_generator_test.py
+++ b/tools/json_schema_compiler/js_externs_generator_test.py
@@ -11,19 +11,6 @@ import model
import sys
import unittest
-COPYRIGHT = ("""// Copyright %s 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.
-""" % datetime.now().year)
-
-INFO = """// This file was generated by:
-// %s.
-// NOTE: The format of types has changed. 'FooType' is now
-// 'chrome.%s.FooType'.
-// Please run the closure compiler before committing changes.
-// See https://code.google.com/p/chromium/wiki/ClosureCompilation.
-"""
-
# The contents of a fake idl file.
fake_idl = """
// Copyright 2014 The Chromium Authors. All rights reserved.
@@ -85,7 +72,17 @@ namespace fakeApi {
"""
# The output we expect from our fake idl file.
-expected_output = COPYRIGHT + "\n" + (INFO % (sys.argv[0], "fakeApi")) + """
+expected_output = ("""// Copyright %s 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.
+
+// This file was generated by:
+// %s.
+// NOTE: The format of types has changed. 'FooType' is now
+// 'chrome.fakeApi.FooType'.
+// Please run the closure compiler before committing changes.
+// See https://code.google.com/p/chromium/wiki/ClosureCompilation.
+
/** @fileoverview Externs generated from namespace: fakeApi */
/**
@@ -161,8 +158,7 @@ chrome.fakeApi.returnString = function() {};
* @type {!ChromeEvent}
* @see https://developer.chrome.com/extensions/fakeApi#event-onTrapDetected
*/
-chrome.fakeApi.onTrapDetected;
-"""
+chrome.fakeApi.onTrapDetected;""" % (datetime.now().year, sys.argv[0]))
fake_json = """// Copyright 2014 The Chromium Authors. All rights reserved.
@@ -235,7 +231,17 @@ fake_json = """// Copyright 2014 The Chromium Authors. All rights reserved.
}
]"""
-json_expected = COPYRIGHT + "\n" + (INFO % (sys.argv[0], "fakeJson")) + """
+json_expected = ("""// Copyright %s 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.
+
+// This file was generated by:
+// %s.
+// NOTE: The format of types has changed. 'FooType' is now
+// 'chrome.fakeJson.FooType'.
+// Please run the closure compiler before committing changes.
+// See https://code.google.com/p/chromium/wiki/ClosureCompilation.
+
/** @fileoverview Externs generated from namespace: fakeJson */
/**
@@ -272,8 +278,8 @@ chrome.fakeJson.CrazyEnum = {
* }}
* @see https://developer.chrome.com/extensions/fakeJson#method-funcWithInlineObj
*/
-chrome.fakeJson.funcWithInlineObj = function(inlineObj, callback) {};
-"""
+chrome.fakeJson.funcWithInlineObj = function(inlineObj, callback) {};""" %
+ (datetime.now().year, sys.argv[0]))
Dan Beam 2015/12/10 22:17:33 not sure i understand this indent
stevenjb 2015/12/10 22:29:04 Hmm, me neither. I blame my editor. If (when) we n
class JsExternGeneratorTest(unittest.TestCase):

Powered by Google App Engine
This is Rietveld 408576698