| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // A complete set of unit tests for OAuth2MintTokenFlow. | 5 // A complete set of unit tests for OAuth2MintTokenFlow. |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 class MockMintTokenFlow : public OAuth2MintTokenFlow { | 136 class MockMintTokenFlow : public OAuth2MintTokenFlow { |
| 137 public: | 137 public: |
| 138 explicit MockMintTokenFlow(MockDelegate* delegate, | 138 explicit MockMintTokenFlow(MockDelegate* delegate, |
| 139 const OAuth2MintTokenFlow::Parameters& parameters ) | 139 const OAuth2MintTokenFlow::Parameters& parameters ) |
| 140 : OAuth2MintTokenFlow(NULL, delegate, parameters) {} | 140 : OAuth2MintTokenFlow(NULL, delegate, parameters) {} |
| 141 ~MockMintTokenFlow() {} | 141 ~MockMintTokenFlow() {} |
| 142 | 142 |
| 143 MOCK_METHOD0(CreateAccessTokenFetcher, OAuth2AccessTokenFetcher*()); | 143 MOCK_METHOD0(CreateAccessTokenFetcher, OAuth2AccessTokenFetcher*()); |
| 144 MOCK_METHOD0(CreateMintTokenFetcher, OAuth2MintTokenFetcher*()); | |
| 145 }; | 144 }; |
| 146 | 145 |
| 147 } // namespace | 146 } // namespace |
| 148 | 147 |
| 149 class OAuth2MintTokenFlowTest : public testing::Test { | 148 class OAuth2MintTokenFlowTest : public testing::Test { |
| 150 public: | 149 public: |
| 151 OAuth2MintTokenFlowTest() {} | 150 OAuth2MintTokenFlowTest() {} |
| 152 virtual ~OAuth2MintTokenFlowTest() { } | 151 virtual ~OAuth2MintTokenFlowTest() { } |
| 153 | 152 |
| 154 protected: | 153 protected: |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 } | 348 } |
| 350 | 349 |
| 351 { // Non-null delegate. | 350 { // Non-null delegate. |
| 352 GoogleServiceAuthError error( | 351 GoogleServiceAuthError error( |
| 353 GoogleServiceAuthError::FromConnectionError(101)); | 352 GoogleServiceAuthError::FromConnectionError(101)); |
| 354 CreateFlow(OAuth2MintTokenFlow::MODE_MINT_TOKEN_NO_FORCE); | 353 CreateFlow(OAuth2MintTokenFlow::MODE_MINT_TOKEN_NO_FORCE); |
| 355 EXPECT_CALL(delegate_, OnMintTokenFailure(error)); | 354 EXPECT_CALL(delegate_, OnMintTokenFailure(error)); |
| 356 flow_->ProcessMintAccessTokenFailure(error); | 355 flow_->ProcessMintAccessTokenFailure(error); |
| 357 } | 356 } |
| 358 } | 357 } |
| OLD | NEW |