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" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/common/net/gaia/google_service_auth_error.h" | 13 #include "chrome/common/net/gaia/google_service_auth_error.h" |
14 #include "chrome/common/net/gaia/oauth2_mint_token_flow.h" | 14 #include "chrome/common/net/gaia/oauth2_mint_token_flow.h" |
15 #include "content/test/test_url_fetcher_factory.h" | 15 #include "content/test/test_url_fetcher_factory.h" |
16 #include "net/url_request/url_request_status.h" | 16 #include "net/url_request/url_request_status.h" |
17 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 | 19 |
20 using content::URLFetcher; | 20 using net::URLFetcher; |
21 using net::URLRequestStatus; | 21 using net::URLRequestStatus; |
22 using testing::_; | 22 using testing::_; |
23 using testing::StrictMock; | 23 using testing::StrictMock; |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 static const char kValidTokenResponse[] = | 27 static const char kValidTokenResponse[] = |
28 "{" | 28 "{" |
29 " \"token\": \"at1\"," | 29 " \"token\": \"at1\"," |
30 " \"issueAdvice\": \"Auto\"" | 30 " \"issueAdvice\": \"Auto\"" |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 } | 347 } |
348 | 348 |
349 { // Non-null delegate. | 349 { // Non-null delegate. |
350 GoogleServiceAuthError error( | 350 GoogleServiceAuthError error( |
351 GoogleServiceAuthError::FromConnectionError(101)); | 351 GoogleServiceAuthError::FromConnectionError(101)); |
352 CreateFlow(OAuth2MintTokenFlow::MODE_MINT_TOKEN_NO_FORCE); | 352 CreateFlow(OAuth2MintTokenFlow::MODE_MINT_TOKEN_NO_FORCE); |
353 EXPECT_CALL(delegate_, OnMintTokenFailure(error)); | 353 EXPECT_CALL(delegate_, OnMintTokenFailure(error)); |
354 flow_->ProcessMintAccessTokenFailure(error); | 354 flow_->ProcessMintAccessTokenFailure(error); |
355 } | 355 } |
356 } | 356 } |
OLD | NEW |