diff --git a/components/cryptauth/ble/bluetooth_low_energy_characteristics_finder_unittest.cc b/components/cryptauth/ble/bluetooth_low_energy_characteristics_finder_unittest.cc index ec354ad7aa2d14..58ac22f58bfb42 100644 --- a/components/cryptauth/ble/bluetooth_low_energy_characteristics_finder_unittest.cc +++ b/components/cryptauth/ble/bluetooth_low_energy_characteristics_finder_unittest.cc @@ -50,17 +50,17 @@ const char kOtherCharUUID[] = "09731422-048A-11E5-8418-1697F925EC7B"; const char kOtherCharID[] = "other id"; } // namespace -class ProximityAuthBluetoothLowEnergyCharacteristicFinderTest +class CryptAuthBluetoothLowEnergyCharacteristicFinderTest : public testing::Test { protected: - ProximityAuthBluetoothLowEnergyCharacteristicFinderTest() + CryptAuthBluetoothLowEnergyCharacteristicFinderTest() : adapter_(new NiceMock), success_callback_(base::Bind( - &ProximityAuthBluetoothLowEnergyCharacteristicFinderTest:: + &CryptAuthBluetoothLowEnergyCharacteristicFinderTest:: OnCharacteristicsFound, base::Unretained(this))), error_callback_(base::Bind( - &ProximityAuthBluetoothLowEnergyCharacteristicFinderTest:: + &CryptAuthBluetoothLowEnergyCharacteristicFinderTest:: OnCharacteristicsFinderError, base::Unretained(this))), device_(new NiceMock(adapter_.get(), @@ -127,14 +127,14 @@ class ProximityAuthBluetoothLowEnergyCharacteristicFinderTest RemoteAttribute from_peripheral_char_; }; -TEST_F(ProximityAuthBluetoothLowEnergyCharacteristicFinderTest, +TEST_F(CryptAuthBluetoothLowEnergyCharacteristicFinderTest, ConstructAndDestroyDontCrash) { BluetoothLowEnergyCharacteristicsFinder characteristic_finder( adapter_, device_.get(), remote_service_, to_peripheral_char_, from_peripheral_char_, success_callback_, error_callback_); } -TEST_F(ProximityAuthBluetoothLowEnergyCharacteristicFinderTest, +TEST_F(CryptAuthBluetoothLowEnergyCharacteristicFinderTest, FindRightCharacteristics) { BluetoothLowEnergyCharacteristicsFinder characteristic_finder( adapter_, device_.get(), remote_service_, to_peripheral_char_, @@ -169,7 +169,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyCharacteristicFinderTest, observer->GattDiscoveryCompleteForService(adapter_.get(), service_.get()); } -TEST_F(ProximityAuthBluetoothLowEnergyCharacteristicFinderTest, +TEST_F(CryptAuthBluetoothLowEnergyCharacteristicFinderTest, DidntFindRightCharacteristics) { BluetoothLowEnergyCharacteristicsFinder characteristic_finder( adapter_, device_.get(), remote_service_, to_peripheral_char_, @@ -190,7 +190,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyCharacteristicFinderTest, observer->GattDiscoveryCompleteForService(adapter_.get(), service_.get()); } -TEST_F(ProximityAuthBluetoothLowEnergyCharacteristicFinderTest, +TEST_F(CryptAuthBluetoothLowEnergyCharacteristicFinderTest, FindOnlyOneRightCharacteristic) { BluetoothLowEnergyCharacteristicsFinder characteristic_finder( adapter_, device_.get(), remote_service_, to_peripheral_char_, @@ -215,7 +215,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyCharacteristicFinderTest, EXPECT_EQ(kFromPeripheralCharID, found_from_char.id); } -TEST_F(ProximityAuthBluetoothLowEnergyCharacteristicFinderTest, +TEST_F(CryptAuthBluetoothLowEnergyCharacteristicFinderTest, FindWrongCharacteristic_FindRightCharacteristics) { BluetoothLowEnergyCharacteristicsFinder characteristic_finder( adapter_, device_.get(), remote_service_, to_peripheral_char_, @@ -252,7 +252,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyCharacteristicFinderTest, observer->GattDiscoveryCompleteForService(adapter_.get(), service_.get()); } -TEST_F(ProximityAuthBluetoothLowEnergyCharacteristicFinderTest, +TEST_F(CryptAuthBluetoothLowEnergyCharacteristicFinderTest, RightCharacteristicsAlreadyPresent) { RemoteAttribute found_to_char, found_from_char; EXPECT_CALL(*this, OnCharacteristicsFound(_, _, _)) diff --git a/components/cryptauth/ble/bluetooth_low_energy_weave_client_connection.cc b/components/cryptauth/ble/bluetooth_low_energy_weave_client_connection.cc index 529a1b259ddfe3..fac07bc77a832b 100644 --- a/components/cryptauth/ble/bluetooth_low_energy_weave_client_connection.cc +++ b/components/cryptauth/ble/bluetooth_low_energy_weave_client_connection.cc @@ -40,10 +40,10 @@ const char kRXCharacteristicUUID[] = "00000100-0004-1000-8000-001A11000102"; BluetoothLowEnergyWeaveClientConnection:: BluetoothLowEnergyWeaveClientConnection( - const cryptauth::RemoteDevice& device, + const RemoteDevice& device, scoped_refptr adapter, const BluetoothUUID remote_service_uuid, - cryptauth::BluetoothThrottler* bluetooth_throttler, + BluetoothThrottler* bluetooth_throttler, int max_number_of_write_attempts) : Connection(device), adapter_(adapter), @@ -162,7 +162,7 @@ void BluetoothLowEnergyWeaveClientConnection::SetSubStatus( SubStatus new_sub_status) { sub_status_ = new_sub_status; - // Sets the status of parent class cryptauth::Connection accordingly. + // Sets the status of parent class Connection accordingly. if (new_sub_status == SubStatus::CONNECTED) { SetStatus(Status::CONNECTED); } else if (new_sub_status == SubStatus::DISCONNECTED) { diff --git a/components/cryptauth/ble/bluetooth_low_energy_weave_client_connection.h b/components/cryptauth/ble/bluetooth_low_energy_weave_client_connection.h index 1a66bf2391f83e..797c73241290b6 100644 --- a/components/cryptauth/ble/bluetooth_low_energy_weave_client_connection.h +++ b/components/cryptauth/ble/bluetooth_low_energy_weave_client_connection.h @@ -69,8 +69,8 @@ class BluetoothLowEnergyWeaveClientConnection static Factory* factory_instance_; }; - // The sub-state of a cryptauth::BluetoothLowEnergyWeaveClientConnection - // extends the IN_PROGRESS state of cryptauth::Connection::Status. + // The sub-state of a BluetoothLowEnergyWeaveClientConnection + // extends the IN_PROGRESS state of Connection::Status. enum SubStatus { DISCONNECTED, WAITING_GATT_CONNECTION, @@ -88,7 +88,7 @@ class BluetoothLowEnergyWeaveClientConnection // pass through |gatt_connection|. A subsequent call to Connect() must be // made. BluetoothLowEnergyWeaveClientConnection( - const cryptauth::RemoteDevice& remote_device, + const RemoteDevice& remote_device, scoped_refptr adapter, const device::BluetoothUUID remote_service_uuid, BluetoothThrottler* bluetooth_throttler, @@ -96,7 +96,7 @@ class BluetoothLowEnergyWeaveClientConnection ~BluetoothLowEnergyWeaveClientConnection() override; - // namespace cryptauth::Connection: + // namespace Connection: void Connect() override; void Disconnect() override; std::string GetDeviceAddress() override; @@ -118,7 +118,7 @@ class BluetoothLowEnergyWeaveClientConnection const BluetoothLowEnergyCharacteristicsFinder::ErrorCallback& error_callback); - // namespace cryptauth::Connection: + // namespace Connection: void SendMessageImpl(std::unique_ptr message) override; // device::BluetoothAdapter::Observer: diff --git a/components/cryptauth/ble/bluetooth_low_energy_weave_client_connection_unittest.cc b/components/cryptauth/ble/bluetooth_low_energy_weave_client_connection_unittest.cc index e0dc88d145de5b..cf49aa0d0c1a07 100644 --- a/components/cryptauth/ble/bluetooth_low_energy_weave_client_connection_unittest.cc +++ b/components/cryptauth/ble/bluetooth_low_energy_weave_client_connection_unittest.cc @@ -304,7 +304,7 @@ class TestBluetoothLowEnergyWeaveClientConnection : public BluetoothLowEnergyWeaveClientConnection { public: TestBluetoothLowEnergyWeaveClientConnection( - const cryptauth::RemoteDevice& remote_device, + const RemoteDevice& remote_device, scoped_refptr adapter, const device::BluetoothUUID remote_service_uuid, BluetoothThrottler* bluetooth_throttler, @@ -341,10 +341,10 @@ class TestBluetoothLowEnergyWeaveClientConnection } // namespace -class ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest +class CryptAuthBluetoothLowEnergyWeaveClientConnectionTest : public testing::Test { public: - ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest() + CryptAuthBluetoothLowEnergyWeaveClientConnectionTest() : adapter_(new NiceMock), remote_device_(CreateLERemoteDeviceForTest()), service_uuid_(device::BluetoothUUID(kServiceUUID)), @@ -363,7 +363,7 @@ class ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest receiver_factory_); } - ~ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest() override { + ~CryptAuthBluetoothLowEnergyWeaveClientConnectionTest() override { BluetoothLowEnergyWeavePacketGenerator::Factory::SetInstanceForTesting( nullptr); BluetoothLowEnergyWeavePacketReceiver::Factory::SetInstanceForTesting( @@ -588,7 +588,7 @@ class ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest protected: scoped_refptr adapter_; - cryptauth::RemoteDevice remote_device_; + RemoteDevice remote_device_; device::BluetoothUUID service_uuid_; device::BluetoothUUID tx_characteristic_uuid_; device::BluetoothUUID rx_characteristic_uuid_; @@ -629,21 +629,21 @@ class ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest write_remote_characteristic_error_callback_; }; -TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, +TEST_F(CryptAuthBluetoothLowEnergyWeaveClientConnectionTest, CreateAndDestroyWithoutConnectCallDoesntCrash) { BluetoothLowEnergyWeaveClientConnection connection( remote_device_, adapter_, service_uuid_, bluetooth_throttler_.get(), kMaxNumberOfTries); } -TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, +TEST_F(CryptAuthBluetoothLowEnergyWeaveClientConnectionTest, DisconnectWithoutConnectDoesntCrash) { std::unique_ptr connection( CreateConnection()); Disconnect(connection.get()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, +TEST_F(CryptAuthBluetoothLowEnergyWeaveClientConnectionTest, ConnectSuccess) { std::unique_ptr connection( CreateConnection()); @@ -653,7 +653,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, ConnectionResponseReceived(connection.get(), kDefaultMaxPacketSize); } -TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, +TEST_F(CryptAuthBluetoothLowEnergyWeaveClientConnectionTest, ConnectSuccessDisconnect) { std::unique_ptr connection( CreateConnection()); @@ -662,7 +662,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, Disconnect(connection.get()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, +TEST_F(CryptAuthBluetoothLowEnergyWeaveClientConnectionTest, ConnectIncompleteDisconnectFromWaitingCharacteristicsState) { std::unique_ptr connection( CreateConnection()); @@ -670,7 +670,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, Disconnect(connection.get()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, +TEST_F(CryptAuthBluetoothLowEnergyWeaveClientConnectionTest, ConnectIncompleteDisconnectFromWaitingNotifySessionState) { std::unique_ptr connection( CreateConnection()); @@ -679,7 +679,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, Disconnect(connection.get()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, +TEST_F(CryptAuthBluetoothLowEnergyWeaveClientConnectionTest, ConnectIncompleteDisconnectFromWaitingConnectionResponseState) { std::unique_ptr connection( CreateConnection()); @@ -689,7 +689,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, Disconnect(connection.get()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, +TEST_F(CryptAuthBluetoothLowEnergyWeaveClientConnectionTest, ConnectFailsCharacteristicsNotFound) { std::unique_ptr connection( CreateConnection()); @@ -707,7 +707,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, EXPECT_EQ(connection->status(), Connection::DISCONNECTED); } -TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, +TEST_F(CryptAuthBluetoothLowEnergyWeaveClientConnectionTest, ConnectFailsNotifySessionError) { std::unique_ptr connection( CreateConnection()); @@ -725,7 +725,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, EXPECT_EQ(connection->status(), Connection::DISCONNECTED); } -TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, +TEST_F(CryptAuthBluetoothLowEnergyWeaveClientConnectionTest, ConnectFailsErrorSendingConnectionRequest) { std::unique_ptr connection( CreateConnection()); @@ -757,7 +757,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, EXPECT_EQ(connection->status(), Connection::DISCONNECTED); } -TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, +TEST_F(CryptAuthBluetoothLowEnergyWeaveClientConnectionTest, ReceiveMessageSmallerThanCharacteristicSize) { std::unique_ptr connection( CreateConnection()); @@ -773,7 +773,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, EXPECT_EQ(received_bytes, kSmallMessage); } -TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, +TEST_F(CryptAuthBluetoothLowEnergyWeaveClientConnectionTest, ReceiveMessageLargerThanCharacteristicSize) { std::unique_ptr connection( CreateConnection()); @@ -793,7 +793,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, EXPECT_EQ(received_bytes, kLargeMessage); } -TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, +TEST_F(CryptAuthBluetoothLowEnergyWeaveClientConnectionTest, SendMessageSmallerThanCharacteristicSize) { std::unique_ptr connection( CreateConnection()); @@ -819,7 +819,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, EXPECT_TRUE(connection_observer_.GetLastSendSuccess()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, +TEST_F(CryptAuthBluetoothLowEnergyWeaveClientConnectionTest, SendMessageLargerThanCharacteristicSize) { std::unique_ptr connection( CreateConnection()); @@ -863,7 +863,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, EXPECT_TRUE(connection_observer_.GetLastSendSuccess()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, +TEST_F(CryptAuthBluetoothLowEnergyWeaveClientConnectionTest, SendMessageKeepsFailing) { std::unique_ptr connection( CreateConnection()); @@ -899,7 +899,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, EXPECT_EQ(connection->status(), Connection::DISCONNECTED); } -TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, +TEST_F(CryptAuthBluetoothLowEnergyWeaveClientConnectionTest, ReceiveCloseConnectionTest) { std::unique_ptr connection( CreateConnection()); @@ -914,7 +914,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, EXPECT_EQ(connection->status(), Connection::DISCONNECTED); } -TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, +TEST_F(CryptAuthBluetoothLowEnergyWeaveClientConnectionTest, ReceiverErrorTest) { std::unique_ptr connection( CreateConnection()); @@ -940,7 +940,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, EXPECT_EQ(connection->status(), Connection::DISCONNECTED); } -TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, +TEST_F(CryptAuthBluetoothLowEnergyWeaveClientConnectionTest, ReceiverErrorWithPendingWritesTest) { std::unique_ptr connection( CreateConnection()); @@ -979,7 +979,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, EXPECT_EQ(connection->status(), Connection::DISCONNECTED); } -TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, +TEST_F(CryptAuthBluetoothLowEnergyWeaveClientConnectionTest, WriteConnectionCloseMaxNumberOfTimes) { std::unique_ptr connection( CreateConnection()); @@ -1017,7 +1017,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, EXPECT_EQ(connection->status(), Connection::DISCONNECTED); } -TEST_F(ProximityAuthBluetoothLowEnergyWeaveClientConnectionTest, +TEST_F(CryptAuthBluetoothLowEnergyWeaveClientConnectionTest, ConnectAfterADelayWhenThrottled) { std::unique_ptr connection( CreateConnection()); diff --git a/components/cryptauth/ble/bluetooth_low_energy_weave_packet_generator_unittest.cc b/components/cryptauth/ble/bluetooth_low_energy_weave_packet_generator_unittest.cc index 44ef03b68a8934..7e1b4ed56ae419 100644 --- a/components/cryptauth/ble/bluetooth_low_energy_weave_packet_generator_unittest.cc +++ b/components/cryptauth/ble/bluetooth_low_energy_weave_packet_generator_unittest.cc @@ -15,10 +15,10 @@ namespace cryptauth { namespace weave { -class ProximityAuthBluetoothLowEnergyWeavePacketGeneratorTest +class CryptAuthBluetoothLowEnergyWeavePacketGeneratorTest : public testing::Test { protected: - ProximityAuthBluetoothLowEnergyWeavePacketGeneratorTest() {} + CryptAuthBluetoothLowEnergyWeavePacketGeneratorTest() {} void TestConnectionCloseWithReason(ReasonForClose reason_for_close, uint8_t expected_reason_for_close) { @@ -45,10 +45,10 @@ class ProximityAuthBluetoothLowEnergyWeavePacketGeneratorTest private: DISALLOW_COPY_AND_ASSIGN( - ProximityAuthBluetoothLowEnergyWeavePacketGeneratorTest); + CryptAuthBluetoothLowEnergyWeavePacketGeneratorTest); }; -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketGeneratorTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketGeneratorTest, CreateConnectionRequestTest) { std::unique_ptr generator = BluetoothLowEnergyWeavePacketGenerator::Factory::NewInstance(); @@ -73,7 +73,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketGeneratorTest, EXPECT_EQ(expected, packet); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketGeneratorTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketGeneratorTest, CreateConnectionResponseWithDefaultPacketSizeTest) { std::unique_ptr generator = BluetoothLowEnergyWeavePacketGenerator::Factory::NewInstance(); @@ -93,7 +93,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketGeneratorTest, EXPECT_EQ(expected_default, packet); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketGeneratorTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketGeneratorTest, CreateConnectionResponseWithSelectedPacketSizeTest) { std::unique_ptr generator = BluetoothLowEnergyWeavePacketGenerator::Factory::NewInstance(); @@ -116,7 +116,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketGeneratorTest, EXPECT_EQ(expected_selected, packet); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketGeneratorTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketGeneratorTest, CreateConnectionCloseTest) { // Reason for close spec of uWeave. // 0x00: Close without error @@ -134,7 +134,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketGeneratorTest, TestConnectionCloseWithReason(ReasonForClose::APPLICATION_ERROR, 0x80); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketGeneratorTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketGeneratorTest, EncodeDataMessageWithDefaultPacketSizeTest) { std::unique_ptr generator = BluetoothLowEnergyWeavePacketGenerator::Factory::NewInstance(); @@ -167,7 +167,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketGeneratorTest, EXPECT_EQ(expected, packets); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketGeneratorTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketGeneratorTest, EncodeDataMessageWithSelectedPacketSizeTest) { std::unique_ptr generator = BluetoothLowEnergyWeavePacketGenerator::Factory::NewInstance(); @@ -219,7 +219,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketGeneratorTest, EXPECT_EQ(expected, packets); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketGeneratorTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketGeneratorTest, PacketCounterForMixedPacketTypesTest) { std::unique_ptr generator = BluetoothLowEnergyWeavePacketGenerator::Factory::NewInstance(); @@ -238,7 +238,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketGeneratorTest, EXPECT_EQ(2, GetCounterFromHeader(packet[0])); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketGeneratorTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketGeneratorTest, PacketCounterWrappedAroundTest) { std::unique_ptr generator = BluetoothLowEnergyWeavePacketGenerator::Factory::NewInstance(); diff --git a/components/cryptauth/ble/bluetooth_low_energy_weave_packet_receiver_unittest.cc b/components/cryptauth/ble/bluetooth_low_energy_weave_packet_receiver_unittest.cc index d631c16066b68d..827e88b5916fa6 100644 --- a/components/cryptauth/ble/bluetooth_low_energy_weave_packet_receiver_unittest.cc +++ b/components/cryptauth/ble/bluetooth_low_energy_weave_packet_receiver_unittest.cc @@ -36,17 +36,17 @@ const uint8_t kControlRequestHeader = 0x80; const uint8_t kControlResponseHeader = 0x81; } // namespace -class ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest +class CryptAuthBluetoothLowEnergyWeavePacketReceiverTest : public testing::Test { protected: - ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest() {} + CryptAuthBluetoothLowEnergyWeavePacketReceiverTest() {} private: DISALLOW_COPY_AND_ASSIGN( - ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest); + CryptAuthBluetoothLowEnergyWeavePacketReceiverTest); }; -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, WellBehavingServerPacketsNoControlDataTest) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -107,7 +107,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, EXPECT_EQ(ReasonForClose::APPLICATION_ERROR, receiver->GetReasonForClose()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, WellBehavingServerPacketsWithFullControlDataTest) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -173,7 +173,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, EXPECT_EQ(ReasonForClose::CLOSE_WITHOUT_ERROR, receiver->GetReasonForClose()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, WellBehavingServerPacketsWithSomeControlDataTest) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -223,7 +223,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, EXPECT_EQ(ReasonForClose::CLOSE_WITHOUT_ERROR, receiver->GetReasonForClose()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, WellBehavingClientPacketsNoControlDataTest) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -262,7 +262,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, EXPECT_EQ(ReasonForClose::APPLICATION_ERROR, receiver->GetReasonForClose()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, WellBehavingClientPacketsWithFullControlDataTest) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -315,7 +315,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, EXPECT_EQ(ReasonForClose::CLOSE_WITHOUT_ERROR, receiver->GetReasonForClose()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, WellBehavingClientPacketsWithSomeControlDataTest) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -356,7 +356,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, EXPECT_EQ(ReasonForClose::CLOSE_WITHOUT_ERROR, receiver->GetReasonForClose()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, LegacyCloseWithoutReasonTest) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -380,7 +380,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, EXPECT_EQ(ReasonForClose::UNKNOWN_ERROR, receiver->GetReasonForClose()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, OneBytePacketTest) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -405,7 +405,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, EXPECT_EQ("", receiver->GetDataMessage()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, EmptyPacketTest) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -418,7 +418,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, EXPECT_EQ(ReceiverError::EMPTY_PACKET, receiver->GetReceiverError()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, ServerReceivingConnectionResponseTest) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -433,7 +433,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, receiver->GetReceiverError()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, ClientReceivingConnectionRequestTest) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -449,7 +449,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, receiver->GetReceiverError()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, ReceiveConnectionCloseInConnecting) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -468,7 +468,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, receiver->GetReceiverError()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, ReceiveDataInConnecting) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -489,7 +489,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, receiver->GetReceiverError()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, ConnectionRequestTooSmallTest) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -504,7 +504,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, receiver->GetReceiverError()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, ConnectionRequestTooLargeTest) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -521,7 +521,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, receiver->GetReceiverError()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, ConnectionResponseTooSmallTest) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -536,7 +536,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, receiver->GetReceiverError()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, ConnectionResponseTooLargeTest) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -553,7 +553,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, receiver->GetReceiverError()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, ConnectionCloseTooLargeTest) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -578,7 +578,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, receiver->GetReceiverError()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, DataPacketTooLargeTest) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -607,7 +607,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, receiver->GetReceiverError()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, FirstPacketNoFirstNorLastBitTest) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -636,7 +636,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, receiver->GetReceiverError()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, FirstPacketNoFirstYesLastBitTest) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -665,7 +665,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, receiver->GetReceiverError()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, NonFirstPacketYesFirstBitTest) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -705,7 +705,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, receiver->GetReceiverError()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, OutOfOrderPacketTest) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -734,7 +734,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, receiver->GetReceiverError()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, InvalidVersionInConnectionRequestTest) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -753,7 +753,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, receiver->GetReceiverError()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, InvalidMaxPacketSizeInConnectionRequestTest) { const uint8_t kSmallMaxPacketSize = 19; @@ -772,7 +772,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, receiver->GetReceiverError()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, InvalidSelectedVersionInConnectionResponseTest) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -789,7 +789,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, receiver->GetReceiverError()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, InvalidSelectedMaxPacketSizeInConnectionResponseTest) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -806,7 +806,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, receiver->GetReceiverError()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, UnrecognizedReasonForCloseInConnectionCloseTest) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -832,7 +832,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, receiver->GetReceiverError()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, UnrecognizedControlCommandBitTwoTest) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -857,7 +857,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, receiver->GetReceiverError()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, InvalidControlCommandBitThreeTest) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -877,7 +877,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, receiver->GetReceiverError()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, InvalidBitOneInDataPacketHeaderTest) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -904,7 +904,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, receiver->GetReceiverError()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, InvalidBitZeroInDataPacketHeaderTest) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -931,7 +931,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, receiver->GetReceiverError()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, ReceivedPacketInErrorState) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -951,7 +951,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, EXPECT_EQ(ReceiverError::EMPTY_PACKET, receiver->GetReceiverError()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, ReceivedPacketInConnectionClosedStateTest) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( @@ -989,7 +989,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, receiver->GetReceiverError()); } -TEST_F(ProximityAuthBluetoothLowEnergyWeavePacketReceiverTest, +TEST_F(CryptAuthBluetoothLowEnergyWeavePacketReceiverTest, MultipleControlPacketTest) { std::unique_ptr receiver = BluetoothLowEnergyWeavePacketReceiver::Factory::NewInstance( diff --git a/components/cryptauth/ble/fake_wire_message.h b/components/cryptauth/ble/fake_wire_message.h index aa179e0fa92e23..8eb951669fef43 100644 --- a/components/cryptauth/ble/fake_wire_message.h +++ b/components/cryptauth/ble/fake_wire_message.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_CRYPTAUTH_FAKE_WIRE_MESSAGE_H -#define COMPONENTS_CRYPTAUTH_FAKE_WIRE_MESSAGE_H +#ifndef COMPONENTS_CRYPTAUTH_FAKE_WIRE_MESSAGE_H_ +#define COMPONENTS_CRYPTAUTH_FAKE_WIRE_MESSAGE_H_ #include #include @@ -26,4 +26,4 @@ class FakeWireMessage : public WireMessage { } // namespace cryptauth -#endif // COMPONENTS_CRYPTAUTH_WIRE_MESSAGE_H +#endif // COMPONENTS_CRYPTAUTH_FAKE_WIRE_MESSAGE_H_ diff --git a/components/cryptauth/ble/remote_attribute.h b/components/cryptauth/ble/remote_attribute.h index 190e332f05429b..1bf1218dd4f509 100644 --- a/components/cryptauth/ble/remote_attribute.h +++ b/components/cryptauth/ble/remote_attribute.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_CRYPTAUTH_BLE_REMOTE_ATTRIBUTE_H -#define COMPONENTS_CRYPTAUTH_BLE_REMOTE_ATTRIBUTE_H +#ifndef COMPONENTS_CRYPTAUTH_BLE_REMOTE_ATTRIBUTE_H_ +#define COMPONENTS_CRYPTAUTH_BLE_REMOTE_ATTRIBUTE_H_ #include @@ -19,4 +19,4 @@ struct RemoteAttribute { } // namespace cryptauth -#endif // COMPONENTS_CRYPTAUTH_REMOTE_ATTRIBUTE_H +#endif // COMPONENTS_CRYPTAUTH_BLE_REMOTE_ATTRIBUTE_H_ diff --git a/components/cryptauth/bluetooth_throttler.h b/components/cryptauth/bluetooth_throttler.h index ee77718e449980..90eed117951590 100644 --- a/components/cryptauth/bluetooth_throttler.h +++ b/components/cryptauth/bluetooth_throttler.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_CRYPTAUTH_BLUETOOTH_THROTTLER_H -#define COMPONENTS_CRYPTAUTH_BLUETOOTH_THROTTLER_H +#ifndef COMPONENTS_CRYPTAUTH_BLUETOOTH_THROTTLER_H_ +#define COMPONENTS_CRYPTAUTH_BLUETOOTH_THROTTLER_H_ namespace base { class TimeDelta; @@ -35,4 +35,4 @@ class BluetoothThrottler { } // namespace cryptauth -#endif // COMPONENTS_CRYPTAUTH_BLUETOOTH_THROTTLER_H +#endif // COMPONENTS_CRYPTAUTH_BLUETOOTH_THROTTLER_H_ diff --git a/components/cryptauth/bluetooth_throttler_impl.h b/components/cryptauth/bluetooth_throttler_impl.h index 6c3fac819df3d8..2933f1681193e3 100644 --- a/components/cryptauth/bluetooth_throttler_impl.h +++ b/components/cryptauth/bluetooth_throttler_impl.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_CRYPTAUTH_BLUETOOTH_THROTTLER_IMPL_H -#define COMPONENTS_CRYPTAUTH_BLUETOOTH_THROTTLER_IMPL_H +#ifndef COMPONENTS_CRYPTAUTH_BLUETOOTH_THROTTLER_IMPL_H_ +#define COMPONENTS_CRYPTAUTH_BLUETOOTH_THROTTLER_IMPL_H_ #include #include @@ -66,4 +66,4 @@ class BluetoothThrottlerImpl : public BluetoothThrottler, } // namespace cryptauth -#endif // COMPONENTS_CRYPTAUTH_BLUETOOTH_THROTTLER_IMPL_H +#endif // COMPONENTS_CRYPTAUTH_BLUETOOTH_THROTTLER_IMPL_H_ diff --git a/components/cryptauth/bluetooth_throttler_impl_unittest.cc b/components/cryptauth/bluetooth_throttler_impl_unittest.cc index 77f6280003025f..7a3a028f73802f 100644 --- a/components/cryptauth/bluetooth_throttler_impl_unittest.cc +++ b/components/cryptauth/bluetooth_throttler_impl_unittest.cc @@ -32,9 +32,9 @@ class TestBluetoothThrottler : public BluetoothThrottlerImpl { } // namespace -class ProximityAuthBluetoothThrottlerImplTest : public testing::Test { +class CryptAuthBluetoothThrottlerImplTest : public testing::Test { public: - ProximityAuthBluetoothThrottlerImplTest() + CryptAuthBluetoothThrottlerImplTest() : clock_(new base::SimpleTestTickClock), throttler_(base::WrapUnique(clock_)) { // The throttler treats null times as special, so start with a non-null @@ -44,7 +44,7 @@ class ProximityAuthBluetoothThrottlerImplTest : public testing::Test { void PerformConnectionStateTransition(Connection::Status old_status, Connection::Status new_status) { - FakeConnection connection((cryptauth::RemoteDevice())); + FakeConnection connection((RemoteDevice())); throttler_.OnConnection(&connection); static_cast(&throttler_) ->OnConnectionStatusChanged(&connection, old_status, new_status); @@ -56,12 +56,12 @@ class ProximityAuthBluetoothThrottlerImplTest : public testing::Test { TestBluetoothThrottler throttler_; }; -TEST_F(ProximityAuthBluetoothThrottlerImplTest, +TEST_F(CryptAuthBluetoothThrottlerImplTest, GetDelay_FirstConnectionIsNotThrottled) { EXPECT_EQ(base::TimeDelta(), throttler_.GetDelay()); } -TEST_F(ProximityAuthBluetoothThrottlerImplTest, +TEST_F(CryptAuthBluetoothThrottlerImplTest, GetDelay_ConnectionAfterDisconnectIsThrottled) { // Simulate a connection followed by a disconnection. PerformConnectionStateTransition(Connection::CONNECTED, @@ -69,7 +69,7 @@ TEST_F(ProximityAuthBluetoothThrottlerImplTest, EXPECT_GT(throttler_.GetDelay(), base::TimeDelta()); } -TEST_F(ProximityAuthBluetoothThrottlerImplTest, +TEST_F(CryptAuthBluetoothThrottlerImplTest, GetDelay_ConnectionAfterIsProgressDisconnectIsThrottled) { // Simulate an attempt to connect (in progress connection) followed by a // disconnection. @@ -78,7 +78,7 @@ TEST_F(ProximityAuthBluetoothThrottlerImplTest, EXPECT_GT(throttler_.GetDelay(), base::TimeDelta()); } -TEST_F(ProximityAuthBluetoothThrottlerImplTest, +TEST_F(CryptAuthBluetoothThrottlerImplTest, GetDelay_DelayedConnectionAfterDisconnectIsNotThrottled) { // Simulate a connection followed by a disconnection, then allow the cooldown // period to elapse. @@ -88,7 +88,7 @@ TEST_F(ProximityAuthBluetoothThrottlerImplTest, EXPECT_EQ(base::TimeDelta(), throttler_.GetDelay()); } -TEST_F(ProximityAuthBluetoothThrottlerImplTest, +TEST_F(CryptAuthBluetoothThrottlerImplTest, GetDelay_DelayedConnectionAfterInProgressDisconnectIsNotThrottled) { // Simulate an attempt to connect (in progress connection) followed by a // disconnection, then allow the cooldown period to elapse. diff --git a/components/cryptauth/connection.cc b/components/cryptauth/connection.cc index 21ee01f6d04a6f..ac0b2c318b278e 100644 --- a/components/cryptauth/connection.cc +++ b/components/cryptauth/connection.cc @@ -12,7 +12,7 @@ namespace cryptauth { -Connection::Connection(const cryptauth::RemoteDevice& remote_device) +Connection::Connection(const RemoteDevice& remote_device) : remote_device_(remote_device), status_(DISCONNECTED), is_sending_message_(false) {} diff --git a/components/cryptauth/connection.h b/components/cryptauth/connection.h index 5daba54fe782dd..c134fbf4d27f60 100644 --- a/components/cryptauth/connection.h +++ b/components/cryptauth/connection.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_CRYPTAUTH_CONNECTION_H -#define COMPONENTS_CRYPTAUTH_CONNECTION_H +#ifndef COMPONENTS_CRYPTAUTH_CONNECTION_H_ +#define COMPONENTS_CRYPTAUTH_CONNECTION_H_ #include @@ -28,7 +28,7 @@ class Connection { }; // Constructs a connection to the given |remote_device|. - explicit Connection(const cryptauth::RemoteDevice& remote_device); + explicit Connection(const RemoteDevice& remote_device); virtual ~Connection(); // Returns true iff the connection's status is CONNECTED. @@ -45,7 +45,7 @@ class Connection { void AddObserver(ConnectionObserver* observer); void RemoveObserver(ConnectionObserver* observer); - const cryptauth::RemoteDevice& remote_device() const { + const RemoteDevice& remote_device() const { return remote_device_; } @@ -94,7 +94,7 @@ class Connection { private: // The remote device corresponding to this connection. - const cryptauth::RemoteDevice remote_device_; + const RemoteDevice remote_device_; // The current status of the connection. Status status_; @@ -114,4 +114,4 @@ class Connection { } // namespace cryptauth -#endif // COMPONENTS_CRYPTAUTH_CONNECTION_H +#endif // COMPONENTS_CRYPTAUTH_CONNECTION_H_ diff --git a/components/cryptauth/connection_finder.h b/components/cryptauth/connection_finder.h index efc483bf2cfff8..f7873dd17df021 100644 --- a/components/cryptauth/connection_finder.h +++ b/components/cryptauth/connection_finder.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_CRYPTAUTH_CONNECTION_FINDER_H -#define COMPONENTS_CRYPTAUTH_CONNECTION_FINDER_H +#ifndef COMPONENTS_CRYPTAUTH_CONNECTION_FINDER_H_ +#define COMPONENTS_CRYPTAUTH_CONNECTION_FINDER_H_ #include @@ -30,4 +30,4 @@ class ConnectionFinder { } // namespace cryptauth -#endif // COMPONENTS_CRYPTAUTH_CONNECTION_FINDER_H +#endif // COMPONENTS_CRYPTAUTH_CONNECTION_FINDER_H_ diff --git a/components/cryptauth/connection_observer.h b/components/cryptauth/connection_observer.h index 9292e48a813fb3..3ac1a99c4efe36 100644 --- a/components/cryptauth/connection_observer.h +++ b/components/cryptauth/connection_observer.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_CRYPTAUTH_CONNECTION_OBSERVER_H -#define COMPONENTS_CRYPTAUTH_CONNECTION_OBSERVER_H +#ifndef COMPONENTS_CRYPTAUTH_CONNECTION_OBSERVER_H_ +#define COMPONENTS_CRYPTAUTH_CONNECTION_OBSERVER_H_ #include "components/cryptauth/connection.h" @@ -36,4 +36,4 @@ class ConnectionObserver { } // namespace cryptauth -#endif // COMPONENTS_CRYPTAUTH_CONNECTION_OBSERVER_H +#endif // COMPONENTS_CRYPTAUTH_CONNECTION_OBSERVER_H_ diff --git a/components/cryptauth/connection_unittest.cc b/components/cryptauth/connection_unittest.cc index 4d66fc4117db98..d33146a6ac2736 100644 --- a/components/cryptauth/connection_unittest.cc +++ b/components/cryptauth/connection_unittest.cc @@ -24,7 +24,7 @@ namespace { class MockConnection : public Connection { public: - MockConnection() : Connection(cryptauth::RemoteDevice()) {} + MockConnection() : Connection(RemoteDevice()) {} ~MockConnection() {} MOCK_METHOD1(SetPaused, void(bool paused)); @@ -87,7 +87,16 @@ class TestWireMessage : public WireMessage { } // namespace -TEST(ProximityAuthConnectionTest, IsConnected) { +class CryptAuthConnectionTest : public testing::Test { + protected: + CryptAuthConnectionTest() {} + ~CryptAuthConnectionTest() override {} + + private: + DISALLOW_COPY_AND_ASSIGN(CryptAuthConnectionTest); +}; + +TEST(CryptAuthConnectionTest, IsConnected) { StrictMock connection; EXPECT_FALSE(connection.IsConnected()); @@ -101,7 +110,7 @@ TEST(ProximityAuthConnectionTest, IsConnected) { EXPECT_FALSE(connection.IsConnected()); } -TEST(ProximityAuthConnectionTest, SendMessage_FailsWhenNotConnected) { +TEST(CryptAuthConnectionTest, SendMessage_FailsWhenNotConnected) { StrictMock connection; connection.SetStatus(Connection::IN_PROGRESS); @@ -109,7 +118,7 @@ TEST(ProximityAuthConnectionTest, SendMessage_FailsWhenNotConnected) { connection.SendMessage(std::unique_ptr()); } -TEST(ProximityAuthConnectionTest, +TEST(CryptAuthConnectionTest, SendMessage_FailsWhenAnotherMessageSendIsInProgress) { NiceMock connection; connection.SetStatus(Connection::CONNECTED); @@ -119,7 +128,7 @@ TEST(ProximityAuthConnectionTest, connection.SendMessage(std::unique_ptr()); } -TEST(ProximityAuthConnectionTest, SendMessage_SucceedsWhenConnected) { +TEST(CryptAuthConnectionTest, SendMessage_SucceedsWhenConnected) { StrictMock connection; connection.SetStatus(Connection::CONNECTED); @@ -127,7 +136,7 @@ TEST(ProximityAuthConnectionTest, SendMessage_SucceedsWhenConnected) { connection.SendMessage(std::unique_ptr()); } -TEST(ProximityAuthConnectionTest, +TEST(CryptAuthConnectionTest, SendMessage_SucceedsAfterPreviousMessageSendCompletes) { NiceMock connection; connection.SetStatus(Connection::CONNECTED); @@ -138,7 +147,7 @@ TEST(ProximityAuthConnectionTest, connection.SendMessage(std::unique_ptr()); } -TEST(ProximityAuthConnectionTest, SetStatus_NotifiesObserversOfStatusChange) { +TEST(CryptAuthConnectionTest, SetStatus_NotifiesObserversOfStatusChange) { StrictMock connection; EXPECT_EQ(Connection::DISCONNECTED, connection.status()); @@ -151,7 +160,7 @@ TEST(ProximityAuthConnectionTest, SetStatus_NotifiesObserversOfStatusChange) { connection.SetStatus(Connection::CONNECTED); } -TEST(ProximityAuthConnectionTest, +TEST(CryptAuthConnectionTest, SetStatus_DoesntNotifyObserversIfStatusUnchanged) { StrictMock connection; EXPECT_EQ(Connection::DISCONNECTED, connection.status()); @@ -163,7 +172,7 @@ TEST(ProximityAuthConnectionTest, connection.SetStatus(Connection::DISCONNECTED); } -TEST(ProximityAuthConnectionTest, +TEST(CryptAuthConnectionTest, OnDidSendMessage_NotifiesObserversIfMessageSendInProgress) { NiceMock connection; connection.SetStatus(Connection::CONNECTED); @@ -176,7 +185,7 @@ TEST(ProximityAuthConnectionTest, connection.OnDidSendMessage(TestWireMessage(), true /* success */); } -TEST(ProximityAuthConnectionTest, +TEST(CryptAuthConnectionTest, OnDidSendMessage_DoesntNotifyObserversIfNoMessageSendInProgress) { NiceMock connection; connection.SetStatus(Connection::CONNECTED); @@ -188,7 +197,7 @@ TEST(ProximityAuthConnectionTest, connection.OnDidSendMessage(TestWireMessage(), true /* success */); } -TEST(ProximityAuthConnectionTest, +TEST(CryptAuthConnectionTest, OnBytesReceived_NotifiesObserversOnValidMessage) { NiceMock connection; connection.SetStatus(Connection::CONNECTED); @@ -203,7 +212,7 @@ TEST(ProximityAuthConnectionTest, connection.OnBytesReceived(std::string()); } -TEST(ProximityAuthConnectionTest, +TEST(CryptAuthConnectionTest, OnBytesReceived_DoesntNotifyObserversIfNotConnected) { StrictMock connection; connection.SetStatus(Connection::IN_PROGRESS); @@ -215,7 +224,7 @@ TEST(ProximityAuthConnectionTest, connection.OnBytesReceived(std::string()); } -TEST(ProximityAuthConnectionTest, +TEST(CryptAuthConnectionTest, OnBytesReceived_DoesntNotifyObserversIfMessageIsIncomplete) { NiceMock connection; connection.SetStatus(Connection::CONNECTED); @@ -229,7 +238,7 @@ TEST(ProximityAuthConnectionTest, connection.OnBytesReceived(std::string()); } -TEST(ProximityAuthConnectionTest, +TEST(CryptAuthConnectionTest, OnBytesReceived_DoesntNotifyObserversIfMessageIsInvalid) { NiceMock connection; connection.SetStatus(Connection::CONNECTED); diff --git a/components/cryptauth/cryptauth_access_token_fetcher.h b/components/cryptauth/cryptauth_access_token_fetcher.h index 4e7eca6ef079b7..d79e7bdad02741 100644 --- a/components/cryptauth/cryptauth_access_token_fetcher.h +++ b/components/cryptauth/cryptauth_access_token_fetcher.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_ACCESS_TOKEN_FETCHER_H -#define COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_ACCESS_TOKEN_FETCHER_H +#ifndef COMPONENTS_CRYPTAUTH_CRYPTAUTH_ACCESS_TOKEN_FETCHER_H_ +#define COMPONENTS_CRYPTAUTH_CRYPTAUTH_ACCESS_TOKEN_FETCHER_H_ #include @@ -27,4 +27,4 @@ class CryptAuthAccessTokenFetcher { } // namespace cryptauth -#endif // COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_ACCESS_TOKEN_FETCHER_H +#endif // COMPONENTS_CRYPTAUTH_CRYPTAUTH_ACCESS_TOKEN_FETCHER_H_ diff --git a/components/cryptauth/cryptauth_access_token_fetcher_impl.h b/components/cryptauth/cryptauth_access_token_fetcher_impl.h index ce662a88b6dcc5..f683b54c038bc1 100644 --- a/components/cryptauth/cryptauth_access_token_fetcher_impl.h +++ b/components/cryptauth/cryptauth_access_token_fetcher_impl.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_ACCESS_TOKEN_FETCHER_IMPL_H -#define COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_ACCESS_TOKEN_FETCHER_IMPL_H +#ifndef COMPONENTS_CRYPTAUTH_CRYPTAUTH_ACCESS_TOKEN_FETCHER_IMPL_H_ +#define COMPONENTS_CRYPTAUTH_CRYPTAUTH_ACCESS_TOKEN_FETCHER_IMPL_H_ #include @@ -56,4 +56,4 @@ class CryptAuthAccessTokenFetcherImpl : public CryptAuthAccessTokenFetcher, } // namespace cryptauth -#endif // COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_ACCESS_TOKEN_FETCHER_IMPL_H +#endif // COMPONENTS_CRYPTAUTH_CRYPTAUTH_ACCESS_TOKEN_FETCHER_IMPL_H_ diff --git a/components/cryptauth/cryptauth_api_call_flow.h b/components/cryptauth/cryptauth_api_call_flow.h index 3abc100010e7e8..07a487edca68d7 100644 --- a/components/cryptauth/cryptauth_api_call_flow.h +++ b/components/cryptauth/cryptauth_api_call_flow.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_API_CALL_FLOW_H -#define COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_API_CALL_FLOW_H +#ifndef COMPONENTS_CRYPTAUTH_CRYPTAUTH_API_CALL_FLOW_H_ +#define COMPONENTS_CRYPTAUTH_CRYPTAUTH_API_CALL_FLOW_H_ #include @@ -73,4 +73,4 @@ class CryptAuthApiCallFlow : public OAuth2ApiCallFlow { } // namespace cryptauth -#endif // COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_API_CALL_FLOW_H +#endif // COMPONENTS_CRYPTAUTH_CRYPTAUTH_API_CALL_FLOW_H_ diff --git a/components/cryptauth/cryptauth_client.h b/components/cryptauth/cryptauth_client.h index ea61625b7b40e7..98c83d417bad1c 100644 --- a/components/cryptauth/cryptauth_client.h +++ b/components/cryptauth/cryptauth_client.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_CLIENT_H -#define COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_CLIENT_H +#ifndef COMPONENTS_CRYPTAUTH_CRYPTAUTH_CLIENT_H_ +#define COMPONENTS_CRYPTAUTH_CRYPTAUTH_CLIENT_H_ #include #include @@ -41,49 +41,49 @@ class CryptAuthClient { virtual ~CryptAuthClient() {} // GetMyDevices - typedef base::Callback + typedef base::Callback GetMyDevicesCallback; - virtual void GetMyDevices(const cryptauth::GetMyDevicesRequest& request, + virtual void GetMyDevices(const GetMyDevicesRequest& request, const GetMyDevicesCallback& callback, const ErrorCallback& error_callback) = 0; // FindEligibleUnlockDevices typedef base::Callback + const FindEligibleUnlockDevicesResponse&)> FindEligibleUnlockDevicesCallback; virtual void FindEligibleUnlockDevices( - const cryptauth::FindEligibleUnlockDevicesRequest& request, + const FindEligibleUnlockDevicesRequest& request, const FindEligibleUnlockDevicesCallback& callback, const ErrorCallback& error_callback) = 0; // SendDeviceSyncTickle - typedef base::Callback + typedef base::Callback SendDeviceSyncTickleCallback; virtual void SendDeviceSyncTickle( - const cryptauth::SendDeviceSyncTickleRequest& request, + const SendDeviceSyncTickleRequest& request, const SendDeviceSyncTickleCallback& callback, const ErrorCallback& error_callback) = 0; // ToggleEasyUnlock - typedef base::Callback + typedef base::Callback ToggleEasyUnlockCallback; virtual void ToggleEasyUnlock( - const cryptauth::ToggleEasyUnlockRequest& request, + const ToggleEasyUnlockRequest& request, const ToggleEasyUnlockCallback& callback, const ErrorCallback& error_callback) = 0; // SetupEnrollment - typedef base::Callback + typedef base::Callback SetupEnrollmentCallback; - virtual void SetupEnrollment(const cryptauth::SetupEnrollmentRequest& request, + virtual void SetupEnrollment(const SetupEnrollmentRequest& request, const SetupEnrollmentCallback& callback, const ErrorCallback& error_callback) = 0; // FinishEnrollment - typedef base::Callback + typedef base::Callback FinishEnrollmentCallback; virtual void FinishEnrollment( - const cryptauth::FinishEnrollmentRequest& request, + const FinishEnrollmentRequest& request, const FinishEnrollmentCallback& callback, const ErrorCallback& error_callback) = 0; @@ -104,4 +104,4 @@ class CryptAuthClientFactory { } // namespace cryptauth -#endif // COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_CLIENT_H +#endif // COMPONENTS_CRYPTAUTH_CRYPTAUTH_CLIENT_H_ diff --git a/components/cryptauth/cryptauth_client_impl.cc b/components/cryptauth/cryptauth_client_impl.cc index 69eebaf524fc49..259838598ef08a 100644 --- a/components/cryptauth/cryptauth_client_impl.cc +++ b/components/cryptauth/cryptauth_client_impl.cc @@ -52,7 +52,7 @@ CryptAuthClientImpl::CryptAuthClientImpl( std::unique_ptr api_call_flow, std::unique_ptr access_token_fetcher, scoped_refptr url_request_context, - const cryptauth::DeviceClassifier& device_classifier) + const DeviceClassifier& device_classifier) : api_call_flow_(std::move(api_call_flow)), access_token_fetcher_(std::move(access_token_fetcher)), url_request_context_(url_request_context), @@ -64,14 +64,14 @@ CryptAuthClientImpl::~CryptAuthClientImpl() { } void CryptAuthClientImpl::GetMyDevices( - const cryptauth::GetMyDevicesRequest& request, + const GetMyDevicesRequest& request, const GetMyDevicesCallback& callback, const ErrorCallback& error_callback) { MakeApiCall(kGetMyDevicesPath, request, callback, error_callback); } void CryptAuthClientImpl::FindEligibleUnlockDevices( - const cryptauth::FindEligibleUnlockDevicesRequest& request, + const FindEligibleUnlockDevicesRequest& request, const FindEligibleUnlockDevicesCallback& callback, const ErrorCallback& error_callback) { MakeApiCall(kFindEligibleUnlockDevicesPath, request, callback, @@ -79,28 +79,28 @@ void CryptAuthClientImpl::FindEligibleUnlockDevices( } void CryptAuthClientImpl::SendDeviceSyncTickle( - const cryptauth::SendDeviceSyncTickleRequest& request, + const SendDeviceSyncTickleRequest& request, const SendDeviceSyncTickleCallback& callback, const ErrorCallback& error_callback) { MakeApiCall(kSendDeviceSyncTicklePath, request, callback, error_callback); } void CryptAuthClientImpl::ToggleEasyUnlock( - const cryptauth::ToggleEasyUnlockRequest& request, + const ToggleEasyUnlockRequest& request, const ToggleEasyUnlockCallback& callback, const ErrorCallback& error_callback) { MakeApiCall(kToggleEasyUnlockPath, request, callback, error_callback); } void CryptAuthClientImpl::SetupEnrollment( - const cryptauth::SetupEnrollmentRequest& request, + const SetupEnrollmentRequest& request, const SetupEnrollmentCallback& callback, const ErrorCallback& error_callback) { MakeApiCall(kSetupEnrollmentPath, request, callback, error_callback); } void CryptAuthClientImpl::FinishEnrollment( - const cryptauth::FinishEnrollmentRequest& request, + const FinishEnrollmentRequest& request, const FinishEnrollmentCallback& callback, const ErrorCallback& error_callback) { MakeApiCall(kFinishEnrollmentPath, request, callback, error_callback); @@ -182,7 +182,7 @@ CryptAuthClientFactoryImpl::CryptAuthClientFactoryImpl( OAuth2TokenService* token_service, const std::string& account_id, scoped_refptr url_request_context, - const cryptauth::DeviceClassifier& device_classifier) + const DeviceClassifier& device_classifier) : token_service_(token_service), account_id_(account_id), url_request_context_(url_request_context), diff --git a/components/cryptauth/cryptauth_client_impl.h b/components/cryptauth/cryptauth_client_impl.h index 28a017cf04bd95..d880a118e24727 100644 --- a/components/cryptauth/cryptauth_client_impl.h +++ b/components/cryptauth/cryptauth_client_impl.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_CLIENT_IMPL_H -#define COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_CLIENT_IMPL_H +#ifndef COMPONENTS_CRYPTAUTH_CRYPTAUTH_CLIENT_IMPL_H_ +#define COMPONENTS_CRYPTAUTH_CRYPTAUTH_CLIENT_IMPL_H_ #include "base/macros.h" #include "base/memory/weak_ptr.h" @@ -33,28 +33,28 @@ class CryptAuthClientImpl : public CryptAuthClient { std::unique_ptr api_call_flow, std::unique_ptr access_token_fetcher, scoped_refptr url_request_context, - const cryptauth::DeviceClassifier& device_classifier); + const DeviceClassifier& device_classifier); ~CryptAuthClientImpl() override; // CryptAuthClient: - void GetMyDevices(const cryptauth::GetMyDevicesRequest& request, + void GetMyDevices(const GetMyDevicesRequest& request, const GetMyDevicesCallback& callback, const ErrorCallback& error_callback) override; void FindEligibleUnlockDevices( - const cryptauth::FindEligibleUnlockDevicesRequest& request, + const FindEligibleUnlockDevicesRequest& request, const FindEligibleUnlockDevicesCallback& callback, const ErrorCallback& error_callback) override; void SendDeviceSyncTickle( - const cryptauth::SendDeviceSyncTickleRequest& request, + const SendDeviceSyncTickleRequest& request, const SendDeviceSyncTickleCallback& callback, const ErrorCallback& error_callback) override; - void ToggleEasyUnlock(const cryptauth::ToggleEasyUnlockRequest& request, + void ToggleEasyUnlock(const ToggleEasyUnlockRequest& request, const ToggleEasyUnlockCallback& callback, const ErrorCallback& error_callback) override; - void SetupEnrollment(const cryptauth::SetupEnrollmentRequest& request, + void SetupEnrollment(const SetupEnrollmentRequest& request, const SetupEnrollmentCallback& callback, const ErrorCallback& error_callback) override; - void FinishEnrollment(const cryptauth::FinishEnrollmentRequest& request, + void FinishEnrollment(const FinishEnrollmentRequest& request, const FinishEnrollmentCallback& callback, const ErrorCallback& error_callback) override; std::string GetAccessTokenUsed() override; @@ -98,7 +98,7 @@ class CryptAuthClientImpl : public CryptAuthClient { // Contains basic device info of the client making the request that is sent to // CryptAuth with each API call. - const cryptauth::DeviceClassifier device_classifier_; + const DeviceClassifier device_classifier_; // True if an API call has been started. Remains true even after the API call // completes. @@ -130,7 +130,7 @@ class CryptAuthClientFactoryImpl : public CryptAuthClientFactory { OAuth2TokenService* token_service, const std::string& account_id, scoped_refptr url_request_context, - const cryptauth::DeviceClassifier& device_classifier); + const DeviceClassifier& device_classifier); ~CryptAuthClientFactoryImpl() override; // CryptAuthClientFactory: @@ -140,11 +140,11 @@ class CryptAuthClientFactoryImpl : public CryptAuthClientFactory { OAuth2TokenService* token_service_; const std::string account_id_; const scoped_refptr url_request_context_; - const cryptauth::DeviceClassifier device_classifier_; + const DeviceClassifier device_classifier_; DISALLOW_COPY_AND_ASSIGN(CryptAuthClientFactoryImpl); }; } // namespace cryptauth -#endif // COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_CLIENT_IMPL_H +#endif // COMPONENTS_CRYPTAUTH_CRYPTAUTH_CLIENT_IMPL_H_ diff --git a/components/cryptauth/cryptauth_client_impl_unittest.cc b/components/cryptauth/cryptauth_client_impl_unittest.cc index 9bb00daa884231..20224c00295004 100644 --- a/components/cryptauth/cryptauth_client_impl_unittest.cc +++ b/components/cryptauth/cryptauth_client_impl_unittest.cc @@ -40,7 +40,7 @@ const char kBluetoothAddress2[] = "BB:BB:BB:BB:BB:BB"; const int kDeviceOsVersionCode = 100; const int kDeviceSoftwareVersionCode = 200; const char kDeviceSoftwarePackage[] = "cryptauth_client_unittest"; -const cryptauth::DeviceType kDeviceType = cryptauth::CHROME; +const DeviceType kDeviceType = CHROME; // CryptAuthAccessTokenFetcher implementation simply returning a predetermined // access token. @@ -105,7 +105,7 @@ class CryptAuthClientTest : public testing::Test { base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( switches::kCryptAuthHTTPHost, kTestGoogleApisUrl); - cryptauth::DeviceClassifier device_classifier; + DeviceClassifier device_classifier; device_classifier.set_device_os_version_code(kDeviceOsVersionCode); device_classifier.set_device_software_version_code( kDeviceSoftwareVersionCode); @@ -160,21 +160,21 @@ TEST_F(CryptAuthClientTest, GetMyDevicesSuccess) { "https://www.testgoogleapis.com/cryptauth/v1/deviceSync/" "getmydevices?alt=proto"); - cryptauth::GetMyDevicesResponse result_proto; - cryptauth::GetMyDevicesRequest request_proto; + GetMyDevicesResponse result_proto; + GetMyDevicesRequest request_proto; request_proto.set_allow_stale_read(true); client_->GetMyDevices( request_proto, - base::Bind(&SaveResult, &result_proto), + base::Bind(&SaveResult, &result_proto), base::Bind(&NotCalled)); - cryptauth::GetMyDevicesRequest expected_request; + GetMyDevicesRequest expected_request; EXPECT_TRUE(expected_request.ParseFromString(serialized_request_)); EXPECT_TRUE(expected_request.allow_stale_read()); // Return two devices, one unlock key and one unlockable device. { - cryptauth::GetMyDevicesResponse response_proto; + GetMyDevicesResponse response_proto; response_proto.add_devices(); response_proto.mutable_devices(0)->set_public_key(kPublicKey1); response_proto.mutable_devices(0)->set_unlock_key(true); @@ -201,8 +201,8 @@ TEST_F(CryptAuthClientTest, GetMyDevicesFailure) { "getmydevices?alt=proto"); std::string error_message; - client_->GetMyDevices(cryptauth::GetMyDevicesRequest(), - base::Bind(&NotCalled), + client_->GetMyDevices(GetMyDevicesRequest(), + base::Bind(&NotCalled), base::Bind(&SaveResult, &error_message)); std::string kStatus500Error("HTTP status: 500"); @@ -215,21 +215,21 @@ TEST_F(CryptAuthClientTest, FindEligibleUnlockDevicesSuccess) { "https://www.testgoogleapis.com/cryptauth/v1/deviceSync/" "findeligibleunlockdevices?alt=proto"); - cryptauth::FindEligibleUnlockDevicesResponse result_proto; - cryptauth::FindEligibleUnlockDevicesRequest request_proto; + FindEligibleUnlockDevicesResponse result_proto; + FindEligibleUnlockDevicesRequest request_proto; request_proto.set_callback_bluetooth_address(kBluetoothAddress2); client_->FindEligibleUnlockDevices( request_proto, - base::Bind(&SaveResult, + base::Bind(&SaveResult, &result_proto), base::Bind(&NotCalled)); - cryptauth::FindEligibleUnlockDevicesRequest expected_request; + FindEligibleUnlockDevicesRequest expected_request; EXPECT_TRUE(expected_request.ParseFromString(serialized_request_)); EXPECT_EQ(kBluetoothAddress2, expected_request.callback_bluetooth_address()); // Return a response proto with one eligible and one ineligible device. - cryptauth::FindEligibleUnlockDevicesResponse response_proto; + FindEligibleUnlockDevicesResponse response_proto; response_proto.add_eligible_devices(); response_proto.mutable_eligible_devices(0)->set_public_key(kPublicKey1); @@ -259,11 +259,11 @@ TEST_F(CryptAuthClientTest, FindEligibleUnlockDevicesFailure) { "findeligibleunlockdevices?alt=proto"); std::string error_message; - cryptauth::FindEligibleUnlockDevicesRequest request_proto; + FindEligibleUnlockDevicesRequest request_proto; request_proto.set_callback_bluetooth_address(kBluetoothAddress1); client_->FindEligibleUnlockDevices( request_proto, - base::Bind(&NotCalled), + base::Bind(&NotCalled), base::Bind(&SaveResult, &error_message)); std::string kStatus403Error("HTTP status: 403"); @@ -276,17 +276,17 @@ TEST_F(CryptAuthClientTest, SendDeviceSyncTickleSuccess) { "https://www.testgoogleapis.com/cryptauth/v1/deviceSync/" "senddevicesynctickle?alt=proto"); - cryptauth::SendDeviceSyncTickleResponse result_proto; + SendDeviceSyncTickleResponse result_proto; client_->SendDeviceSyncTickle( - cryptauth::SendDeviceSyncTickleRequest(), - base::Bind(&SaveResult, + SendDeviceSyncTickleRequest(), + base::Bind(&SaveResult, &result_proto), base::Bind(&NotCalled)); - cryptauth::SendDeviceSyncTickleRequest expected_request; + SendDeviceSyncTickleRequest expected_request; EXPECT_TRUE(expected_request.ParseFromString(serialized_request_)); - cryptauth::SendDeviceSyncTickleResponse response_proto; + SendDeviceSyncTickleResponse response_proto; FinishApiCallFlow(&response_proto); } @@ -295,24 +295,24 @@ TEST_F(CryptAuthClientTest, ToggleEasyUnlockSuccess) { "https://www.testgoogleapis.com/cryptauth/v1/deviceSync/" "toggleeasyunlock?alt=proto"); - cryptauth::ToggleEasyUnlockResponse result_proto; - cryptauth::ToggleEasyUnlockRequest request_proto; + ToggleEasyUnlockResponse result_proto; + ToggleEasyUnlockRequest request_proto; request_proto.set_enable(true); request_proto.set_apply_to_all(false); request_proto.set_public_key(kPublicKey1); client_->ToggleEasyUnlock( request_proto, - base::Bind(&SaveResult, + base::Bind(&SaveResult, &result_proto), base::Bind(&NotCalled)); - cryptauth::ToggleEasyUnlockRequest expected_request; + ToggleEasyUnlockRequest expected_request; EXPECT_TRUE(expected_request.ParseFromString(serialized_request_)); EXPECT_TRUE(expected_request.enable()); EXPECT_EQ(kPublicKey1, expected_request.public_key()); EXPECT_FALSE(expected_request.apply_to_all()); - cryptauth::ToggleEasyUnlockResponse response_proto; + ToggleEasyUnlockResponse response_proto; FinishApiCallFlow(&response_proto); } @@ -326,17 +326,17 @@ TEST_F(CryptAuthClientTest, SetupEnrollmentSuccess) { supported_protocols.push_back("gcmV1"); supported_protocols.push_back("testProtocol"); - cryptauth::SetupEnrollmentResponse result_proto; - cryptauth::SetupEnrollmentRequest request_proto; + SetupEnrollmentResponse result_proto; + SetupEnrollmentRequest request_proto; request_proto.set_application_id(kApplicationId); request_proto.add_types("gcmV1"); request_proto.add_types("testProtocol"); client_->SetupEnrollment( - request_proto, base::Bind(&SaveResult, + request_proto, base::Bind(&SaveResult, &result_proto), base::Bind(&NotCalled)); - cryptauth::SetupEnrollmentRequest expected_request; + SetupEnrollmentRequest expected_request; EXPECT_TRUE(expected_request.ParseFromString(serialized_request_)); EXPECT_EQ(kApplicationId, expected_request.application_id()); ASSERT_EQ(2, expected_request.types_size()); @@ -345,7 +345,7 @@ TEST_F(CryptAuthClientTest, SetupEnrollmentSuccess) { // Return a fake enrollment session. { - cryptauth::SetupEnrollmentResponse response_proto; + SetupEnrollmentResponse response_proto; response_proto.set_status("OK"); response_proto.add_infos(); response_proto.mutable_infos(0)->set_type("gcmV1"); @@ -370,25 +370,25 @@ TEST_F(CryptAuthClientTest, FinishEnrollmentSuccess) { const char kEnrollmentSessionId[] = "enrollment_session_id"; const char kEnrollmentMessage[] = "enrollment_message"; const char kDeviceEphemeralKey[] = "device_ephermal_key"; - cryptauth::FinishEnrollmentResponse result_proto; - cryptauth::FinishEnrollmentRequest request_proto; + FinishEnrollmentResponse result_proto; + FinishEnrollmentRequest request_proto; request_proto.set_enrollment_session_id(kEnrollmentSessionId); request_proto.set_enrollment_message(kEnrollmentMessage); request_proto.set_device_ephemeral_key(kDeviceEphemeralKey); client_->FinishEnrollment( request_proto, - base::Bind(&SaveResult, + base::Bind(&SaveResult, &result_proto), base::Bind(&NotCalled)); - cryptauth::FinishEnrollmentRequest expected_request; + FinishEnrollmentRequest expected_request; EXPECT_TRUE(expected_request.ParseFromString(serialized_request_)); EXPECT_EQ(kEnrollmentSessionId, expected_request.enrollment_session_id()); EXPECT_EQ(kEnrollmentMessage, expected_request.enrollment_message()); EXPECT_EQ(kDeviceEphemeralKey, expected_request.device_ephemeral_key()); { - cryptauth::FinishEnrollmentResponse response_proto; + FinishEnrollmentResponse response_proto; response_proto.set_status("OK"); FinishApiCallFlow(&response_proto); } @@ -399,8 +399,8 @@ TEST_F(CryptAuthClientTest, FetchAccessTokenFailure) { access_token_fetcher_->set_access_token(""); std::string error_message; - client_->GetMyDevices(cryptauth::GetMyDevicesRequest(), - base::Bind(&NotCalled), + client_->GetMyDevices(GetMyDevicesRequest(), + base::Bind(&NotCalled), base::Bind(&SaveResult, &error_message)); EXPECT_EQ("Failed to get a valid access token.", error_message); @@ -412,8 +412,8 @@ TEST_F(CryptAuthClientTest, ParseResponseProtoFailure) { "getmydevices?alt=proto"); std::string error_message; - client_->GetMyDevices(cryptauth::GetMyDevicesRequest(), - base::Bind(&NotCalled), + client_->GetMyDevices(GetMyDevicesRequest(), + base::Bind(&NotCalled), base::Bind(&SaveResult, &error_message)); flow_result_callback_.Run("Not a valid serialized response message."); @@ -427,18 +427,18 @@ TEST_F(CryptAuthClientTest, "getmydevices?alt=proto"); // Make first request. - cryptauth::GetMyDevicesResponse result_proto; + GetMyDevicesResponse result_proto; client_->GetMyDevices( - cryptauth::GetMyDevicesRequest(), - base::Bind(&SaveResult, &result_proto), + GetMyDevicesRequest(), + base::Bind(&SaveResult, &result_proto), base::Bind(&NotCalled)); // With request pending, make second request. { std::string error_message; client_->FindEligibleUnlockDevices( - cryptauth::FindEligibleUnlockDevicesRequest(), - base::Bind(&NotCalled), + FindEligibleUnlockDevicesRequest(), + base::Bind(&NotCalled), base::Bind(&SaveResult, &error_message)); EXPECT_EQ("Client has been used for another request. Do not reuse.", error_message); @@ -446,7 +446,7 @@ TEST_F(CryptAuthClientTest, // Complete first request. { - cryptauth::GetMyDevicesResponse response_proto; + GetMyDevicesResponse response_proto; response_proto.add_devices(); response_proto.mutable_devices(0)->set_public_key(kPublicKey1); FinishApiCallFlow(&response_proto); @@ -464,16 +464,16 @@ TEST_F(CryptAuthClientTest, // Make first request. std::string error_message; - client_->GetMyDevices(cryptauth::GetMyDevicesRequest(), - base::Bind(&NotCalled), + client_->GetMyDevices(GetMyDevicesRequest(), + base::Bind(&NotCalled), base::Bind(&SaveResult, &error_message)); // With request pending, make second request. { std::string error_message; client_->FindEligibleUnlockDevices( - cryptauth::FindEligibleUnlockDevicesRequest(), - base::Bind(&NotCalled), + FindEligibleUnlockDevicesRequest(), + base::Bind(&NotCalled), base::Bind(&SaveResult, &error_message)); EXPECT_EQ("Client has been used for another request. Do not reuse.", error_message); @@ -492,13 +492,13 @@ TEST_F(CryptAuthClientTest, ExpectRequest( "https://www.testgoogleapis.com/cryptauth/v1/deviceSync/" "getmydevices?alt=proto"); - cryptauth::GetMyDevicesResponse result_proto; + GetMyDevicesResponse result_proto; client_->GetMyDevices( - cryptauth::GetMyDevicesRequest(), - base::Bind(&SaveResult, &result_proto), + GetMyDevicesRequest(), + base::Bind(&SaveResult, &result_proto), base::Bind(&NotCalled)); - cryptauth::GetMyDevicesResponse response_proto; + GetMyDevicesResponse response_proto; response_proto.add_devices(); response_proto.mutable_devices(0)->set_public_key(kPublicKey1); FinishApiCallFlow(&response_proto); @@ -510,8 +510,8 @@ TEST_F(CryptAuthClientTest, { std::string error_message; client_->FindEligibleUnlockDevices( - cryptauth::FindEligibleUnlockDevicesRequest(), - base::Bind(&NotCalled), + FindEligibleUnlockDevicesRequest(), + base::Bind(&NotCalled), base::Bind(&SaveResult, &error_message)); EXPECT_EQ("Client has been used for another request. Do not reuse.", error_message); @@ -523,17 +523,17 @@ TEST_F(CryptAuthClientTest, DeviceClassifierIsSet) { "https://www.testgoogleapis.com/cryptauth/v1/deviceSync/" "getmydevices?alt=proto"); - cryptauth::GetMyDevicesResponse result_proto; - cryptauth::GetMyDevicesRequest request_proto; + GetMyDevicesResponse result_proto; + GetMyDevicesRequest request_proto; request_proto.set_allow_stale_read(true); client_->GetMyDevices( request_proto, - base::Bind(&SaveResult, &result_proto), + base::Bind(&SaveResult, &result_proto), base::Bind(&NotCalled)); - cryptauth::GetMyDevicesRequest expected_request; + GetMyDevicesRequest expected_request; EXPECT_TRUE(expected_request.ParseFromString(serialized_request_)); - const cryptauth::DeviceClassifier& device_classifier = + const DeviceClassifier& device_classifier = expected_request.device_classifier(); EXPECT_EQ(kDeviceOsVersionCode, device_classifier.device_os_version_code()); EXPECT_EQ(kDeviceSoftwareVersionCode, @@ -549,12 +549,12 @@ TEST_F(CryptAuthClientTest, GetAccessTokenUsed) { "https://www.testgoogleapis.com/cryptauth/v1/deviceSync/" "getmydevices?alt=proto"); - cryptauth::GetMyDevicesResponse result_proto; - cryptauth::GetMyDevicesRequest request_proto; + GetMyDevicesResponse result_proto; + GetMyDevicesRequest request_proto; request_proto.set_allow_stale_read(true); client_->GetMyDevices( request_proto, - base::Bind(&SaveResult, &result_proto), + base::Bind(&SaveResult, &result_proto), base::Bind(&NotCalled)); EXPECT_EQ(kAccessToken, client_->GetAccessTokenUsed()); } diff --git a/components/cryptauth/cryptauth_device_manager.cc b/components/cryptauth/cryptauth_device_manager.cc index 98931e4f662ab8..3c7a3cf578973d 100644 --- a/components/cryptauth/cryptauth_device_manager.cc +++ b/components/cryptauth/cryptauth_device_manager.cc @@ -51,11 +51,11 @@ const char kExternalDeviceKeyBeaconSeedEndMs[] = "beacon_seed_end_ms"; // Converts BeaconSeed protos to a list value that can be stored in user prefs. std::unique_ptr BeaconSeedsToListValue( - const google::protobuf::RepeatedPtrField& seeds) { + const google::protobuf::RepeatedPtrField& seeds) { std::unique_ptr list(new base::ListValue()); for (int i = 0; i < seeds.size(); i++) { - cryptauth::BeaconSeed seed = seeds.Get(i); + BeaconSeed seed = seeds.Get(i); if (!seed.has_data() || !seed.has_start_time_millis() @@ -95,7 +95,7 @@ std::unique_ptr BeaconSeedsToListValue( // Converts an unlock key proto to a dictionary that can be stored in user // prefs. std::unique_ptr UnlockKeyToDictionary( - const cryptauth::ExternalDeviceInfo& device) { + const ExternalDeviceInfo& device) { // The device public key is a required value. if (!device.has_public_key()) { return nullptr; @@ -164,7 +164,7 @@ std::unique_ptr UnlockKeyToDictionary( void AddBeaconSeedsToExternalDevice( const base::ListValue& beacon_seeds, - cryptauth::ExternalDeviceInfo& external_device) { + ExternalDeviceInfo& external_device) { for (size_t i = 0; i < beacon_seeds.GetSize(); i++) { const base::DictionaryValue* seed_dictionary = nullptr; if (!beacon_seeds.GetDictionary(i, &seed_dictionary)) { @@ -202,7 +202,7 @@ void AddBeaconSeedsToExternalDevice( continue; } - cryptauth::BeaconSeed* seed = external_device.add_beacon_seeds(); + BeaconSeed* seed = external_device.add_beacon_seeds(); seed->set_data(seed_data); seed->set_start_time_millis(start_time_millis); seed->set_end_time_millis(end_time_millis); @@ -213,7 +213,7 @@ void AddBeaconSeedsToExternalDevice( // ExternalDeviceInfo proto. Returns true if the dictionary is valid, and the // parsed proto is written to |external_device|. bool DictionaryToUnlockKey(const base::DictionaryValue& dictionary, - cryptauth::ExternalDeviceInfo* external_device) { + ExternalDeviceInfo* external_device) { std::string public_key_b64; if (!dictionary.GetString(kExternalDeviceKeyPublicKey, &public_key_b64)) { // The public key is a required field, so if it is absent, there is no @@ -333,7 +333,7 @@ void CryptAuthDeviceManager::RegisterPrefs(PrefRegistrySimple* registry) { registry->RegisterBooleanPref( prefs::kCryptAuthDeviceSyncIsRecoveringFromFailure, false); registry->RegisterIntegerPref(prefs::kCryptAuthDeviceSyncReason, - cryptauth::INVOCATION_REASON_UNKNOWN); + INVOCATION_REASON_UNKNOWN); registry->RegisterListPref(prefs::kCryptAuthDeviceSyncUnlockKeys); } @@ -365,7 +365,7 @@ void CryptAuthDeviceManager::RemoveObserver(Observer* observer) { } void CryptAuthDeviceManager::ForceSyncNow( - cryptauth::InvocationReason invocation_reason) { + InvocationReason invocation_reason) { pref_service_->SetInteger(prefs::kCryptAuthDeviceSyncReason, invocation_reason); scheduler_->ForceSync(); @@ -416,7 +416,7 @@ std::vector CryptAuthDeviceManager::GetTetherHosts() const { } void CryptAuthDeviceManager::OnGetMyDevicesSuccess( - const cryptauth::GetMyDevicesResponse& response) { + const GetMyDevicesResponse& response) { // Update the synced devices stored in the user's prefs. std::unique_ptr devices_as_list(new base::ListValue()); for (const auto& device : response.devices()) { @@ -438,7 +438,7 @@ void CryptAuthDeviceManager::OnGetMyDevicesSuccess( pref_service_->SetDouble(prefs::kCryptAuthDeviceSyncLastSyncTimeSeconds, clock_->Now().ToDoubleT()); pref_service_->SetInteger(prefs::kCryptAuthDeviceSyncReason, - cryptauth::INVOCATION_REASON_UNKNOWN); + INVOCATION_REASON_UNKNOWN); sync_request_->OnDidComplete(true); cryptauth_client_.reset(); @@ -470,7 +470,7 @@ std::unique_ptr CryptAuthDeviceManager::CreateSyncScheduler() { } void CryptAuthDeviceManager::OnResyncMessage() { - ForceSyncNow(cryptauth::INVOCATION_REASON_SERVER_INITIATED); + ForceSyncNow(INVOCATION_REASON_SERVER_INITIATED); } void CryptAuthDeviceManager::UpdateUnlockKeysFromPrefs() { @@ -480,7 +480,7 @@ void CryptAuthDeviceManager::UpdateUnlockKeysFromPrefs() { for (size_t i = 0; i < unlock_key_list->GetSize(); ++i) { const base::DictionaryValue* unlock_key_dictionary; if (unlock_key_list->GetDictionary(i, &unlock_key_dictionary)) { - cryptauth::ExternalDeviceInfo unlock_key; + ExternalDeviceInfo unlock_key; if (DictionaryToUnlockKey(*unlock_key_dictionary, &unlock_key)) { synced_devices_.push_back(unlock_key); } else { @@ -502,8 +502,8 @@ void CryptAuthDeviceManager::OnSyncRequested( sync_request_ = std::move(sync_request); cryptauth_client_ = client_factory_->CreateInstance(); - cryptauth::InvocationReason invocation_reason = - cryptauth::INVOCATION_REASON_UNKNOWN; + InvocationReason invocation_reason = + INVOCATION_REASON_UNKNOWN; int reason_stored_in_prefs = pref_service_->GetInteger(prefs::kCryptAuthDeviceSyncReason); @@ -512,21 +512,21 @@ void CryptAuthDeviceManager::OnSyncRequested( // a cached copy of the user's devices, rather taking a database hit for the // freshest data. bool is_sync_speculative = - reason_stored_in_prefs != cryptauth::INVOCATION_REASON_UNKNOWN; + reason_stored_in_prefs != INVOCATION_REASON_UNKNOWN; - if (cryptauth::InvocationReason_IsValid(reason_stored_in_prefs) && - reason_stored_in_prefs != cryptauth::INVOCATION_REASON_UNKNOWN) { + if (InvocationReason_IsValid(reason_stored_in_prefs) && + reason_stored_in_prefs != INVOCATION_REASON_UNKNOWN) { invocation_reason = - static_cast(reason_stored_in_prefs); + static_cast(reason_stored_in_prefs); } else if (GetLastSyncTime().is_null()) { - invocation_reason = cryptauth::INVOCATION_REASON_INITIALIZATION; + invocation_reason = INVOCATION_REASON_INITIALIZATION; } else if (IsRecoveringFromFailure()) { - invocation_reason = cryptauth::INVOCATION_REASON_FAILURE_RECOVERY; + invocation_reason = INVOCATION_REASON_FAILURE_RECOVERY; } else { - invocation_reason = cryptauth::INVOCATION_REASON_PERIODIC; + invocation_reason = INVOCATION_REASON_PERIODIC; } - cryptauth::GetMyDevicesRequest request; + GetMyDevicesRequest request; request.set_invocation_reason(invocation_reason); request.set_allow_stale_read(is_sync_speculative); cryptauth_client_->GetMyDevices( diff --git a/components/cryptauth/cryptauth_device_manager.h b/components/cryptauth/cryptauth_device_manager.h index 96ba7ff404a076..a728f247abf31c 100644 --- a/components/cryptauth/cryptauth_device_manager.h +++ b/components/cryptauth/cryptauth_device_manager.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_CRYPTAUTH_DEVICE_MANAGER_H -#define COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_CRYPTAUTH_DEVICE_MANAGER_H +#ifndef COMPONENTS_CRYPTAUTH_CRYPTAUTH_DEVICE_MANAGER_H_ +#define COMPONENTS_CRYPTAUTH_CRYPTAUTH_DEVICE_MANAGER_H_ #include @@ -88,7 +88,7 @@ class CryptAuthDeviceManager : public SyncScheduler::Delegate, // sync attempt is already in progress, this function does nothing. // |invocation_reason| specifies the reason that the sync was triggered, // which is upload to the server. - void ForceSyncNow(cryptauth::InvocationReason invocation_reason); + void ForceSyncNow(InvocationReason invocation_reason); // Returns the timestamp of the last successful sync. If no sync // has ever been made, then returns a null base::Time object. @@ -106,13 +106,13 @@ class CryptAuthDeviceManager : public SyncScheduler::Delegate, bool IsRecoveringFromFailure() const; // Returns a list of all remote devices that have been synced. - virtual std::vector GetSyncedDevices() const; + virtual std::vector GetSyncedDevices() const; // Returns a list of remote devices that can unlock the user's other devices. - virtual std::vector GetUnlockKeys() const; + virtual std::vector GetUnlockKeys() const; // Returns a list of remote devices that can host tether hotspots. - virtual std::vector GetTetherHosts() const; + virtual std::vector GetTetherHosts() const; protected: // Empty constructor, to be used by tests to mock the device manager. Do not @@ -134,7 +134,7 @@ class CryptAuthDeviceManager : public SyncScheduler::Delegate, std::unique_ptr sync_request) override; // Callback when |cryptauth_client_| completes with the response. - void OnGetMyDevicesSuccess(const cryptauth::GetMyDevicesResponse& response); + void OnGetMyDevicesSuccess(const GetMyDevicesResponse& response); void OnGetMyDevicesFailure(const std::string& error); // Used to determine the time. @@ -153,7 +153,7 @@ class CryptAuthDeviceManager : public SyncScheduler::Delegate, PrefService* const pref_service_; // All devices currently synced from CryptAuth. - std::vector synced_devices_; + std::vector synced_devices_; // Schedules the time between device sync attempts. std::unique_ptr scheduler_; @@ -176,4 +176,4 @@ class CryptAuthDeviceManager : public SyncScheduler::Delegate, } // namespace cryptauth -#endif // COMPONENTS_PROXIMITY_CRYPTAUTH_CRYPTAUTH_DEVICE_MANAGER_H +#endif // COMPONENTS_CRYPTAUTH_CRYPTAUTH_DEVICE_MANAGER_H_ diff --git a/components/cryptauth/cryptauth_device_manager_unittest.cc b/components/cryptauth/cryptauth_device_manager_unittest.cc index 0870113282486a..c89f8261e43b4c 100644 --- a/components/cryptauth/cryptauth_device_manager_unittest.cc +++ b/components/cryptauth/cryptauth_device_manager_unittest.cc @@ -79,8 +79,8 @@ const int64_t kBeaconSeed4EndTime = 234568; // Validates that |devices| is equal to |expected_devices|. void ExpectSyncedDevicesAreEqual( - const std::vector& expected_devices, - const std::vector& devices) { + const std::vector& expected_devices, + const std::vector& devices) { ASSERT_EQ(expected_devices.size(), devices.size()); for (size_t i = 0; i < devices.size(); ++i) { SCOPED_TRACE( @@ -130,9 +130,9 @@ void ExpectSyncedDevicesAreEqual( ASSERT_EQ(expected_device.beacon_seeds_size(), device.beacon_seeds_size()); for (int i = 0; i < expected_device.beacon_seeds_size(); i++) { - const cryptauth::BeaconSeed expected_seed = + const BeaconSeed expected_seed = expected_device.beacon_seeds(i); - const cryptauth::BeaconSeed seed = device.beacon_seeds(i); + const BeaconSeed seed = device.beacon_seeds(i); EXPECT_TRUE(expected_seed.has_data()); EXPECT_TRUE(seed.has_data()); EXPECT_EQ(expected_seed.data(), seed.data()); @@ -151,8 +151,8 @@ void ExpectSyncedDevicesAreEqual( // Validates that |devices| and the corresponding preferences stored by // |pref_service| are equal to |expected_devices|. void ExpectSyncedDevicesAndPrefAreEqual( - const std::vector& expected_devices, - const std::vector& devices, + const std::vector& expected_devices, + const std::vector& devices, const PrefService& pref_service) { ExpectSyncedDevicesAreEqual(expected_devices, devices); @@ -263,7 +263,7 @@ void ExpectSyncedDevicesAndPrefAreEqual( EXPECT_TRUE(seed->GetString("beacon_seed_start_ms", &start_ms)); EXPECT_TRUE(seed->GetString("beacon_seed_end_ms", &end_ms)); - const cryptauth::BeaconSeed& expected_seed = + const BeaconSeed& expected_seed = expected_device.beacon_seeds((int) i); std::string data; @@ -338,34 +338,34 @@ class CryptAuthDeviceManagerTest gcm_manager_("existing gcm registration id") { client_factory_->AddObserver(this); - cryptauth::ExternalDeviceInfo unlock_key; + ExternalDeviceInfo unlock_key; unlock_key.set_public_key(kPublicKey1); unlock_key.set_friendly_device_name(kDeviceName1); unlock_key.set_bluetooth_address(kBluetoothAddress1); unlock_key.set_unlock_key(kUnlockKey1); unlock_key.set_unlockable(kUnlockable1); unlock_key.set_mobile_hotspot_supported(kMobileHotspotSupported1); - cryptauth::BeaconSeed* seed1 = unlock_key.add_beacon_seeds(); + BeaconSeed* seed1 = unlock_key.add_beacon_seeds(); seed1->set_data(kBeaconSeed1Data); seed1->set_start_time_millis(kBeaconSeed1StartTime); seed1->set_end_time_millis(kBeaconSeed1EndTime); - cryptauth::BeaconSeed* seed2 = unlock_key.add_beacon_seeds(); + BeaconSeed* seed2 = unlock_key.add_beacon_seeds(); seed2->set_data(kBeaconSeed2Data); seed2->set_start_time_millis(kBeaconSeed2StartTime); seed2->set_end_time_millis(kBeaconSeed2EndTime); devices_in_response_.push_back(unlock_key); - cryptauth::ExternalDeviceInfo unlockable_device; + ExternalDeviceInfo unlockable_device; unlockable_device.set_public_key(kPublicKey2); unlockable_device.set_friendly_device_name(kDeviceName2); unlockable_device.set_unlock_key(kUnlockKey2); unlockable_device.set_unlockable(kUnlockable2); unlockable_device.set_mobile_hotspot_supported(kMobileHotspotSupported2); - cryptauth::BeaconSeed* seed3 = unlockable_device.add_beacon_seeds(); + BeaconSeed* seed3 = unlockable_device.add_beacon_seeds(); seed3->set_data(kBeaconSeed3Data); seed3->set_start_time_millis(kBeaconSeed3StartTime); seed3->set_end_time_millis(kBeaconSeed3EndTime); - cryptauth::BeaconSeed* seed4 = unlockable_device.add_beacon_seeds(); + BeaconSeed* seed4 = unlockable_device.add_beacon_seeds(); seed4->set_data(kBeaconSeed4Data); seed4->set_start_time_millis(kBeaconSeed4StartTime); seed4->set_end_time_millis(kBeaconSeed4EndTime); @@ -388,7 +388,7 @@ class CryptAuthDeviceManagerTest new base::FundamentalValue(kLastSyncTimeSeconds)); pref_service_.SetUserPref( prefs::kCryptAuthDeviceSyncReason, - new base::FundamentalValue(cryptauth::INVOCATION_REASON_UNKNOWN)); + new base::FundamentalValue(INVOCATION_REASON_UNKNOWN)); std::unique_ptr device_dictionary( new base::DictionaryValue()); @@ -450,7 +450,7 @@ class CryptAuthDeviceManagerTest // Simulates firing the SyncScheduler to trigger a device sync attempt. void FireSchedulerForSync( - cryptauth::InvocationReason expected_invocation_reason) { + InvocationReason expected_invocation_reason) { SyncScheduler::Delegate* delegate = static_cast(device_manager_.get()); @@ -466,7 +466,7 @@ class CryptAuthDeviceManagerTest // The allow_stale_read flag is set if the sync was not forced. bool allow_stale_read = pref_service_.GetInteger(prefs::kCryptAuthDeviceSyncReason) != - cryptauth::INVOCATION_REASON_UNKNOWN; + INVOCATION_REASON_UNKNOWN; EXPECT_EQ(allow_stale_read, get_my_devices_request_.allow_stale_read()); } @@ -494,11 +494,11 @@ class CryptAuthDeviceManagerTest std::unique_ptr device_manager_; - std::vector devices_in_response_; + std::vector devices_in_response_; - cryptauth::GetMyDevicesResponse get_my_devices_response_; + GetMyDevicesResponse get_my_devices_response_; - cryptauth::GetMyDevicesRequest get_my_devices_request_; + GetMyDevicesRequest get_my_devices_request_; CryptAuthClient::GetMyDevicesCallback success_callback_; @@ -589,7 +589,7 @@ TEST_F(CryptAuthDeviceManagerTest, SyncSucceedsForFirstTime) { pref_service_.ClearPref(prefs::kCryptAuthDeviceSyncLastSyncTimeSeconds); device_manager_->Start(); - FireSchedulerForSync(cryptauth::INVOCATION_REASON_INITIALIZATION); + FireSchedulerForSync(INVOCATION_REASON_INITIALIZATION); ASSERT_FALSE(success_callback_.is_null()); clock_->SetNow(base::Time::FromDoubleT(kLaterTimeNowSeconds)); @@ -609,9 +609,9 @@ TEST_F(CryptAuthDeviceManagerTest, ForceSync) { device_manager_->Start(); EXPECT_CALL(*sync_scheduler(), ForceSync()); - device_manager_->ForceSyncNow(cryptauth::INVOCATION_REASON_MANUAL); + device_manager_->ForceSyncNow(INVOCATION_REASON_MANUAL); - FireSchedulerForSync(cryptauth::INVOCATION_REASON_MANUAL); + FireSchedulerForSync(INVOCATION_REASON_MANUAL); clock_->SetNow(base::Time::FromDoubleT(kLaterTimeNowSeconds)); EXPECT_CALL(*this, OnSyncFinishedProxy( @@ -633,8 +633,8 @@ TEST_F(CryptAuthDeviceManagerTest, ForceSyncFailsThenSucceeds) { // The first force sync fails. EXPECT_CALL(*sync_scheduler(), ForceSync()); - device_manager_->ForceSyncNow(cryptauth::INVOCATION_REASON_MANUAL); - FireSchedulerForSync(cryptauth::INVOCATION_REASON_MANUAL); + device_manager_->ForceSyncNow(INVOCATION_REASON_MANUAL); + FireSchedulerForSync(INVOCATION_REASON_MANUAL); clock_->SetNow(base::Time::FromDoubleT(kLaterTimeNowSeconds)); EXPECT_CALL(*this, OnSyncFinishedProxy( @@ -644,13 +644,13 @@ TEST_F(CryptAuthDeviceManagerTest, ForceSyncFailsThenSucceeds) { EXPECT_EQ(old_sync_time, device_manager_->GetLastSyncTime()); EXPECT_TRUE(pref_service_.GetBoolean( prefs::kCryptAuthDeviceSyncIsRecoveringFromFailure)); - EXPECT_EQ(static_cast(cryptauth::INVOCATION_REASON_MANUAL), + EXPECT_EQ(static_cast(INVOCATION_REASON_MANUAL), pref_service_.GetInteger(prefs::kCryptAuthDeviceSyncReason)); // The second recovery sync succeeds. ON_CALL(*sync_scheduler(), GetStrategy()) .WillByDefault(Return(SyncScheduler::Strategy::AGGRESSIVE_RECOVERY)); - FireSchedulerForSync(cryptauth::INVOCATION_REASON_MANUAL); + FireSchedulerForSync(INVOCATION_REASON_MANUAL); clock_->SetNow(base::Time::FromDoubleT(kLaterTimeNowSeconds + 30)); EXPECT_CALL(*this, OnSyncFinishedProxy( CryptAuthDeviceManager::SyncResult::SUCCESS, @@ -665,7 +665,7 @@ TEST_F(CryptAuthDeviceManagerTest, ForceSyncFailsThenSucceeds) { EXPECT_FLOAT_EQ( clock_->Now().ToDoubleT(), pref_service_.GetDouble(prefs::kCryptAuthDeviceSyncLastSyncTimeSeconds)); - EXPECT_EQ(static_cast(cryptauth::INVOCATION_REASON_UNKNOWN), + EXPECT_EQ(static_cast(INVOCATION_REASON_UNKNOWN), pref_service_.GetInteger(prefs::kCryptAuthDeviceSyncReason)); EXPECT_FALSE(pref_service_.GetBoolean( prefs::kCryptAuthDeviceSyncIsRecoveringFromFailure)); @@ -676,7 +676,7 @@ TEST_F(CryptAuthDeviceManagerTest, PeriodicSyncFailsThenSucceeds) { base::Time old_sync_time = device_manager_->GetLastSyncTime(); // The first periodic sync fails. - FireSchedulerForSync(cryptauth::INVOCATION_REASON_PERIODIC); + FireSchedulerForSync(INVOCATION_REASON_PERIODIC); clock_->SetNow(base::Time::FromDoubleT(kLaterTimeNowSeconds)); EXPECT_CALL(*this, OnSyncFinishedProxy( @@ -690,7 +690,7 @@ TEST_F(CryptAuthDeviceManagerTest, PeriodicSyncFailsThenSucceeds) { // The second recovery sync succeeds. ON_CALL(*sync_scheduler(), GetStrategy()) .WillByDefault(Return(SyncScheduler::Strategy::AGGRESSIVE_RECOVERY)); - FireSchedulerForSync(cryptauth::INVOCATION_REASON_FAILURE_RECOVERY); + FireSchedulerForSync(INVOCATION_REASON_FAILURE_RECOVERY); clock_->SetNow(base::Time::FromDoubleT(kLaterTimeNowSeconds + 30)); EXPECT_CALL(*this, OnSyncFinishedProxy( CryptAuthDeviceManager::SyncResult::SUCCESS, @@ -714,7 +714,7 @@ TEST_F(CryptAuthDeviceManagerTest, SyncSameDevice) { auto original_devices = device_manager_->GetSyncedDevices(); // Sync new devices. - FireSchedulerForSync(cryptauth::INVOCATION_REASON_PERIODIC); + FireSchedulerForSync(INVOCATION_REASON_PERIODIC); ASSERT_FALSE(success_callback_.is_null()); EXPECT_CALL(*this, OnSyncFinishedProxy( @@ -722,14 +722,14 @@ TEST_F(CryptAuthDeviceManagerTest, SyncSameDevice) { CryptAuthDeviceManager::DeviceChangeResult::UNCHANGED)); // Sync the same device. - cryptauth::ExternalDeviceInfo synced_device; + ExternalDeviceInfo synced_device; synced_device.set_public_key(kStoredPublicKey); synced_device.set_friendly_device_name(kStoredDeviceName); synced_device.set_bluetooth_address(kStoredBluetoothAddress); synced_device.set_unlock_key(kStoredUnlockKey); synced_device.set_unlockable(kStoredUnlockable); synced_device.set_mobile_hotspot_supported(kStoredMobileHotspotSupported); - cryptauth::GetMyDevicesResponse get_my_devices_response; + GetMyDevicesResponse get_my_devices_response; get_my_devices_response.add_devices()->CopyFrom(synced_device); success_callback_.Run(get_my_devices_response); @@ -739,12 +739,12 @@ TEST_F(CryptAuthDeviceManagerTest, SyncSameDevice) { } TEST_F(CryptAuthDeviceManagerTest, SyncEmptyDeviceList) { - cryptauth::GetMyDevicesResponse empty_response; + GetMyDevicesResponse empty_response; device_manager_->Start(); EXPECT_EQ(1u, device_manager_->GetSyncedDevices().size()); - FireSchedulerForSync(cryptauth::INVOCATION_REASON_PERIODIC); + FireSchedulerForSync(INVOCATION_REASON_PERIODIC); ASSERT_FALSE(success_callback_.is_null()); EXPECT_CALL(*this, OnSyncFinishedProxy( CryptAuthDeviceManager::SyncResult::SUCCESS, @@ -752,21 +752,21 @@ TEST_F(CryptAuthDeviceManagerTest, SyncEmptyDeviceList) { success_callback_.Run(empty_response); ExpectSyncedDevicesAndPrefAreEqual( - std::vector(), + std::vector(), device_manager_->GetSyncedDevices(), pref_service_); } TEST_F(CryptAuthDeviceManagerTest, SyncThreeDevices) { - cryptauth::GetMyDevicesResponse response(get_my_devices_response_); - cryptauth::ExternalDeviceInfo synced_device2; + GetMyDevicesResponse response(get_my_devices_response_); + ExternalDeviceInfo synced_device2; synced_device2.set_public_key("new public key"); synced_device2.set_friendly_device_name("new device name"); synced_device2.set_bluetooth_address("aa:bb:cc:dd:ee:ff"); synced_device2.set_unlock_key(true); response.add_devices()->CopyFrom(synced_device2); - std::vector expected_devices; + std::vector expected_devices; expected_devices.push_back(devices_in_response_[0]); expected_devices.push_back(devices_in_response_[1]); expected_devices.push_back(synced_device2); @@ -776,7 +776,7 @@ TEST_F(CryptAuthDeviceManagerTest, SyncThreeDevices) { EXPECT_EQ(1u, pref_service_.GetList(prefs::kCryptAuthDeviceSyncUnlockKeys) ->GetSize()); - FireSchedulerForSync(cryptauth::INVOCATION_REASON_PERIODIC); + FireSchedulerForSync(INVOCATION_REASON_PERIODIC); ASSERT_FALSE(success_callback_.is_null()); EXPECT_CALL(*this, OnSyncFinishedProxy( CryptAuthDeviceManager::SyncResult::SUCCESS, @@ -793,7 +793,7 @@ TEST_F(CryptAuthDeviceManagerTest, SyncOnGCMPushMessage) { EXPECT_CALL(*sync_scheduler(), ForceSync()); gcm_manager_.PushResyncMessage(); - FireSchedulerForSync(cryptauth::INVOCATION_REASON_SERVER_INITIATED); + FireSchedulerForSync(INVOCATION_REASON_SERVER_INITIATED); EXPECT_CALL(*this, OnSyncFinishedProxy( CryptAuthDeviceManager::SyncResult::SUCCESS, @@ -811,7 +811,7 @@ TEST_F(CryptAuthDeviceManagerTest, SyncDeviceWithNoContents) { EXPECT_CALL(*sync_scheduler(), ForceSync()); gcm_manager_.PushResyncMessage(); - FireSchedulerForSync(cryptauth::INVOCATION_REASON_SERVER_INITIATED); + FireSchedulerForSync(INVOCATION_REASON_SERVER_INITIATED); EXPECT_CALL(*this, OnSyncFinishedProxy( CryptAuthDeviceManager::SyncResult::SUCCESS, @@ -824,12 +824,12 @@ TEST_F(CryptAuthDeviceManagerTest, SyncDeviceWithNoContents) { } TEST_F(CryptAuthDeviceManagerTest, SyncFullyDetailedExternalDeviceInfos) { - cryptauth::GetMyDevicesResponse response; + GetMyDevicesResponse response; // First, use a device with only a public key (a public key is the only // required field). This ensures devices work properly when they do not have // all fields filled out. - cryptauth::ExternalDeviceInfo device_with_only_public_key; + ExternalDeviceInfo device_with_only_public_key; device_with_only_public_key.set_public_key("publicKey1"); // Currently, CryptAuthDeviceManager only stores devices which are unlock // keys, so set_unlock_key(true) must be called here for storage to work. @@ -840,7 +840,7 @@ TEST_F(CryptAuthDeviceManagerTest, SyncFullyDetailedExternalDeviceInfos) { // Second, use a device with all fields filled out. This ensures that all // device details are properly saved. - cryptauth::ExternalDeviceInfo device_with_all_fields; + ExternalDeviceInfo device_with_all_fields; device_with_all_fields.set_public_key("publicKey2"); device_with_all_fields.set_friendly_device_name("deviceName"); device_with_all_fields.set_bluetooth_address("aa:bb:cc:dd:ee:ff"); @@ -849,24 +849,24 @@ TEST_F(CryptAuthDeviceManagerTest, SyncFullyDetailedExternalDeviceInfos) { device_with_all_fields.set_last_update_time_millis(123456789L); device_with_all_fields.set_mobile_hotspot_supported(true); device_with_all_fields.set_device_type(DeviceType::ANDROIDOS); - cryptauth::BeaconSeed seed1; + BeaconSeed seed1; seed1.set_data(kBeaconSeed1Data); seed1.set_start_time_millis(kBeaconSeed1StartTime); seed1.set_end_time_millis(kBeaconSeed1EndTime); device_with_all_fields.add_beacon_seeds()->CopyFrom(seed1); - cryptauth::BeaconSeed seed2; + BeaconSeed seed2; seed2.set_data(kBeaconSeed2Data); seed2.set_start_time_millis(kBeaconSeed2StartTime); seed2.set_end_time_millis(kBeaconSeed2EndTime); device_with_all_fields.add_beacon_seeds()->CopyFrom(seed2); response.add_devices()->CopyFrom(device_with_all_fields); - std::vector expected_devices; + std::vector expected_devices; expected_devices.push_back(device_with_only_public_key); expected_devices.push_back(device_with_all_fields); device_manager_->Start(); - FireSchedulerForSync(cryptauth::INVOCATION_REASON_PERIODIC); + FireSchedulerForSync(INVOCATION_REASON_PERIODIC); ASSERT_FALSE(success_callback_.is_null()); EXPECT_CALL(*this, OnSyncFinishedProxy( CryptAuthDeviceManager::SyncResult::SUCCESS, @@ -880,7 +880,7 @@ TEST_F(CryptAuthDeviceManagerTest, SyncFullyDetailedExternalDeviceInfos) { TEST_F(CryptAuthDeviceManagerTest, SubsetsOfSyncedDevices) { device_manager_->Start(); - FireSchedulerForSync(cryptauth::INVOCATION_REASON_PERIODIC); + FireSchedulerForSync(INVOCATION_REASON_PERIODIC); ASSERT_FALSE(success_callback_.is_null()); EXPECT_CALL(*this, OnSyncFinishedProxy( @@ -896,12 +896,12 @@ TEST_F(CryptAuthDeviceManagerTest, SubsetsOfSyncedDevices) { // Only unlock keys. ExpectSyncedDevicesAreEqual( - std::vector(1, devices_in_response_[0]), + std::vector(1, devices_in_response_[0]), device_manager_->GetUnlockKeys()); // Only tether hosts. ExpectSyncedDevicesAreEqual( - std::vector(1, devices_in_response_[0]), + std::vector(1, devices_in_response_[0]), device_manager_->GetTetherHosts()); } diff --git a/components/cryptauth/cryptauth_enroller.h b/components/cryptauth/cryptauth_enroller.h index 7a9aee37c774d8..9a72d33a8df01d 100644 --- a/components/cryptauth/cryptauth_enroller.h +++ b/components/cryptauth/cryptauth_enroller.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_ENROLLER_H -#define COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_ENROLLER_H +#ifndef COMPONENTS_CRYPTAUTH_CRYPTAUTH_ENROLLER_H_ +#define COMPONENTS_CRYPTAUTH_CRYPTAUTH_ENROLLER_H_ #include #include @@ -29,8 +29,8 @@ class CryptAuthEnroller { typedef base::Callback EnrollmentFinishedCallback; virtual void Enroll(const std::string& user_public_key, const std::string& user_private_key, - const cryptauth::GcmDeviceInfo& device_info, - cryptauth::InvocationReason invocation_reason, + const GcmDeviceInfo& device_info, + InvocationReason invocation_reason, const EnrollmentFinishedCallback& callback) = 0; }; @@ -44,4 +44,4 @@ class CryptAuthEnrollerFactory { } // namespace cryptauth -#endif // COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_ENROLLER_H +#endif // COMPONENTS_CRYPTAUTH_CRYPTAUTH_ENROLLER_H_ diff --git a/components/cryptauth/cryptauth_enroller_impl.cc b/components/cryptauth/cryptauth_enroller_impl.cc index 3d9bcd5c75ba23..7ac514930f020a 100644 --- a/components/cryptauth/cryptauth_enroller_impl.cc +++ b/components/cryptauth/cryptauth_enroller_impl.cc @@ -28,7 +28,7 @@ const char kSupportedEnrollmentTypeGcmV1[] = "gcmV1"; const int kGCMMetadataVersion = 1; // Returns true if |device_info| contains the required fields for enrollment. -bool ValidateDeviceInfo(const cryptauth::GcmDeviceInfo& device_info) { +bool ValidateDeviceInfo(const GcmDeviceInfo& device_info) { if (!device_info.has_long_device_id()) { PA_LOG(ERROR) << "Expected long_device_id field in GcmDeviceInfo."; return false; @@ -45,9 +45,9 @@ bool ValidateDeviceInfo(const cryptauth::GcmDeviceInfo& device_info) { // Creates the public metadata to put in the SecureMessage that is sent to the // server with the FinishEnrollment request. std::string CreateEnrollmentPublicMetadata() { - cryptauth::GcmMetadata metadata; + GcmMetadata metadata; metadata.set_version(kGCMMetadataVersion); - metadata.set_type(cryptauth::MessageType::ENROLLMENT); + metadata.set_type(MessageType::ENROLLMENT); return metadata.SerializeAsString(); } @@ -66,8 +66,8 @@ CryptAuthEnrollerImpl::~CryptAuthEnrollerImpl() { void CryptAuthEnrollerImpl::Enroll( const std::string& user_public_key, const std::string& user_private_key, - const cryptauth::GcmDeviceInfo& device_info, - cryptauth::InvocationReason invocation_reason, + const GcmDeviceInfo& device_info, + InvocationReason invocation_reason, const EnrollmentFinishedCallback& callback) { if (!callback_.is_null()) { PA_LOG(ERROR) << "Enroll() already called. Do not reuse."; @@ -98,7 +98,7 @@ void CryptAuthEnrollerImpl::OnKeyPairGenerated(const std::string& public_key, session_private_key_ = private_key; cryptauth_client_ = client_factory_->CreateInstance(); - cryptauth::SetupEnrollmentRequest request; + SetupEnrollmentRequest request; request.add_types(kSupportedEnrollmentTypeGcmV1); request.set_invocation_reason(invocation_reason_); cryptauth_client_->SetupEnrollment( @@ -109,7 +109,7 @@ void CryptAuthEnrollerImpl::OnKeyPairGenerated(const std::string& public_key, } void CryptAuthEnrollerImpl::OnSetupEnrollmentSuccess( - const cryptauth::SetupEnrollmentResponse& response) { + const SetupEnrollmentResponse& response) { if (response.status() != kResponseStatusOk) { PA_LOG(WARNING) << "Unexpected status for SetupEnrollment: " << response.status(); @@ -195,7 +195,7 @@ void CryptAuthEnrollerImpl::OnOuterSecureMessageCreated( const std::string& outer_message) { PA_LOG(INFO) << "SecureMessage created, calling FinishEnrollment API."; - cryptauth::FinishEnrollmentRequest request; + FinishEnrollmentRequest request; request.set_enrollment_session_id(setup_info_.enrollment_session_id()); request.set_enrollment_message(outer_message); request.set_device_ephemeral_key(session_public_key_); @@ -210,7 +210,7 @@ void CryptAuthEnrollerImpl::OnOuterSecureMessageCreated( } void CryptAuthEnrollerImpl::OnFinishEnrollmentSuccess( - const cryptauth::FinishEnrollmentResponse& response) { + const FinishEnrollmentResponse& response) { if (response.status() != kResponseStatusOk) { PA_LOG(WARNING) << "Unexpected status for FinishEnrollment: " << response.status(); diff --git a/components/cryptauth/cryptauth_enroller_impl.h b/components/cryptauth/cryptauth_enroller_impl.h index 976e56ff7b2279..c4cca8ea0a916f 100644 --- a/components/cryptauth/cryptauth_enroller_impl.h +++ b/components/cryptauth/cryptauth_enroller_impl.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_ENROLLER_IMPL_H -#define COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_ENROLLER_IMPL_H +#ifndef COMPONENTS_CRYPTAUTH_CRYPTAUTH_ENROLLER_IMPL_H_ +#define COMPONENTS_CRYPTAUTH_CRYPTAUTH_ENROLLER_IMPL_H_ #include @@ -39,19 +39,19 @@ class CryptAuthEnrollerImpl : public CryptAuthEnroller { // CryptAuthEnroller: void Enroll(const std::string& user_public_key, const std::string& user_private_key, - const cryptauth::GcmDeviceInfo& device_info, - cryptauth::InvocationReason invocation_reason, + const GcmDeviceInfo& device_info, + InvocationReason invocation_reason, const EnrollmentFinishedCallback& callback) override; private: // Callbacks for SetupEnrollment. void OnSetupEnrollmentSuccess( - const cryptauth::SetupEnrollmentResponse& response); + const SetupEnrollmentResponse& response); void OnSetupEnrollmentFailure(const std::string& error); // Callbacks for FinishEnrollment. void OnFinishEnrollmentSuccess( - const cryptauth::FinishEnrollmentResponse& response); + const FinishEnrollmentResponse& response); void OnFinishEnrollmentFailure(const std::string& error); // Callbacks for SecureMessageDelegate operations. @@ -79,13 +79,13 @@ class CryptAuthEnrollerImpl : public CryptAuthEnroller { std::string user_private_key_; // Contains information of the device to enroll. - cryptauth::GcmDeviceInfo device_info_; + GcmDeviceInfo device_info_; // The reason telling the server why the enrollment happened. - cryptauth::InvocationReason invocation_reason_; + InvocationReason invocation_reason_; // The setup information returned from the SetupEnrollment API call. - cryptauth::SetupEnrollmentInfo setup_info_; + SetupEnrollmentInfo setup_info_; // Callback invoked when the enrollment is done. EnrollmentFinishedCallback callback_; @@ -100,4 +100,4 @@ class CryptAuthEnrollerImpl : public CryptAuthEnroller { } // namespace cryptauth -#endif // COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_ENROLLER_IMPL_H +#endif // COMPONENTS_CRYPTAUTH_CRYPTAUTH_ENROLLER_IMPL_H_ diff --git a/components/cryptauth/cryptauth_enroller_impl_unittest.cc b/components/cryptauth/cryptauth_enroller_impl_unittest.cc index 5e65fc4f3828af..503b49381bcf4a 100644 --- a/components/cryptauth/cryptauth_enroller_impl_unittest.cc +++ b/components/cryptauth/cryptauth_enroller_impl_unittest.cc @@ -24,8 +24,8 @@ const char kAccessTokenUsed[] = "access token used by CryptAuthClient"; const char kClientSessionPublicKey[] = "throw away after one use"; const char kServerSessionPublicKey[] = "disposables are not eco-friendly"; -cryptauth::InvocationReason kInvocationReason = - cryptauth::INVOCATION_REASON_MANUAL; +InvocationReason kInvocationReason = + INVOCATION_REASON_MANUAL; const int kGCMMetadataVersion = 1; const char kSupportedEnrollmentTypeGcmV1[] = "gcmV1"; const char kResponseStatusOk[] = "ok"; @@ -34,12 +34,12 @@ const char kEnrollmentSessionId[] = "0123456789876543210"; const char kFinishEnrollmentError[] = "A hungry router ate all your packets."; const char kDeviceId[] = "2015 AD"; -const cryptauth::DeviceType kDeviceType = cryptauth::CHROME; +const DeviceType kDeviceType = CHROME; const char kDeviceOsVersion[] = "41.0.0"; // Creates and returns the GcmDeviceInfo message to be uploaded. -cryptauth::GcmDeviceInfo GetDeviceInfo() { - cryptauth::GcmDeviceInfo device_info; +GcmDeviceInfo GetDeviceInfo() { + GcmDeviceInfo device_info; device_info.set_long_device_id(kDeviceId); device_info.set_device_type(kDeviceType); device_info.set_device_os_version(kDeviceOsVersion); @@ -49,15 +49,15 @@ cryptauth::GcmDeviceInfo GetDeviceInfo() { // Creates and returns the SetupEnrollmentResponse message to be returned to the // enroller with the session_. If |success| is false, then a bad response will // be returned. -cryptauth::SetupEnrollmentResponse GetSetupEnrollmentResponse(bool success) { - cryptauth::SetupEnrollmentResponse response; +SetupEnrollmentResponse GetSetupEnrollmentResponse(bool success) { + SetupEnrollmentResponse response; if (!success) { response.set_status(kResponseStatusNotOk); return response; } response.set_status(kResponseStatusOk); - cryptauth::SetupEnrollmentInfo* info = response.add_infos(); + SetupEnrollmentInfo* info = response.add_infos(); info->set_type(kSupportedEnrollmentTypeGcmV1); info->set_enrollment_session_id(kEnrollmentSessionId); info->set_server_ephemeral_key(kServerSessionPublicKey); @@ -67,8 +67,8 @@ cryptauth::SetupEnrollmentResponse GetSetupEnrollmentResponse(bool success) { // Creates and returns the FinishEnrollmentResponse message to be returned to // the enroller with the session_. If |success| is false, then a bad response // will be returned. -cryptauth::FinishEnrollmentResponse GetFinishEnrollmentResponse(bool success) { - cryptauth::FinishEnrollmentResponse response; +FinishEnrollmentResponse GetFinishEnrollmentResponse(bool success) { + FinishEnrollmentResponse response; if (success) { response.set_status(kResponseStatusOk); } else { @@ -117,7 +117,7 @@ class CryptAuthEnrollerTest } // Starts the enroller. - void StartEnroller(const cryptauth::GcmDeviceInfo& device_info) { + void StartEnroller(const GcmDeviceInfo& device_info) { secure_message_delegate_->set_next_public_key(kClientSessionPublicKey); enroller_result_.reset(); enroller_.Enroll( @@ -152,10 +152,10 @@ class CryptAuthEnrollerTest base::Bind(&SaveUnwrapResults, &verified, &inner_message, &header)); EXPECT_TRUE(verified); - cryptauth::GcmMetadata metadata; + GcmMetadata metadata; ASSERT_TRUE(metadata.ParseFromString(header.public_metadata())); EXPECT_EQ(kGCMMetadataVersion, metadata.version()); - EXPECT_EQ(cryptauth::MessageType::ENROLLMENT, metadata.type()); + EXPECT_EQ(MessageType::ENROLLMENT, metadata.type()); } { @@ -173,7 +173,7 @@ class CryptAuthEnrollerTest } // Check that the decrypted GcmDeviceInfo is correct. - cryptauth::GcmDeviceInfo device_info; + GcmDeviceInfo device_info; ASSERT_TRUE(device_info.ParseFromString(inner_payload)); EXPECT_EQ(kDeviceId, device_info.long_device_id()); EXPECT_EQ(kDeviceType, device_info.device_type()); @@ -210,7 +210,7 @@ class CryptAuthEnrollerTest } void OnSetupEnrollment( - const cryptauth::SetupEnrollmentRequest& request, + const SetupEnrollmentRequest& request, const CryptAuthClient::SetupEnrollmentCallback& callback, const CryptAuthClient::ErrorCallback& error_callback) { // Check that SetupEnrollment is called before FinishEnrollment. @@ -219,13 +219,13 @@ class CryptAuthEnrollerTest EXPECT_TRUE(setup_callback_.is_null()); EXPECT_TRUE(error_callback_.is_null()); - setup_request_.reset(new cryptauth::SetupEnrollmentRequest(request)); + setup_request_.reset(new SetupEnrollmentRequest(request)); setup_callback_ = callback; error_callback_ = error_callback; } void OnFinishEnrollment( - const cryptauth::FinishEnrollmentRequest& request, + const FinishEnrollmentRequest& request, const CryptAuthClient::FinishEnrollmentCallback& callback, const CryptAuthClient::ErrorCallback& error_callback) { // Check that FinishEnrollment is called after SetupEnrollment. @@ -233,7 +233,7 @@ class CryptAuthEnrollerTest EXPECT_FALSE(finish_request_.get()); EXPECT_TRUE(finish_callback_.is_null()); - finish_request_.reset(new cryptauth::FinishEnrollmentRequest(request)); + finish_request_.reset(new FinishEnrollmentRequest(request)); finish_callback_ = callback; error_callback_ = error_callback; } @@ -253,8 +253,8 @@ class CryptAuthEnrollerTest std::unique_ptr enroller_result_; // Stored callbacks and requests for SetupEnrollment and FinishEnrollment. - std::unique_ptr setup_request_; - std::unique_ptr finish_request_; + std::unique_ptr setup_request_; + std::unique_ptr finish_request_; CryptAuthClient::SetupEnrollmentCallback setup_callback_; CryptAuthClient::FinishEnrollmentCallback finish_callback_; CryptAuthClient::ErrorCallback error_callback_; @@ -313,7 +313,7 @@ TEST_F(CryptAuthEnrollerTest, SetupEnrollmentBadStatus) { TEST_F(CryptAuthEnrollerTest, SetupEnrollmentNoInfosReturned) { StartEnroller(GetDeviceInfo()); EXPECT_TRUE(setup_request_.get()); - cryptauth::SetupEnrollmentResponse response; + SetupEnrollmentResponse response; response.set_status(kResponseStatusOk); setup_callback_.Run(response); @@ -351,7 +351,7 @@ TEST_F(CryptAuthEnrollerTest, ReuseEnroller) { } TEST_F(CryptAuthEnrollerTest, IncompleteDeviceInfo) { - StartEnroller(cryptauth::GcmDeviceInfo()); + StartEnroller(GcmDeviceInfo()); ASSERT_TRUE(enroller_result_.get()); EXPECT_FALSE(*enroller_result_); } diff --git a/components/cryptauth/cryptauth_enrollment_manager.cc b/components/cryptauth/cryptauth_enrollment_manager.cc index 5a3befac04537e..8381de24ccf879 100644 --- a/components/cryptauth/cryptauth_enrollment_manager.cc +++ b/components/cryptauth/cryptauth_enrollment_manager.cc @@ -48,7 +48,7 @@ CryptAuthEnrollmentManager::CryptAuthEnrollmentManager( std::unique_ptr clock, std::unique_ptr enroller_factory, std::unique_ptr secure_message_delegate, - const cryptauth::GcmDeviceInfo& device_info, + const GcmDeviceInfo& device_info, CryptAuthGCMManager* gcm_manager, PrefService* pref_service) : clock_(std::move(clock)), @@ -70,7 +70,7 @@ void CryptAuthEnrollmentManager::RegisterPrefs(PrefRegistrySimple* registry) { registry->RegisterDoublePref( prefs::kCryptAuthEnrollmentLastEnrollmentTimeSeconds, 0.0); registry->RegisterIntegerPref(prefs::kCryptAuthEnrollmentReason, - cryptauth::INVOCATION_REASON_UNKNOWN); + INVOCATION_REASON_UNKNOWN); registry->RegisterStringPref(prefs::kCryptAuthEnrollmentUserPublicKey, std::string()); registry->RegisterStringPref(prefs::kCryptAuthEnrollmentUserPrivateKey, @@ -105,7 +105,7 @@ void CryptAuthEnrollmentManager::RemoveObserver(Observer* observer) { } void CryptAuthEnrollmentManager::ForceEnrollmentNow( - cryptauth::InvocationReason invocation_reason) { + InvocationReason invocation_reason) { // We store the invocation reason in a preference so that it can persist // across browser restarts. If the sync fails, the next retry should still use // this original reason instead of INVOCATION_REASON_FAILURE_RECOVERY. @@ -146,7 +146,7 @@ void CryptAuthEnrollmentManager::OnEnrollmentFinished(bool success) { prefs::kCryptAuthEnrollmentLastEnrollmentTimeSeconds, clock_->Now().ToDoubleT()); pref_service_->SetInteger(prefs::kCryptAuthEnrollmentReason, - cryptauth::INVOCATION_REASON_UNKNOWN); + INVOCATION_REASON_UNKNOWN); } pref_service_->SetBoolean(prefs::kCryptAuthEnrollmentIsRecoveringFromFailure, @@ -226,7 +226,7 @@ void CryptAuthEnrollmentManager::OnKeyPairGenerated( } void CryptAuthEnrollmentManager::OnReenrollMessage() { - ForceEnrollmentNow(cryptauth::INVOCATION_REASON_SERVER_INITIATED); + ForceEnrollmentNow(INVOCATION_REASON_SERVER_INITIATED); } void CryptAuthEnrollmentManager::OnSyncRequested( @@ -237,7 +237,7 @@ void CryptAuthEnrollmentManager::OnSyncRequested( sync_request_ = std::move(sync_request); if (gcm_manager_->GetRegistrationId().empty() || pref_service_->GetInteger(prefs::kCryptAuthEnrollmentReason) == - cryptauth::INVOCATION_REASON_MANUAL) { + INVOCATION_REASON_MANUAL) { gcm_manager_->RegisterWithGCM(); } else { DoCryptAuthEnrollment(); @@ -256,31 +256,31 @@ void CryptAuthEnrollmentManager::DoCryptAuthEnrollment() { void CryptAuthEnrollmentManager::DoCryptAuthEnrollmentWithKeys() { DCHECK(sync_request_); - cryptauth::InvocationReason invocation_reason = - cryptauth::INVOCATION_REASON_UNKNOWN; + InvocationReason invocation_reason = + INVOCATION_REASON_UNKNOWN; int reason_stored_in_prefs = pref_service_->GetInteger(prefs::kCryptAuthEnrollmentReason); - if (cryptauth::InvocationReason_IsValid(reason_stored_in_prefs) && - reason_stored_in_prefs != cryptauth::INVOCATION_REASON_UNKNOWN) { + if (InvocationReason_IsValid(reason_stored_in_prefs) && + reason_stored_in_prefs != INVOCATION_REASON_UNKNOWN) { invocation_reason = - static_cast(reason_stored_in_prefs); + static_cast(reason_stored_in_prefs); } else if (GetLastEnrollmentTime().is_null()) { - invocation_reason = cryptauth::INVOCATION_REASON_INITIALIZATION; + invocation_reason = INVOCATION_REASON_INITIALIZATION; } else if (!IsEnrollmentValid()) { - invocation_reason = cryptauth::INVOCATION_REASON_EXPIRATION; + invocation_reason = INVOCATION_REASON_EXPIRATION; } else if (scheduler_->GetStrategy() == SyncScheduler::Strategy::PERIODIC_REFRESH) { - invocation_reason = cryptauth::INVOCATION_REASON_PERIODIC; + invocation_reason = INVOCATION_REASON_PERIODIC; } else if (scheduler_->GetStrategy() == SyncScheduler::Strategy::AGGRESSIVE_RECOVERY) { - invocation_reason = cryptauth::INVOCATION_REASON_FAILURE_RECOVERY; + invocation_reason = INVOCATION_REASON_FAILURE_RECOVERY; } // Fill in the current GCM registration id before enrolling, and explicitly // make sure that the software package is the same as the GCM app id. - cryptauth::GcmDeviceInfo device_info(device_info_); + GcmDeviceInfo device_info(device_info_); device_info.set_gcm_registration_id(gcm_manager_->GetRegistrationId()); device_info.set_device_software_package(kDeviceSoftwarePackage); diff --git a/components/cryptauth/cryptauth_enrollment_manager.h b/components/cryptauth/cryptauth_enrollment_manager.h index 55dca06b107521..e621b9f5b4e183 100644 --- a/components/cryptauth/cryptauth_enrollment_manager.h +++ b/components/cryptauth/cryptauth_enrollment_manager.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_CRYPTAUTH_ENROLLMENT_MANAGER_H -#define COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_CRYPTAUTH_ENROLLMENT_MANAGER_H +#ifndef COMPONENTS_CRYPTAUTH_CRYPTAUTH_ENROLLMENT_MANAGER_H_ +#define COMPONENTS_CRYPTAUTH_CRYPTAUTH_ENROLLMENT_MANAGER_H_ #include @@ -65,7 +65,7 @@ class CryptAuthEnrollmentManager : public SyncScheduler::Delegate, std::unique_ptr clock, std::unique_ptr enroller_factory, std::unique_ptr secure_message_delegate, - const cryptauth::GcmDeviceInfo& device_info, + const GcmDeviceInfo& device_info, CryptAuthGCMManager* gcm_manager, PrefService* pref_service); @@ -87,7 +87,7 @@ class CryptAuthEnrollmentManager : public SyncScheduler::Delegate, // enrollment is already in progress, this function does nothing. // |invocation_reason| specifies the reason that the enrollment was triggered, // which is upload to the server. - void ForceEnrollmentNow(cryptauth::InvocationReason invocation_reason); + void ForceEnrollmentNow(InvocationReason invocation_reason); // Returns true if a successful enrollment has been recorded and this // enrollment has not expired. @@ -154,7 +154,7 @@ class CryptAuthEnrollmentManager : public SyncScheduler::Delegate, std::unique_ptr secure_message_delegate_; // The local device information to upload to CryptAuth. - const cryptauth::GcmDeviceInfo device_info_; + const GcmDeviceInfo device_info_; // Used to perform GCM registrations and also notifies when GCM push messages // trigger re-enrollments. Not owned and must outlive this instance. @@ -186,4 +186,4 @@ class CryptAuthEnrollmentManager : public SyncScheduler::Delegate, } // namespace cryptauth -#endif // COMPONENTS_PROXIMITY_CRYPTAUTH_CRYPTAUTH_ENROLLMENT_MANAGER_H +#endif // COMPONENTS_CRYPTAUTH_CRYPTAUTH_ENROLLMENT_MANAGER_H_ diff --git a/components/cryptauth/cryptauth_enrollment_manager_unittest.cc b/components/cryptauth/cryptauth_enrollment_manager_unittest.cc index 8c6a4664427026..01f9781a9e8359 100644 --- a/components/cryptauth/cryptauth_enrollment_manager_unittest.cc +++ b/components/cryptauth/cryptauth_enrollment_manager_unittest.cc @@ -60,8 +60,8 @@ class MockCryptAuthEnroller : public CryptAuthEnroller { MOCK_METHOD5(Enroll, void(const std::string& user_public_key, const std::string& user_private_key, - const cryptauth::GcmDeviceInfo& device_info, - cryptauth::InvocationReason invocation_reason, + const GcmDeviceInfo& device_info, + InvocationReason invocation_reason, const EnrollmentFinishedCallback& callback)); private: @@ -102,7 +102,7 @@ class TestCryptAuthEnrollmentManager : public CryptAuthEnrollmentManager { std::unique_ptr clock, std::unique_ptr enroller_factory, std::unique_ptr secure_message_delegate, - const cryptauth::GcmDeviceInfo& device_info, + const GcmDeviceInfo& device_info, CryptAuthGCMManager* gcm_manager, PrefService* pref_service) : CryptAuthEnrollmentManager(std::move(clock), @@ -176,7 +176,7 @@ class CryptAuthEnrollmentManagerTest new base::FundamentalValue(kLastEnrollmentTimeSeconds)); pref_service_.SetUserPref( prefs::kCryptAuthEnrollmentReason, - new base::FundamentalValue(cryptauth::INVOCATION_REASON_UNKNOWN)); + new base::FundamentalValue(INVOCATION_REASON_UNKNOWN)); std::string public_key_b64, private_key_b64; base::Base64UrlEncode(public_key_, @@ -214,7 +214,7 @@ class CryptAuthEnrollmentManagerTest // Simulates firing the SyncScheduler to trigger an enrollment attempt. CryptAuthEnroller::EnrollmentFinishedCallback FireSchedulerForEnrollment( - cryptauth::InvocationReason expected_invocation_reason) { + InvocationReason expected_invocation_reason) { CryptAuthEnroller::EnrollmentFinishedCallback completion_callback; EXPECT_CALL( *next_cryptauth_enroller(), @@ -253,7 +253,7 @@ class CryptAuthEnrollmentManagerTest // Ownered by |enrollment_manager_|. FakeSecureMessageDelegate* secure_message_delegate_; - cryptauth::GcmDeviceInfo device_info_; + GcmDeviceInfo device_info_; TestingPrefServiceSimple pref_service_; @@ -354,10 +354,10 @@ TEST_F(CryptAuthEnrollmentManagerTest, ForceEnrollment) { EXPECT_CALL(*sync_scheduler(), ForceSync()); enrollment_manager_.ForceEnrollmentNow( - cryptauth::INVOCATION_REASON_SERVER_INITIATED); + INVOCATION_REASON_SERVER_INITIATED); auto completion_callback = - FireSchedulerForEnrollment(cryptauth::INVOCATION_REASON_SERVER_INITIATED); + FireSchedulerForEnrollment(INVOCATION_REASON_SERVER_INITIATED); clock_->SetNow(base::Time::FromDoubleT(kLaterTimeNow)); EXPECT_CALL(*this, OnEnrollmentFinishedProxy(true)); @@ -374,7 +374,7 @@ TEST_F(CryptAuthEnrollmentManagerTest, ON_CALL(*sync_scheduler(), GetStrategy()) .WillByDefault(Return(SyncScheduler::Strategy::PERIODIC_REFRESH)); auto completion_callback = - FireSchedulerForEnrollment(cryptauth::INVOCATION_REASON_PERIODIC); + FireSchedulerForEnrollment(INVOCATION_REASON_PERIODIC); clock_->SetNow(base::Time::FromDoubleT(kLaterTimeNow)); EXPECT_CALL(*this, OnEnrollmentFinishedProxy(false)); completion_callback.Run(false); @@ -386,7 +386,7 @@ TEST_F(CryptAuthEnrollmentManagerTest, ON_CALL(*sync_scheduler(), GetStrategy()) .WillByDefault(Return(SyncScheduler::Strategy::AGGRESSIVE_RECOVERY)); completion_callback = - FireSchedulerForEnrollment(cryptauth::INVOCATION_REASON_FAILURE_RECOVERY); + FireSchedulerForEnrollment(INVOCATION_REASON_FAILURE_RECOVERY); clock_->SetNow(base::Time::FromDoubleT(kLaterTimeNow + 30)); EXPECT_CALL(*this, OnEnrollmentFinishedProxy(true)); completion_callback.Run(true); @@ -418,7 +418,7 @@ TEST_F(CryptAuthEnrollmentManagerTest, CryptAuthEnroller::EnrollmentFinishedCallback enrollment_callback; EXPECT_CALL(*next_cryptauth_enroller(), Enroll(public_key_, private_key_, _, - cryptauth::INVOCATION_REASON_INITIALIZATION, _)) + INVOCATION_REASON_INITIALIZATION, _)) .WillOnce(SaveArg<4>(&enrollment_callback)); ASSERT_TRUE(gcm_manager_.registration_in_progress()); gcm_manager_.CompleteRegistration(kGCMRegistrationId); @@ -461,7 +461,7 @@ TEST_F(CryptAuthEnrollmentManagerTest, ReenrollOnGCMPushMessage) { // Simulate receiving a GCM push message, forcing the device to re-enroll. gcm_manager_.PushReenrollMessage(); auto completion_callback = - FireSchedulerForEnrollment(cryptauth::INVOCATION_REASON_SERVER_INITIATED); + FireSchedulerForEnrollment(INVOCATION_REASON_SERVER_INITIATED); EXPECT_CALL(*this, OnEnrollmentFinishedProxy(true)); completion_callback.Run(true); diff --git a/components/cryptauth/cryptauth_enrollment_utils.h b/components/cryptauth/cryptauth_enrollment_utils.h index 32bd6f364b5608..375eee3b3d8468 100644 --- a/components/cryptauth/cryptauth_enrollment_utils.h +++ b/components/cryptauth/cryptauth_enrollment_utils.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_PROXIMITY_AUTH_CRYPT_AUTH_ENROLLMENT_UTILS_H -#define COMPONENTS_PROXIMITY_AUTH_CRYPT_AUTH_ENROLLMENT_UTILS_H +#ifndef COMPONENTS_CRYPTAUTH_CRYPTAUTH_ENROLLMENT_UTILS_H +#define COMPONENTS_CRYPTAUTH_CRYPTAUTH_ENROLLMENT_UTILS_H #include #include @@ -20,4 +20,4 @@ int64_t HashStringToInt64(const std::string& string); } // namespace cryptauth -#endif // COMPONENTS_PROXIMITY_AUTH_CRYPT_AUTH_ENROLLMENT_UTILS_H +#endif // COMPONENTS_CRYPTAUTH_CRYPTAUTH_ENROLLMENT_UTILS_H diff --git a/components/cryptauth/cryptauth_gcm_manager.h b/components/cryptauth/cryptauth_gcm_manager.h index 11a52c147d8b68..5be472da73f3b6 100644 --- a/components/cryptauth/cryptauth_gcm_manager.h +++ b/components/cryptauth/cryptauth_gcm_manager.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_CRYPTAUTH_GCM_MANAGER_H -#define COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_CRYPTAUTH_GCM_MANAGER_H +#ifndef COMPONENTS_CRYPTAUTH_CRYPTAUTH_GCM_MANAGER_H_ +#define COMPONENTS_CRYPTAUTH_CRYPTAUTH_GCM_MANAGER_H_ #include @@ -61,4 +61,4 @@ class CryptAuthGCMManager { } // namespace cryptauth -#endif // COMPONENTS_PROXIMITY_CRYPTAUTH_CRYPTAUTH_GCM_MANAGER_H +#endif // COMPONENTS_CRYPTAUTH_CRYPTAUTH_GCM_MANAGER_H_ diff --git a/components/cryptauth/cryptauth_gcm_manager_impl.h b/components/cryptauth/cryptauth_gcm_manager_impl.h index 412fa5a6c0065d..28c64db8e36ba6 100644 --- a/components/cryptauth/cryptauth_gcm_manager_impl.h +++ b/components/cryptauth/cryptauth_gcm_manager_impl.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_CRYPTAUTH_GCM_MANAGER_IMPL_H -#define COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_CRYPTAUTH_GCM_MANAGER_IMPL_H +#ifndef COMPONENTS_CRYPTAUTH_CRYPTAUTH_GCM_MANAGER_IMPL_H_ +#define COMPONENTS_CRYPTAUTH_CRYPTAUTH_GCM_MANAGER_IMPL_H_ #include "base/macros.h" #include "base/memory/weak_ptr.h" @@ -78,4 +78,4 @@ class CryptAuthGCMManagerImpl : public CryptAuthGCMManager, } // namespace cryptauth -#endif // COMPONENTS_PROXIMITY_CRYPTAUTH_CRYPTAUTH_GCM_MANAGER_IMPL_H +#endif // COMPONENTS_CRYPTAUTH_CRYPTAUTH_GCM_MANAGER_IMPL_H_ diff --git a/components/cryptauth/cryptauth_test_util.h b/components/cryptauth/cryptauth_test_util.h index 32a0d038d9be20..6712f42db06ce9 100644 --- a/components/cryptauth/cryptauth_test_util.h +++ b/components/cryptauth/cryptauth_test_util.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_CRYPTAUTH_CRYPTAUTH_TEST_UTIL_H -#define COMPONENTS_CRYPTAUTH_CRYPTAUTH_TEST_UTIL_H +#ifndef COMPONENTS_CRYPTAUTH_CRYPTAUTH_TEST_UTIL_H_ +#define COMPONENTS_CRYPTAUTH_CRYPTAUTH_TEST_UTIL_H_ #include "components/cryptauth/remote_device.h" @@ -36,4 +36,4 @@ inline RemoteDevice CreateClassicRemoteDeviceForTest() { } // namespace cryptauth -#endif // COMPONENTS_CRYPTAUTH_CRYPTAUTH_TEST_UTIL_H +#endif // COMPONENTS_CRYPTAUTH_CRYPTAUTH_TEST_UTIL_H_ diff --git a/components/cryptauth/eid_generator.h b/components/cryptauth/eid_generator.h index e5e123392886bc..3fd706186f472c 100644 --- a/components/cryptauth/eid_generator.h +++ b/components/cryptauth/eid_generator.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_CRYPTAUTH_BLE_EID_GENERATOR_H -#define COMPONENTS_CRYPTAUTH_BLE_EID_GENERATOR_H +#ifndef COMPONENTS_CRYPTAUTH_BLE_EID_GENERATOR_H_ +#define COMPONENTS_CRYPTAUTH_BLE_EID_GENERATOR_H_ #include #include @@ -233,4 +233,4 @@ class EidGenerator { }; } -#endif // COMPONENTS_CRYPTAUTH_BLE_EID_GENERATOR_H +#endif // COMPONENTS_CRYPTAUTH_BLE_EID_GENERATOR_H_ diff --git a/components/cryptauth/fake_connection.cc b/components/cryptauth/fake_connection.cc index c5008fce947c68..ce11c643bc8615 100644 --- a/components/cryptauth/fake_connection.cc +++ b/components/cryptauth/fake_connection.cc @@ -15,7 +15,7 @@ namespace { const char kFakeFeatureName[] = "fakeFeature"; } // namespace -FakeConnection::FakeConnection(const cryptauth::RemoteDevice& remote_device) +FakeConnection::FakeConnection(const RemoteDevice& remote_device) : Connection(remote_device) { Connect(); } diff --git a/components/cryptauth/fake_connection.h b/components/cryptauth/fake_connection.h index 0f8867e5a85392..9cb804fff5b621 100644 --- a/components/cryptauth/fake_connection.h +++ b/components/cryptauth/fake_connection.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_CRYPTAUTH_FAKE_CONNECTION_H -#define COMPONENTS_CRYPTAUTH_FAKE_CONNECTION_H +#ifndef COMPONENTS_CRYPTAUTH_FAKE_CONNECTION_H_ +#define COMPONENTS_CRYPTAUTH_FAKE_CONNECTION_H_ #include "base/macros.h" #include "components/cryptauth/connection.h" @@ -13,7 +13,7 @@ namespace cryptauth { // A fake implementation of Connection to use in tests. class FakeConnection : public Connection { public: - FakeConnection(const cryptauth::RemoteDevice& remote_device); + FakeConnection(const RemoteDevice& remote_device); ~FakeConnection() override; // Connection: @@ -51,4 +51,4 @@ class FakeConnection : public Connection { } // namespace cryptauth -#endif // COMPONENTS_CRYPTAUTH_FAKE_CONNECTION_H +#endif // COMPONENTS_CRYPTAUTH_FAKE_CONNECTION_H_ diff --git a/components/cryptauth/fake_cryptauth_gcm_manager.h b/components/cryptauth/fake_cryptauth_gcm_manager.h index db07235c024f8d..40607afefb6d9c 100644 --- a/components/cryptauth/fake_cryptauth_gcm_manager.h +++ b/components/cryptauth/fake_cryptauth_gcm_manager.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_PROXIMITY_AUTH_FAKE_CRYPTAUTH_FAKE_CRYPTAUTH_GCM_MANAGER_H -#define COMPONENTS_PROXIMITY_AUTH_FAKE_CRYPTAUTH_FAKE_CRYPTAUTH_GCM_MANAGER_H +#ifndef COMPONENTS_CRYPTAUTH_FAKE_CRYPTAUTH_GCM_MANAGER_H_ +#define COMPONENTS_CRYPTAUTH_FAKE_CRYPTAUTH_GCM_MANAGER_H_ #include "base/macros.h" #include "base/observer_list.h" @@ -61,4 +61,4 @@ class FakeCryptAuthGCMManager : public CryptAuthGCMManager { } // namespace cryptauth -#endif // COMPONENTS_PROXIMITY_FAKE_CRYPTAUTH_FAKE_CRYPTAUTH_GCM_MANAGER_H +#endif // COMPONENTS_CRYPTAUTH_FAKE_CRYPTAUTH_GCM_MANAGER_H_ diff --git a/components/cryptauth/fake_secure_message_delegate.h b/components/cryptauth/fake_secure_message_delegate.h index 2f91b3bb7d6276..5bc5bbedf687de 100644 --- a/components/cryptauth/fake_secure_message_delegate.h +++ b/components/cryptauth/fake_secure_message_delegate.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_PROXIMITY_AUTH_FAKE_SECURE_MESSAGE_DELEGATE_H -#define COMPONENTS_PROXIMITY_AUTH_FAKE_SECURE_MESSAGE_DELEGATE_H +#ifndef COMPONENTS_CRYPTAUTH_FAKE_SECURE_MESSAGE_DELEGATE_H_ +#define COMPONENTS_CRYPTAUTH_FAKE_SECURE_MESSAGE_DELEGATE_H_ #include "base/macros.h" #include "components/cryptauth/secure_message_delegate.h" @@ -51,4 +51,4 @@ class FakeSecureMessageDelegate : public SecureMessageDelegate { } // namespace cryptauth -#endif // COMPONENTS_PROXIMITY_AUTH_FAKE_SECURE_MESSAGE_DELEGATE_H +#endif // COMPONENTS_CRYPTAUTH_FAKE_SECURE_MESSAGE_DELEGATE_H_ diff --git a/components/cryptauth/mock_cryptauth_client.h b/components/cryptauth/mock_cryptauth_client.h index f9eeb2791b7bd1..ddc40e90537128 100644 --- a/components/cryptauth/mock_cryptauth_client.h +++ b/components/cryptauth/mock_cryptauth_client.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_PROXIMITY_AUTH_MOCK_CRYPTAUTH_CLIENT_H -#define COMPONENTS_PROXIMITY_AUTH_MOCK_CRYPTAUTH_CLIENT_H +#ifndef COMPONENTS_CRYPTAUTH_MOCK_CRYPTAUTH_CLIENT_H_ +#define COMPONENTS_CRYPTAUTH_MOCK_CRYPTAUTH_CLIENT_H_ #include "base/macros.h" #include "base/observer_list.h" @@ -20,27 +20,27 @@ class MockCryptAuthClient : public CryptAuthClient { // CryptAuthClient: MOCK_METHOD3(GetMyDevices, - void(const cryptauth::GetMyDevicesRequest& request, + void(const GetMyDevicesRequest& request, const GetMyDevicesCallback& callback, const ErrorCallback& error_callback)); MOCK_METHOD3(FindEligibleUnlockDevices, - void(const cryptauth::FindEligibleUnlockDevicesRequest& request, + void(const FindEligibleUnlockDevicesRequest& request, const FindEligibleUnlockDevicesCallback& callback, const ErrorCallback& error_callback)); MOCK_METHOD3(SendDeviceSyncTickle, - void(const cryptauth::SendDeviceSyncTickleRequest& request, + void(const SendDeviceSyncTickleRequest& request, const SendDeviceSyncTickleCallback& callback, const ErrorCallback& error_callback)); MOCK_METHOD3(ToggleEasyUnlock, - void(const cryptauth::ToggleEasyUnlockRequest& request, + void(const ToggleEasyUnlockRequest& request, const ToggleEasyUnlockCallback& callback, const ErrorCallback& error_callback)); MOCK_METHOD3(SetupEnrollment, - void(const cryptauth::SetupEnrollmentRequest& request, + void(const SetupEnrollmentRequest& request, const SetupEnrollmentCallback& callback, const ErrorCallback& error_callback)); MOCK_METHOD3(FinishEnrollment, - void(const cryptauth::FinishEnrollmentRequest& request, + void(const FinishEnrollmentRequest& request, const FinishEnrollmentCallback& callback, const ErrorCallback& error_callback)); MOCK_METHOD0(GetAccessTokenUsed, std::string()); @@ -85,4 +85,4 @@ class MockCryptAuthClientFactory : public CryptAuthClientFactory { } // namespace cryptauth -#endif // COMPONENTS_PROXIMITY_AUTH_MOCK_CRYPTAUTH_CLIENT_H +#endif // COMPONENTS_CRYPTAUTH_MOCK_CRYPTAUTH_CLIENT_H_ diff --git a/components/cryptauth/mock_sync_scheduler.h b/components/cryptauth/mock_sync_scheduler.h index e0fdc67d89e83b..b3fd9b33cf54de 100644 --- a/components/cryptauth/mock_sync_scheduler.h +++ b/components/cryptauth/mock_sync_scheduler.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_MOCK_SYNC_SCHEDULER_H -#define COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_MOCK_SYNC_SCHEDULER_H +#ifndef COMPONENTS_CRYPTAUTH_MOCK_SYNC_SCHEDULER_H_ +#define COMPONENTS_CRYPTAUTH_MOCK_SYNC_SCHEDULER_H_ #include "base/macros.h" #include "components/cryptauth/sync_scheduler.h" @@ -33,4 +33,4 @@ class MockSyncScheduler : public SyncScheduler { } // namespace cryptauth -#endif // COMPONENTS_PROXIMITY_CRYPTAUTH_MOCK_SYNC_SCHEDULER_H +#endif // COMPONENTS_CRYPTAUTH_MOCK_SYNC_SCHEDULER_H_ diff --git a/components/cryptauth/pref_names.h b/components/cryptauth/pref_names.h index d4c3230de629f6..dfc3803fae01bd 100644 --- a/components/cryptauth/pref_names.h +++ b/components/cryptauth/pref_names.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_PREF_NAMES_H -#define COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_PREF_NAMES_H +#ifndef COMPONENTS_CRYPTAUTH_PREF_NAMES_H_ +#define COMPONENTS_CRYPTAUTH_PREF_NAMES_H_ namespace cryptauth { namespace prefs { @@ -22,4 +22,4 @@ extern const char kCryptAuthGCMRegistrationId[]; } // namespace prefs } // namespace cryptauth -#endif // COMPONENTS_PROXIMITY_CRYPTAUTH_PREF_NAMES_H +#endif // COMPONENTS_CRYPTAUTH_PREF_NAMES_H_ diff --git a/components/cryptauth/remote_device.h b/components/cryptauth/remote_device.h index 092237b78fa9bc..e6e7731ca388fa 100644 --- a/components/cryptauth/remote_device.h +++ b/components/cryptauth/remote_device.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_CRYPTAUTH_REMOTE_DEVICE_H -#define COMPONENTS_CRYPTAUTH_REMOTE_DEVICE_H +#ifndef COMPONENTS_CRYPTAUTH_REMOTE_DEVICE_H_ +#define COMPONENTS_CRYPTAUTH_REMOTE_DEVICE_H_ #include #include @@ -55,4 +55,4 @@ typedef std::vector RemoteDeviceList; } // namespace cryptauth -#endif // COMPONENTS_CRYPTAUTH_REMOTE_DEVICE_H +#endif // COMPONENTS_CRYPTAUTH_REMOTE_DEVICE_H_ diff --git a/components/cryptauth/remote_device_test_util.h b/components/cryptauth/remote_device_test_util.h index dad2954e9dda6b..f3af23409e4f38 100644 --- a/components/cryptauth/remote_device_test_util.h +++ b/components/cryptauth/remote_device_test_util.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_CRYPTAUTH_REMOTE_DEVICE_TEST_UTIL_H -#define COMPONENTS_CRYPTAUTH_REMOTE_DEVICE_TEST_UTIL_H +#ifndef COMPONENTS_CRYPTAUTH_REMOTE_DEVICE_TEST_UTIL_H_ +#define COMPONENTS_CRYPTAUTH_REMOTE_DEVICE_TEST_UTIL_H_ #include @@ -15,4 +15,4 @@ std::vector GenerateTestRemoteDevices(size_t num_to_create); } // namespace cryptauth -#endif // COMPONENTS_CRYPTAUTH_REMOTE_DEVICE_TEST_UTIL_H +#endif // COMPONENTS_CRYPTAUTH_REMOTE_DEVICE_TEST_UTIL_H_ diff --git a/components/cryptauth/secure_message_delegate.h b/components/cryptauth/secure_message_delegate.h index c2e0fee482fcb2..abd9ec73f77d53 100644 --- a/components/cryptauth/secure_message_delegate.h +++ b/components/cryptauth/secure_message_delegate.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_PROXIMITY_AUTH_SECURE_MESSAGE_DELEGATE_H -#define COMPONENTS_PROXIMITY_AUTH_SECURE_MESSAGE_DELEGATE_H +#ifndef COMPONENTS_PROXIMITY_AUTH_SECURE_MESSAGE_DELEGATE_H_ +#define COMPONENTS_PROXIMITY_AUTH_SECURE_MESSAGE_DELEGATE_H_ #include @@ -99,4 +99,4 @@ class SecureMessageDelegate { } // namespace cryptauth -#endif // COMPONENTS_PROXIMITY_AUTH_SECURE_MESSAGE_DELEGATE_H +#endif // COMPONENTS_PROXIMITY_AUTH_SECURE_MESSAGE_DELEGATE_H_ diff --git a/components/cryptauth/sync_scheduler.h b/components/cryptauth/sync_scheduler.h index ea240ba5ae93aa..df0fac8e26a1fe 100644 --- a/components/cryptauth/sync_scheduler.h +++ b/components/cryptauth/sync_scheduler.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_SYNC_SCHEDULER_H -#define COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_SYNC_SCHEDULER_H +#ifndef COMPONENTS_CRYPTAUTH_SYNC_SCHEDULER_H_ +#define COMPONENTS_CRYPTAUTH_SYNC_SCHEDULER_H_ #include @@ -95,4 +95,4 @@ class SyncScheduler { } // namespace cryptauth -#endif // COMPONENTS_PROXIMITY_CRYPTAUTH_SYNC_SCHEDULER_H +#endif // COMPONENTS_CRYPTAUTH_SYNC_SCHEDULER_H_ diff --git a/components/cryptauth/sync_scheduler_impl.h b/components/cryptauth/sync_scheduler_impl.h index 9f52140be765fc..3d61bb0015f1c9 100644 --- a/components/cryptauth/sync_scheduler_impl.h +++ b/components/cryptauth/sync_scheduler_impl.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_CRYPTAUTH_SYNC_SCHEDULER_IMPL_H -#define COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_CRYPTAUTH_SYNC_SCHEDULER_IMPL_H +#ifndef COMPONENTS_CRYPTAUTH_SYNC_SCHEDULER_IMPL_H_ +#define COMPONENTS_CRYPTAUTH_SYNC_SCHEDULER_IMPL_H_ #include @@ -101,4 +101,4 @@ class SyncSchedulerImpl : public SyncScheduler { } // namespace cryptauth -#endif // COMPONENTS_PROXIMITY_CRYPTAUTH_CRYPTAUTH_SYNC_SCHEDULER_IMPL_H +#endif // COMPONENTS_CRYPTAUTH_SYNC_SCHEDULER_IMPL_H_ diff --git a/components/cryptauth/wire_message.h b/components/cryptauth/wire_message.h index cbb34054d08c89..2ab1db9a179689 100644 --- a/components/cryptauth/wire_message.h +++ b/components/cryptauth/wire_message.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_CRYPTAUTH_WIRE_MESSAGE_H -#define COMPONENTS_CRYPTAUTH_WIRE_MESSAGE_H +#ifndef COMPONENTS_CRYPTAUTH_WIRE_MESSAGE_H_ +#define COMPONENTS_CRYPTAUTH_WIRE_MESSAGE_H_ #include #include @@ -46,4 +46,4 @@ class WireMessage { } // namespace cryptauth -#endif // COMPONENTS_CRYPTAUTH_WIRE_MESSAGE_H +#endif // COMPONENTS_CRYPTAUTH_WIRE_MESSAGE_H_