summaryrefslogtreecommitdiff
path: root/chromium/tools/bash-completion
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-03-08 10:28:10 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-03-20 13:40:30 +0000
commite733310db58160074f574c429d48f8308c0afe17 (patch)
treef8aef4b7e62a69928dbcf880620eece20f98c6df /chromium/tools/bash-completion
parent2f583e4aec1ae3a86fa047829c96b310dc12ecdf (diff)
downloadqtwebengine-chromium-e733310db58160074f574c429d48f8308c0afe17.tar.gz
BASELINE: Update Chromium to 56.0.2924.122
Change-Id: I4e04de8f47e47e501c46ed934c76a431c6337ced Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/tools/bash-completion')
-rw-r--r--chromium/tools/bash-completion63
1 files changed, 63 insertions, 0 deletions
diff --git a/chromium/tools/bash-completion b/chromium/tools/bash-completion
index 19172dab145..8cc3c73a8d8 100644
--- a/chromium/tools/bash-completion
+++ b/chromium/tools/bash-completion
@@ -5,6 +5,21 @@
# Flag completion rule for bash.
# To load in your shell, "source path/to/this/file".
+# Usage examples
+# ==============
+#
+# Browser command line switches:
+# $ out/gn/chrome --site-per-pro<tab>
+# $ google-chrome --site-per-pro<tab>
+#
+# Test switches (i.e. --gtest_* and --test-launcher-* switches):
+# $ out/gn/unit_tests --gtest_filt<tab>
+# $ out/gn/unit_tests --test-launcher-j<tab>
+#
+# Layout test switches:
+# $ third_party/WebKit/Tools/Scripts/run-webkit-tests --additional-driver-f<tab>
+# $ .../run-webkit-tests --additional-driver-flag=--site-per-pro<tab>
+
chrome_source=$(cd $(dirname $BASH_SOURCE)/.. && pwd)
_chrome_flag() {
@@ -17,9 +32,57 @@ _chrome_flag() {
return 0
}
+_gtest_flag() {
+ local cur gtest_flags launcher_flags
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ gtest_flags=$(sed -ne 's/^.*FromGTestEnv("\([^" /]\+\)".*$/--gtest_\1/p' \
+ "$chrome_source/testing/gtest/src/gtest.cc")
+ chrome_test_launcher_flags=$(sed -ne 's/^[^/]*"\([^" /]\{1,\}\)".*/--\1/p' \
+ "$chrome_source/base/test/test_switches.cc")
+ COMPREPLY=($(
+ compgen -W "$gtest_flags $chrome_test_launcher_flags" -- "$cur"))
+ return 0
+}
+
+_layout_test_flag() {
+ local cur targets webkitpy_dir prev_switch
+ cur="${COMP_WORDS[COMP_CWORD]}"
+
+ # Complete content_shell switches if appropriate.
+ if [ "${COMP_CWORD}" -gt 2 -a "${COMP_WORDS[COMP_CWORD-1]}" = "=" ]
+ then
+ prev_switch="${COMP_WORDS[COMP_CWORD-2]}"
+ if [ "$prev_switch" = "--additional-drt-flag" -o \
+ "$prev_switch" = "--additional-driver-flag" ]
+ then
+ targets=$(cd $chrome_source; \
+ git ls-files 'content/*switches*.cc' | \
+ xargs sed -ne 's/^[^/]*"\([^" /]\{1,\}\)".*/--\1/p')
+ COMPREPLY=($(compgen -W "$targets" -- "$cur"))
+ return 0
+ fi
+ fi
+
+ # Complete run-webkit-tests switches.
+ webkitpy_dir="$chrome_source/third_party/WebKit/Tools/Scripts/webkitpy"
+ targets=$(sed -ne 's/^[[:space:]]*"\(--[a-z-]\+\)",[[:space:]]*$/\1/p' \
+ "$webkitpy_dir/layout_tests/run_webkit_tests.py")
+ COMPREPLY=($(compgen -W "$targets" -- "$cur"))
+ return 0
+}
+
complete -F _chrome_flag google-chrome
complete -F _chrome_flag chrome
if [ $(uname) = "Darwin" ]
then
complete -F _chrome_flag Chromium
fi
+
+for gtest_test_executable in $(
+ cd $chrome_source;
+ git ls-files '*/BUILD.gn' | xargs sed -ne 's/^.*test("\([^"]\+\)").*$/\1/p'
+); do
+ complete -F _gtest_flag $gtest_test_executable
+done
+
+complete -F _layout_test_flag run-webkit-tests