Commit f7205025 authored by khorimoto's avatar khorimoto Committed by Commit Bot

[CrOS Tether] Add KeepAliveTickleResponse messages to both the proto file and MessageWrapper.

BUG=672263

Review-Url: https://codereview.chromium.org/2913363002
Cr-Commit-Position: refs/heads/master@{#476438}
parent 0a95e183
...@@ -47,6 +47,12 @@ std::unique_ptr<google::protobuf::MessageLite> DecodedMessageToProto( ...@@ -47,6 +47,12 @@ std::unique_ptr<google::protobuf::MessageLite> DecodedMessageToProto(
keep_alive_tickle->ParseFromString(decoded_message); keep_alive_tickle->ParseFromString(decoded_message);
return std::move(keep_alive_tickle); return std::move(keep_alive_tickle);
} }
case MessageType::KEEP_ALIVE_TICKLE_RESPONSE: {
std::unique_ptr<KeepAliveTickleResponse> keep_alive_tickle_response =
base::MakeUnique<KeepAliveTickleResponse>();
keep_alive_tickle_response->ParseFromString(decoded_message);
return std::move(keep_alive_tickle_response);
}
case MessageType::TETHER_AVAILABILITY_REQUEST: { case MessageType::TETHER_AVAILABILITY_REQUEST: {
std::unique_ptr<TetherAvailabilityRequest> tether_request = std::unique_ptr<TetherAvailabilityRequest> tether_request =
base::MakeUnique<TetherAvailabilityRequest>(); base::MakeUnique<TetherAvailabilityRequest>();
...@@ -123,6 +129,10 @@ MessageWrapper::MessageWrapper(const KeepAliveTickle& tickle) ...@@ -123,6 +129,10 @@ MessageWrapper::MessageWrapper(const KeepAliveTickle& tickle)
: type_(MessageType::KEEP_ALIVE_TICKLE), : type_(MessageType::KEEP_ALIVE_TICKLE),
proto_(new KeepAliveTickle(tickle)) {} proto_(new KeepAliveTickle(tickle)) {}
MessageWrapper::MessageWrapper(const KeepAliveTickleResponse& response)
: type_(MessageType::KEEP_ALIVE_TICKLE_RESPONSE),
proto_(new KeepAliveTickleResponse(response)) {}
MessageWrapper::MessageWrapper(const TetherAvailabilityRequest& request) MessageWrapper::MessageWrapper(const TetherAvailabilityRequest& request)
: type_(MessageType::TETHER_AVAILABILITY_REQUEST), : type_(MessageType::TETHER_AVAILABILITY_REQUEST),
proto_(new TetherAvailabilityRequest(request)) {} proto_(new TetherAvailabilityRequest(request)) {}
......
...@@ -31,6 +31,7 @@ class MessageWrapper { ...@@ -31,6 +31,7 @@ class MessageWrapper {
MessageWrapper(const ConnectTetheringResponse& response); MessageWrapper(const ConnectTetheringResponse& response);
MessageWrapper(const DisconnectTetheringRequest& request); MessageWrapper(const DisconnectTetheringRequest& request);
MessageWrapper(const KeepAliveTickle& tickle); MessageWrapper(const KeepAliveTickle& tickle);
MessageWrapper(const KeepAliveTickleResponse& response);
MessageWrapper(const TetherAvailabilityRequest& request); MessageWrapper(const TetherAvailabilityRequest& request);
MessageWrapper(const TetherAvailabilityResponse& response); MessageWrapper(const TetherAvailabilityResponse& response);
......
...@@ -103,6 +103,14 @@ TEST_F(MessageWrapperTest, TestToAndFromRawMessage_KeepAliveTickle) { ...@@ -103,6 +103,14 @@ TEST_F(MessageWrapperTest, TestToAndFromRawMessage_KeepAliveTickle) {
VerifyProtoConversion(&tickle, wrapper, MessageType::KEEP_ALIVE_TICKLE); VerifyProtoConversion(&tickle, wrapper, MessageType::KEEP_ALIVE_TICKLE);
} }
TEST_F(MessageWrapperTest, TestToAndFromRawMessage_KeepAliveTickleResponse) {
KeepAliveTickleResponse response;
MessageWrapper wrapper(response);
VerifyProtoConversion(&response, wrapper,
MessageType::KEEP_ALIVE_TICKLE_RESPONSE);
}
TEST_F(MessageWrapperTest, TestToAndFromRawMessage_TetherAvailabilityRequest) { TEST_F(MessageWrapperTest, TestToAndFromRawMessage_TetherAvailabilityRequest) {
TetherAvailabilityRequest request; TetherAvailabilityRequest request;
......
...@@ -19,6 +19,7 @@ enum MessageType { ...@@ -19,6 +19,7 @@ enum MessageType {
CONNECT_TETHERING_RESPONSE = 4; CONNECT_TETHERING_RESPONSE = 4;
DISCONNECT_TETHERING_REQUEST = 5; DISCONNECT_TETHERING_REQUEST = 5;
KEEP_ALIVE_TICKLE = 6; KEEP_ALIVE_TICKLE = 6;
KEEP_ALIVE_TICKLE_RESPONSE = 7;
} }
// Meant to communicate the host's current Wifi status. This is intended to // Meant to communicate the host's current Wifi status. This is intended to
...@@ -103,5 +104,10 @@ message ConnectTetheringResponse { ...@@ -103,5 +104,10 @@ message ConnectTetheringResponse {
// Next id: 1 // Next id: 1
message KeepAliveTickle {} message KeepAliveTickle {}
// Next id: 2
message KeepAliveTickleResponse {
optional DeviceStatus device_status = 1;
}
// Next id: 1 // Next id: 1
message DisconnectTetheringRequest {} message DisconnectTetheringRequest {}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment