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

Unified Diff: chrome/browser/resources/rewrite_licenses_test.py

Issue 2829933003: WebUI: Swap Uglify with Closure Compiler NodeJS version.
Patch Set: Fix ChromeOS Created 3 years, 8 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
« no previous file with comments | « chrome/browser/resources/rewrite_licenses.py ('k') | chrome/browser/resources/settings/prefs/prefs.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/rewrite_licenses_test.py
diff --git a/chrome/browser/resources/rewrite_licenses_test.py b/chrome/browser/resources/rewrite_licenses_test.py
new file mode 100755
index 0000000000000000000000000000000000000000..b1d2b627e4bbb1e90e8b3d741d1a6dfc38fcb66c
--- /dev/null
+++ b/chrome/browser/resources/rewrite_licenses_test.py
@@ -0,0 +1,76 @@
+#!/usr/bin/env python
+# Copyright 2017 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 unittest
+import rewrite_licenses
+
+
+
+class RewriteLicensesTest(unittest.TestCase):
+ def testRewrite(self):
+ test_input = '\n'.join([
+ "// Copyright (c) 2011 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.",
+ "var foo = 'bar';",
+ "// Copyright 2013 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.",
+ "// Some other comment here.",
+ ])
+
+ expected_output = '\n'.join([
+ "/**",
+ " * @license",
+ " * Copyright (c) 2011 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.",
+ " */",
+ "var foo = 'bar';",
+ "/**",
+ " * @license",
+ " * Copyright 2013 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.",
+ " */",
+ "// Some other comment here.",
+ ])
+
+ self.assertSequenceEqual(
+ expected_output, rewrite_licenses.rewrite(test_input))
+
+ # When a file is included with
+ # // <include src="..."
+ # the license header is preceeded by "//". Ensure that this is handled
+ # correctly.
+ def testRewriteIncludeTag(self):
+ test_input = '\n'.join([
+ "// // Copyright (c) 2011 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.",
+ "var foo = 'bar';",
+ ])
+
+ expected_output = '\n'.join([
+ "/**",
+ " * @license",
+ " * Copyright (c) 2011 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.",
+ " */",
+ "var foo = 'bar';",
+ ])
+
+ self.assertSequenceEqual(
+ expected_output, rewrite_licenses.rewrite(test_input))
+
+if __name__ == '__main__':
+ unittest.main()
« no previous file with comments | « chrome/browser/resources/rewrite_licenses.py ('k') | chrome/browser/resources/settings/prefs/prefs.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698