Index: chromeos/components/tether/message_wrapper_unittest.cc |
diff --git a/chromeos/components/tether/message_wrapper_unittest.cc b/chromeos/components/tether/message_wrapper_unittest.cc |
index 78a7e248a301d126473987240db4e389b722f14f..48075e30816573f4aa10e6d4f37caa775bb03023 100644 |
--- a/chromeos/components/tether/message_wrapper_unittest.cc |
+++ b/chromeos/components/tether/message_wrapper_unittest.cc |
@@ -10,6 +10,7 @@ |
#include "base/logging.h" |
#include "base/macros.h" |
#include "chromeos/components/tether/proto/tether.pb.h" |
+#include "chromeos/components/tether/proto_test_util.h" |
#include "testing/gmock/include/gmock/gmock.h" |
#include "testing/gtest/include/gtest/gtest.h" |
@@ -19,27 +20,13 @@ namespace tether { |
namespace { |
-DeviceStatus CreateFakeDeviceStatus() { |
- WifiStatus wifi_status; |
- wifi_status.set_status_code( |
- WifiStatus_StatusCode::WifiStatus_StatusCode_CONNECTED); |
- wifi_status.set_ssid("Google A"); |
- |
- DeviceStatus device_status; |
- device_status.set_battery_percentage(75); |
- device_status.set_cell_provider("Google Fi"); |
- device_status.set_connection_strength(4); |
- device_status.mutable_wifi_status()->CopyFrom(wifi_status); |
- |
- return device_status; |
-} |
- |
TetherAvailabilityResponse CreateTetherAvailabilityResponse() { |
TetherAvailabilityResponse response; |
response.set_response_code( |
TetherAvailabilityResponse_ResponseCode:: |
TetherAvailabilityResponse_ResponseCode_TETHER_AVAILABLE); |
- response.mutable_device_status()->CopyFrom(CreateFakeDeviceStatus()); |
+ response.mutable_device_status()->CopyFrom( |
+ CreateDeviceStatusWithFakeFields()); |
return response; |
} |
@@ -81,7 +68,8 @@ TEST_F(MessageWrapperTest, TestToAndFromRawMessage_ConnectTetheringResponse) { |
response.set_password("password"); |
response.set_response_code(ConnectTetheringResponse_ResponseCode:: |
ConnectTetheringResponse_ResponseCode_SUCCESS); |
- response.mutable_device_status()->CopyFrom(CreateFakeDeviceStatus()); |
+ response.mutable_device_status()->CopyFrom( |
+ CreateDeviceStatusWithFakeFields()); |
MessageWrapper wrapper(response); |
VerifyProtoConversion(&response, wrapper, |
@@ -168,7 +156,7 @@ TEST_F(MessageWrapperTest, TestFromRawMessage_StringLiteral) { |
// Type 2 is TETHER_AVAILABILITY_RESPONSE, and the data supplied is |
// CreateTetherAvailabilityResponse() encoded in base-64. |
std::string raw_message = |
- "{\"type\":2,\"data\":\"CAESHQhLEglHb29nbGUgRmkYBCIMCAESCEdvb2dsZSBB\"}"; |
+ "{\"type\":2,\"data\":\"CAESHQhLEglHb29nbGUgRmkYBCIMCAESCFdpZmlTc2lk\"}"; |
std::unique_ptr<MessageWrapper> wrapper = |
MessageWrapper::FromRawMessage(raw_message); |