diff options
author | David Pursell <dpursell@google.com> | 2015-09-22 10:43:08 -0700 |
---|---|---|
committer | David Pursell <dpursell@google.com> | 2015-09-22 12:50:11 -0700 |
commit | 4e2fd36bc8c16147cab323b0418a7666812d3bc7 (patch) | |
tree | e3d5ed4e8aef55f264df808c9835d85472739f92 /adb/transport_test.cpp | |
parent | 00ea49fc98870470b33041e0b3c3f83c91ff1007 (diff) | |
download | core-4e2fd36bc8c16147cab323b0418a7666812d3bc7.tar.gz core-4e2fd36bc8c16147cab323b0418a7666812d3bc7.tar.bz2 core-4e2fd36bc8c16147cab323b0418a7666812d3bc7.zip |
adb: add -Tt options to `adb shell`.
Adds -T (no PTY) and -t (force PTY) options to `adb shell` to mimic
ssh options. Small cleanup to send an entire FeatureSet to the adb
client at once to avoid multiple round-trips when querying multiple
features.
Known issue: humans using `adb shell -T` to start a non-PTY interactive
session may experience problems since neither side will have PTY
features like echoing or newline translation. This is probably OK for
now as the -Tt options are primarily useful for scripting.
Bug: http://b/23825231
Change-Id: I4d0df300db0abd1f7410bab59dd4d5b991babda7
Diffstat (limited to 'adb/transport_test.cpp')
-rw-r--r-- | adb/transport_test.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/adb/transport_test.cpp b/adb/transport_test.cpp index 10872ac3e..7d69c3ea7 100644 --- a/adb/transport_test.cpp +++ b/adb/transport_test.cpp @@ -144,23 +144,29 @@ TEST(transport, RunDisconnects) { ASSERT_EQ(0, count); } -TEST(transport, add_feature) { +TEST(transport, SetFeatures) { atransport t; ASSERT_EQ(0U, t.features().size()); - t.add_feature("foo"); + t.SetFeatures(FeatureSetToString(FeatureSet{"foo"})); ASSERT_EQ(1U, t.features().size()); ASSERT_TRUE(t.has_feature("foo")); - t.add_feature("bar"); + t.SetFeatures(FeatureSetToString(FeatureSet{"foo", "bar"})); ASSERT_EQ(2U, t.features().size()); ASSERT_TRUE(t.has_feature("foo")); ASSERT_TRUE(t.has_feature("bar")); - t.add_feature("foo"); + t.SetFeatures(FeatureSetToString(FeatureSet{"foo", "bar", "foo"})); ASSERT_EQ(2U, t.features().size()); ASSERT_TRUE(t.has_feature("foo")); ASSERT_TRUE(t.has_feature("bar")); + + t.SetFeatures(FeatureSetToString(FeatureSet{"bar", "baz"})); + ASSERT_EQ(2U, t.features().size()); + ASSERT_FALSE(t.has_feature("foo")); + ASSERT_TRUE(t.has_feature("bar")); + ASSERT_TRUE(t.has_feature("baz")); } TEST(transport, parse_banner_no_features) { |