Prefer std::string over String8
String8 is obsolete, only use std::string in the
input libraries now.
Bug: 64258224
Test: make
Change-Id: I958b6b281d969138f39cc26825c877a24bc4a853
diff --git a/libs/input/tests/InputChannel_test.cpp b/libs/input/tests/InputChannel_test.cpp
index e71ebe2..96c165c 100644
--- a/libs/input/tests/InputChannel_test.cpp
+++ b/libs/input/tests/InputChannel_test.cpp
@@ -41,9 +41,9 @@
// of a pipe and to check for EPIPE on the other end after the channel is destroyed.
Pipe pipe;
- sp<InputChannel> inputChannel = new InputChannel(String8("channel name"), pipe.sendFd);
+ sp<InputChannel> inputChannel = new InputChannel("channel name", pipe.sendFd);
- EXPECT_STREQ("channel name", inputChannel->getName().string())
+ EXPECT_STREQ("channel name", inputChannel->getName().c_str())
<< "channel should have provided name";
EXPECT_EQ(pipe.sendFd, inputChannel->getFd())
<< "channel should have provided fd";
@@ -60,16 +60,16 @@
TEST_F(InputChannelTest, OpenInputChannelPair_ReturnsAPairOfConnectedChannels) {
sp<InputChannel> serverChannel, clientChannel;
- status_t result = InputChannel::openInputChannelPair(String8("channel name"),
+ status_t result = InputChannel::openInputChannelPair("channel name",
serverChannel, clientChannel);
ASSERT_EQ(OK, result)
<< "should have successfully opened a channel pair";
// Name
- EXPECT_STREQ("channel name (server)", serverChannel->getName().string())
+ EXPECT_STREQ("channel name (server)", serverChannel->getName().c_str())
<< "server channel should have suffixed name";
- EXPECT_STREQ("channel name (client)", clientChannel->getName().string())
+ EXPECT_STREQ("channel name (client)", clientChannel->getName().c_str())
<< "client channel should have suffixed name";
// Server->Client communication
@@ -111,7 +111,7 @@
TEST_F(InputChannelTest, ReceiveSignal_WhenNoSignalPresent_ReturnsAnError) {
sp<InputChannel> serverChannel, clientChannel;
- status_t result = InputChannel::openInputChannelPair(String8("channel name"),
+ status_t result = InputChannel::openInputChannelPair("channel name",
serverChannel, clientChannel);
ASSERT_EQ(OK, result)
@@ -125,7 +125,7 @@
TEST_F(InputChannelTest, ReceiveSignal_WhenPeerClosed_ReturnsAnError) {
sp<InputChannel> serverChannel, clientChannel;
- status_t result = InputChannel::openInputChannelPair(String8("channel name"),
+ status_t result = InputChannel::openInputChannelPair("channel name",
serverChannel, clientChannel);
ASSERT_EQ(OK, result)
@@ -141,7 +141,7 @@
TEST_F(InputChannelTest, SendSignal_WhenPeerClosed_ReturnsAnError) {
sp<InputChannel> serverChannel, clientChannel;
- status_t result = InputChannel::openInputChannelPair(String8("channel name"),
+ status_t result = InputChannel::openInputChannelPair("channel name",
serverChannel, clientChannel);
ASSERT_EQ(OK, result)