| Index: components/cryptauth/cryptauth_client_impl_unittest.cc
|
| diff --git a/components/proximity_auth/cryptauth/cryptauth_client_impl_unittest.cc b/components/cryptauth/cryptauth_client_impl_unittest.cc
|
| similarity index 93%
|
| rename from components/proximity_auth/cryptauth/cryptauth_client_impl_unittest.cc
|
| rename to components/cryptauth/cryptauth_client_impl_unittest.cc
|
| index 4fca644fc6a4b9cefab44e3f88f016d9d80f6fd1..9bb00daa88423131aadea0110099c270d2df9eb9 100644
|
| --- a/components/proximity_auth/cryptauth/cryptauth_client_impl_unittest.cc
|
| +++ b/components/cryptauth/cryptauth_client_impl_unittest.cc
|
| @@ -2,16 +2,16 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "components/proximity_auth/cryptauth/cryptauth_client_impl.h"
|
| +#include "components/cryptauth/cryptauth_client_impl.h"
|
|
|
| #include "base/command_line.h"
|
| #include "base/macros.h"
|
| #include "base/memory/ptr_util.h"
|
| #include "base/test/null_task_runner.h"
|
| -#include "components/proximity_auth/cryptauth/cryptauth_access_token_fetcher.h"
|
| -#include "components/proximity_auth/cryptauth/cryptauth_api_call_flow.h"
|
| -#include "components/proximity_auth/cryptauth/proto/cryptauth_api.pb.h"
|
| -#include "components/proximity_auth/cryptauth/switches.h"
|
| +#include "components/cryptauth/cryptauth_access_token_fetcher.h"
|
| +#include "components/cryptauth/cryptauth_api_call_flow.h"
|
| +#include "components/cryptauth/proto/cryptauth_api.pb.h"
|
| +#include "components/cryptauth/switches.h"
|
| #include "google_apis/gaia/fake_oauth2_token_service.h"
|
| #include "net/url_request/test_url_fetcher_factory.h"
|
| #include "net/url_request/url_request_test_util.h"
|
| @@ -25,7 +25,7 @@ using testing::Return;
|
| using testing::SaveArg;
|
| using testing::StrictMock;
|
|
|
| -namespace proximity_auth {
|
| +namespace cryptauth {
|
|
|
| namespace {
|
|
|
| @@ -92,9 +92,9 @@ void SaveResult(T* out, const T& result) {
|
|
|
| } // namespace
|
|
|
| -class ProximityAuthCryptAuthClientTest : public testing::Test {
|
| +class CryptAuthClientTest : public testing::Test {
|
| protected:
|
| - ProximityAuthCryptAuthClientTest()
|
| + CryptAuthClientTest()
|
| : access_token_fetcher_(new FakeCryptAuthAccessTokenFetcher()),
|
| api_call_flow_(new StrictMock<MockCryptAuthApiCallFlow>()),
|
| url_request_context_(
|
| @@ -155,7 +155,7 @@ class ProximityAuthCryptAuthClientTest : public testing::Test {
|
| CryptAuthApiCallFlow::ErrorCallback flow_error_callback_;
|
| };
|
|
|
| -TEST_F(ProximityAuthCryptAuthClientTest, GetMyDevicesSuccess) {
|
| +TEST_F(CryptAuthClientTest, GetMyDevicesSuccess) {
|
| ExpectRequest(
|
| "https://www.testgoogleapis.com/cryptauth/v1/deviceSync/"
|
| "getmydevices?alt=proto");
|
| @@ -195,7 +195,7 @@ TEST_F(ProximityAuthCryptAuthClientTest, GetMyDevicesSuccess) {
|
| EXPECT_TRUE(result_proto.devices(1).unlockable());
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthClientTest, GetMyDevicesFailure) {
|
| +TEST_F(CryptAuthClientTest, GetMyDevicesFailure) {
|
| ExpectRequest(
|
| "https://www.testgoogleapis.com/cryptauth/v1/deviceSync/"
|
| "getmydevices?alt=proto");
|
| @@ -210,7 +210,7 @@ TEST_F(ProximityAuthCryptAuthClientTest, GetMyDevicesFailure) {
|
| EXPECT_EQ(kStatus500Error, error_message);
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthClientTest, FindEligibleUnlockDevicesSuccess) {
|
| +TEST_F(CryptAuthClientTest, FindEligibleUnlockDevicesSuccess) {
|
| ExpectRequest(
|
| "https://www.testgoogleapis.com/cryptauth/v1/deviceSync/"
|
| "findeligibleunlockdevices?alt=proto");
|
| @@ -253,7 +253,7 @@ TEST_F(ProximityAuthCryptAuthClientTest, FindEligibleUnlockDevicesSuccess) {
|
| result_proto.ineligible_devices(0).reasons(0));
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthClientTest, FindEligibleUnlockDevicesFailure) {
|
| +TEST_F(CryptAuthClientTest, FindEligibleUnlockDevicesFailure) {
|
| ExpectRequest(
|
| "https://www.testgoogleapis.com/cryptauth/v1/deviceSync/"
|
| "findeligibleunlockdevices?alt=proto");
|
| @@ -271,7 +271,7 @@ TEST_F(ProximityAuthCryptAuthClientTest, FindEligibleUnlockDevicesFailure) {
|
| EXPECT_EQ(kStatus403Error, error_message);
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthClientTest, SendDeviceSyncTickleSuccess) {
|
| +TEST_F(CryptAuthClientTest, SendDeviceSyncTickleSuccess) {
|
| ExpectRequest(
|
| "https://www.testgoogleapis.com/cryptauth/v1/deviceSync/"
|
| "senddevicesynctickle?alt=proto");
|
| @@ -290,7 +290,7 @@ TEST_F(ProximityAuthCryptAuthClientTest, SendDeviceSyncTickleSuccess) {
|
| FinishApiCallFlow(&response_proto);
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthClientTest, ToggleEasyUnlockSuccess) {
|
| +TEST_F(CryptAuthClientTest, ToggleEasyUnlockSuccess) {
|
| ExpectRequest(
|
| "https://www.testgoogleapis.com/cryptauth/v1/deviceSync/"
|
| "toggleeasyunlock?alt=proto");
|
| @@ -316,7 +316,7 @@ TEST_F(ProximityAuthCryptAuthClientTest, ToggleEasyUnlockSuccess) {
|
| FinishApiCallFlow(&response_proto);
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthClientTest, SetupEnrollmentSuccess) {
|
| +TEST_F(CryptAuthClientTest, SetupEnrollmentSuccess) {
|
| ExpectRequest(
|
| "https://www.testgoogleapis.com/cryptauth/v1/enrollment/"
|
| "setup?alt=proto");
|
| @@ -362,7 +362,7 @@ TEST_F(ProximityAuthCryptAuthClientTest, SetupEnrollmentSuccess) {
|
| EXPECT_EQ("ephemeral_key", result_proto.infos(0).server_ephemeral_key());
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthClientTest, FinishEnrollmentSuccess) {
|
| +TEST_F(CryptAuthClientTest, FinishEnrollmentSuccess) {
|
| ExpectRequest(
|
| "https://www.testgoogleapis.com/cryptauth/v1/enrollment/"
|
| "finish?alt=proto");
|
| @@ -395,7 +395,7 @@ TEST_F(ProximityAuthCryptAuthClientTest, FinishEnrollmentSuccess) {
|
| EXPECT_EQ("OK", result_proto.status());
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthClientTest, FetchAccessTokenFailure) {
|
| +TEST_F(CryptAuthClientTest, FetchAccessTokenFailure) {
|
| access_token_fetcher_->set_access_token("");
|
|
|
| std::string error_message;
|
| @@ -406,7 +406,7 @@ TEST_F(ProximityAuthCryptAuthClientTest, FetchAccessTokenFailure) {
|
| EXPECT_EQ("Failed to get a valid access token.", error_message);
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthClientTest, ParseResponseProtoFailure) {
|
| +TEST_F(CryptAuthClientTest, ParseResponseProtoFailure) {
|
| ExpectRequest(
|
| "https://www.testgoogleapis.com/cryptauth/v1/deviceSync/"
|
| "getmydevices?alt=proto");
|
| @@ -420,7 +420,7 @@ TEST_F(ProximityAuthCryptAuthClientTest, ParseResponseProtoFailure) {
|
| EXPECT_EQ("Failed to parse response proto.", error_message);
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthClientTest,
|
| +TEST_F(CryptAuthClientTest,
|
| MakeSecondRequestBeforeFirstRequestSucceeds) {
|
| ExpectRequest(
|
| "https://www.testgoogleapis.com/cryptauth/v1/deviceSync/"
|
| @@ -456,7 +456,7 @@ TEST_F(ProximityAuthCryptAuthClientTest,
|
| EXPECT_EQ(kPublicKey1, result_proto.devices(0).public_key());
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthClientTest,
|
| +TEST_F(CryptAuthClientTest,
|
| MakeSecondRequestBeforeFirstRequestFails) {
|
| ExpectRequest(
|
| "https://www.testgoogleapis.com/cryptauth/v1/deviceSync/"
|
| @@ -485,7 +485,7 @@ TEST_F(ProximityAuthCryptAuthClientTest,
|
| EXPECT_EQ(kStatus429Error, error_message);
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthClientTest,
|
| +TEST_F(CryptAuthClientTest,
|
| MakeSecondRequestAfterFirstRequestSucceeds) {
|
| // Make first request successfully.
|
| {
|
| @@ -518,7 +518,7 @@ TEST_F(ProximityAuthCryptAuthClientTest,
|
| }
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthClientTest, DeviceClassifierIsSet) {
|
| +TEST_F(CryptAuthClientTest, DeviceClassifierIsSet) {
|
| ExpectRequest(
|
| "https://www.testgoogleapis.com/cryptauth/v1/deviceSync/"
|
| "getmydevices?alt=proto");
|
| @@ -543,7 +543,7 @@ TEST_F(ProximityAuthCryptAuthClientTest, DeviceClassifierIsSet) {
|
| EXPECT_EQ(kDeviceType, device_classifier.device_type());
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthClientTest, GetAccessTokenUsed) {
|
| +TEST_F(CryptAuthClientTest, GetAccessTokenUsed) {
|
| EXPECT_TRUE(client_->GetAccessTokenUsed().empty());
|
| ExpectRequest(
|
| "https://www.testgoogleapis.com/cryptauth/v1/deviceSync/"
|
| @@ -559,4 +559,4 @@ TEST_F(ProximityAuthCryptAuthClientTest, GetAccessTokenUsed) {
|
| EXPECT_EQ(kAccessToken, client_->GetAccessTokenUsed());
|
| }
|
|
|
| -} // namespace proximity_auth
|
| +} // namespace cryptauth
|
|
|