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

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/tool/webkit_patch_unittest.py

Issue 2110893003: Merge webkit_patch and multi_command_tool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replace copyright header in new file with new header Created 4 years, 6 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: third_party/WebKit/Tools/Scripts/webkitpy/tool/webkit_patch_unittest.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/webkit_patch_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/webkit_patch_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..01d0e6d98ac899f133b51c605b0cc7ad54e8af64
--- /dev/null
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/webkit_patch_unittest.py
@@ -0,0 +1,46 @@
+# Copyright 2016 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
+
+from webkitpy.common.system.outputcapture import OutputCapture
+from webkitpy.tool.webkit_patch import WebKitPatch
+
+
+class WebKitPatchTest(unittest.TestCase):
+
+ def test_split_args_basic(self):
+ self.assertEqual(
+ WebKitPatch._split_command_name_from_args(['--global-option', 'command', '--option', 'arg']),
+ ('command', ['--global-option', '--option', 'arg']))
+
+ def test_split_args_empty(self):
+ self.assertEqual(
+ WebKitPatch._split_command_name_from_args([]),
+ (None, []))
+
+ def test_split_args_with_no_options(self):
+ self.assertEqual(
+ WebKitPatch._split_command_name_from_args(['command', 'arg']),
+ ('command', ['arg']))
+
+ def test_command_by_name(self):
+ tool = WebKitPatch()
+ self.assertEqual(tool.command_by_name('help').name, 'help')
+ self.assertIsNone(tool.command_by_name('non-existent'))
+
+ def test_help(self):
+ oc = OutputCapture()
+ oc.capture_output()
+ tool = WebKitPatch()
+ tool.main(['tool', 'help'])
+ out, err, logs = oc.restore_output()
+ self.assertTrue(out.startswith('Usage: '))
+ self.assertEqual('', err)
+ self.assertEqual('', logs)
+
+ def test_constructor_calls_bind_to_tool(self):
+ tool = WebKitPatch()
+ self.assertEqual(tool.commands[0]._tool, tool)
+ self.assertEqual(tool.commands[1]._tool, tool)

Powered by Google App Engine
This is Rietveld 408576698