OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chromeos/components/tether/message_wrapper.h" | 5 #include "chromeos/components/tether/message_wrapper.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "base/base64url.h" | 9 #include "base/base64url.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "chromeos/components/tether/proto/tether.pb.h" | 12 #include "chromeos/components/tether/proto/tether.pb.h" |
13 #include "chromeos/components/tether/proto_test_util.h" | |
13 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
15 | 16 |
16 namespace chromeos { | 17 namespace chromeos { |
17 | 18 |
18 namespace tether { | 19 namespace tether { |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
22 DeviceStatus CreateFakeDeviceStatus() { | 23 DeviceStatus CreateFakeDeviceStatus() { |
Ryan Hansberry
2017/06/05 22:52:23
This same method without any args is across about
Kyle Horimoto
2017/06/05 23:18:56
Done.
| |
23 WifiStatus wifi_status; | 24 return CreateTestDeviceStatus("Google Fi", 75 /* battery_percentage */, |
24 wifi_status.set_status_code( | 25 4 /* connection_strength */); |
25 WifiStatus_StatusCode::WifiStatus_StatusCode_CONNECTED); | |
26 wifi_status.set_ssid("Google A"); | |
27 | |
28 DeviceStatus device_status; | |
29 device_status.set_battery_percentage(75); | |
30 device_status.set_cell_provider("Google Fi"); | |
31 device_status.set_connection_strength(4); | |
32 device_status.mutable_wifi_status()->CopyFrom(wifi_status); | |
33 | |
34 return device_status; | |
35 } | 26 } |
36 | 27 |
37 TetherAvailabilityResponse CreateTetherAvailabilityResponse() { | 28 TetherAvailabilityResponse CreateTetherAvailabilityResponse() { |
38 TetherAvailabilityResponse response; | 29 TetherAvailabilityResponse response; |
39 response.set_response_code( | 30 response.set_response_code( |
40 TetherAvailabilityResponse_ResponseCode:: | 31 TetherAvailabilityResponse_ResponseCode:: |
41 TetherAvailabilityResponse_ResponseCode_TETHER_AVAILABLE); | 32 TetherAvailabilityResponse_ResponseCode_TETHER_AVAILABLE); |
42 response.mutable_device_status()->CopyFrom(CreateFakeDeviceStatus()); | 33 response.mutable_device_status()->CopyFrom(CreateFakeDeviceStatus()); |
43 return response; | 34 return response; |
44 } | 35 } |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
197 EXPECT_TRUE(wrapper); | 188 EXPECT_TRUE(wrapper); |
198 EXPECT_EQ(MessageType::TETHER_AVAILABILITY_RESPONSE, | 189 EXPECT_EQ(MessageType::TETHER_AVAILABILITY_RESPONSE, |
199 wrapper->GetMessageType()); | 190 wrapper->GetMessageType()); |
200 EXPECT_EQ(response.SerializeAsString(), | 191 EXPECT_EQ(response.SerializeAsString(), |
201 wrapper->GetProto()->SerializeAsString()); | 192 wrapper->GetProto()->SerializeAsString()); |
202 } | 193 } |
203 | 194 |
204 } // namespace tether | 195 } // namespace tether |
205 | 196 |
206 } // namespace cryptauth | 197 } // namespace cryptauth |
OLD | NEW |