| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/proximity_auth/cryptauth/cryptauth_client.h" | 5 #include "components/proximity_auth/cryptauth/cryptauth_client.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/test/null_task_runner.h" | 8 #include "base/test/null_task_runner.h" |
| 9 #include "components/proximity_auth/cryptauth/cryptauth_access_token_fetcher.h" | 9 #include "components/proximity_auth/cryptauth/cryptauth_access_token_fetcher.h" |
| 10 #include "components/proximity_auth/cryptauth/cryptauth_api_call_flow.h" | 10 #include "components/proximity_auth/cryptauth/cryptauth_api_call_flow.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 } // namespace | 106 } // namespace |
| 107 | 107 |
| 108 class ProximityAuthCryptAuthClientTest : public testing::Test { | 108 class ProximityAuthCryptAuthClientTest : public testing::Test { |
| 109 protected: | 109 protected: |
| 110 ProximityAuthCryptAuthClientTest() | 110 ProximityAuthCryptAuthClientTest() |
| 111 : access_token_fetcher_(new FakeCryptAuthAccessTokenFetcher()), | 111 : access_token_fetcher_(new FakeCryptAuthAccessTokenFetcher()), |
| 112 url_request_context_( | 112 url_request_context_( |
| 113 new net::TestURLRequestContextGetter(new base::NullTaskRunner())), | 113 new net::TestURLRequestContextGetter(new base::NullTaskRunner())), |
| 114 serialized_request_(std::string()) {} | 114 serialized_request_(std::string()) {} |
| 115 virtual ~ProximityAuthCryptAuthClientTest() {} | |
| 116 | 115 |
| 117 void SetUp() override { | 116 void SetUp() override { |
| 118 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 117 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 119 switches::kCryptAuthHTTPHost, kTestGoogleApisUrl); | 118 switches::kCryptAuthHTTPHost, kTestGoogleApisUrl); |
| 120 | 119 |
| 121 client_.reset(new StrictMock<MockCryptAuthClient>(access_token_fetcher_, | 120 client_.reset(new StrictMock<MockCryptAuthClient>(access_token_fetcher_, |
| 122 url_request_context_)); | 121 url_request_context_)); |
| 123 } | 122 } |
| 124 | 123 |
| 125 // Sets up an expectation and captures a CryptAuth API request to | 124 // Sets up an expectation and captures a CryptAuth API request to |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 client_->FindEligibleUnlockDevices( | 518 client_->FindEligibleUnlockDevices( |
| 520 cryptauth::FindEligibleUnlockDevicesRequest(), | 519 cryptauth::FindEligibleUnlockDevicesRequest(), |
| 521 base::Bind(&NotCalled<cryptauth::FindEligibleUnlockDevicesResponse>), | 520 base::Bind(&NotCalled<cryptauth::FindEligibleUnlockDevicesResponse>), |
| 522 base::Bind(&SaveResult<std::string>, &error_message)); | 521 base::Bind(&SaveResult<std::string>, &error_message)); |
| 523 EXPECT_EQ("Client has been used for another request. Do not reuse.", | 522 EXPECT_EQ("Client has been used for another request. Do not reuse.", |
| 524 error_message); | 523 error_message); |
| 525 } | 524 } |
| 526 } | 525 } |
| 527 | 526 |
| 528 } // namespace proximity_auth | 527 } // namespace proximity_auth |
| OLD | NEW |